mirror of
https://github.com/open-goal/jak-project
synced 2026-07-10 23:22:17 -04:00
[custom levels] add invisible option (#1729)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
bl_info = {
|
||||
"name": "OpenGOAL Mesh",
|
||||
"author": "water111",
|
||||
"version": (0, 0, 1),
|
||||
"version": (0, 0, 2),
|
||||
"blender": (2, 83, 0),
|
||||
"location": "3D View",
|
||||
"description": "OpenGOAL Mesh tools",
|
||||
"category": "Development"
|
||||
}
|
||||
|
||||
|
||||
import bpy
|
||||
import colorsys
|
||||
import bmesh
|
||||
@@ -64,10 +64,11 @@ pat_events = [
|
||||
("burnup", "burnup", "", 5),
|
||||
("melt", "melt", "", 6),
|
||||
]
|
||||
|
||||
|
||||
def draw_func(self, context):
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
layout.prop(ob.active_material, "set_invisible")
|
||||
layout.prop(ob.active_material, "set_collision")
|
||||
if (ob.active_material.set_collision):
|
||||
layout.prop(ob.active_material, "ignore")
|
||||
@@ -77,10 +78,11 @@ def draw_func(self, context):
|
||||
layout.prop(ob.active_material, "noentity")
|
||||
layout.prop(ob.active_material, "nolineofsight")
|
||||
layout.prop(ob.active_material, "nocamera")
|
||||
|
||||
|
||||
def draw_func_ob(self, context):
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
layout.prop(ob, "set_invisible")
|
||||
layout.prop(ob, "set_collision")
|
||||
if (ob.set_collision):
|
||||
layout.prop(ob, "ignore")
|
||||
@@ -92,6 +94,7 @@ def draw_func_ob(self, context):
|
||||
layout.prop(ob, "nocamera")
|
||||
|
||||
def register():
|
||||
bpy.types.Material.set_invisible = bpy.props.BoolProperty(name="Invisible")
|
||||
bpy.types.Material.set_collision = bpy.props.BoolProperty(name="Apply Collision Properties")
|
||||
bpy.types.Material.ignore = bpy.props.BoolProperty(name="ignore")
|
||||
bpy.types.Material.noedge = bpy.props.BoolProperty(name="No-Edge")
|
||||
@@ -101,7 +104,8 @@ def register():
|
||||
bpy.types.Material.collide_material = bpy.props.EnumProperty(items = pat_surfaces, name = "Material")
|
||||
bpy.types.Material.collide_event = bpy.props.EnumProperty(items = pat_events, name = "Event")
|
||||
bpy.types.MATERIAL_PT_custom_props.prepend(draw_func)
|
||||
|
||||
|
||||
bpy.types.Object.set_invisible = bpy.props.BoolProperty(name="Invisible")
|
||||
bpy.types.Object.set_collision = bpy.props.BoolProperty(name="Apply Collision Properties")
|
||||
bpy.types.Object.ignore = bpy.props.BoolProperty(name="ignore")
|
||||
bpy.types.Object.noedge = bpy.props.BoolProperty(name="No-Edge")
|
||||
|
||||
@@ -522,14 +522,17 @@ void extract(const Input& in,
|
||||
|
||||
for (const auto& n : all_nodes) {
|
||||
const auto& node = model.nodes[n.node_idx];
|
||||
if (node.extras.Has("set_invisible") && node.extras.Get("set_invisible").Get<int>()) {
|
||||
continue;
|
||||
}
|
||||
if (node.mesh >= 0) {
|
||||
const auto& mesh = model.meshes[node.mesh];
|
||||
if (!mesh.extras.Has("tfrag")) {
|
||||
// fmt::print("skip tfrag: {}\n", mesh.name);
|
||||
// continue;
|
||||
}
|
||||
mesh_count++;
|
||||
for (const auto& prim : mesh.primitives) {
|
||||
if (model.materials[prim.material].extras.Has("set_invisible") &&
|
||||
model.materials[prim.material].extras.Get("set_invisible").Get<int>()) {
|
||||
continue;
|
||||
}
|
||||
prim_count++;
|
||||
// extract index buffer
|
||||
std::vector<u32> prim_indices = gltf_index_buffer(model, prim.indices, out.vertices.size());
|
||||
|
||||
Reference in New Issue
Block a user