43 if isinstance(node, scene.GeometryNode):
44 used_geometries_id.add(node.geometry.id)
47 active_primitives_in_geometry = []
48 for primitive
in node.geometry.primitives:
49 if isinstance(primitive, triangleset.TriangleSet):
50 if primitive.ntriangles != 0:
51 active_primitives_in_geometry.append(primitive)
53 print(
"{} is not supported".format(type(primitive)))
54 node.geometry.primitives = active_primitives_in_geometry
57 used_materials_in_geometry = set()
58 for primitive
in node.geometry.primitives:
59 used_materials_in_geometry.add(primitive.material)
60 active_materials_in_geometry = []
61 for material
in node.materials:
62 if material.symbol
in used_materials_in_geometry:
63 active_materials_in_geometry.append(material)
64 node.materials = active_materials_in_geometry
66 for material
in node.materials:
67 used_materials_id.add(material.target.id)
69 if isinstance(node, scene.Node):
74 used_geometries_id = set()
75 used_materials_id = set()
79 active_geometries = []
80 for geometry
in mesh_.geometries:
81 if geometry.id
in used_geometries_id:
82 active_geometries.append(geometry)
83 mesh_.geometries = active_geometries
87 for material
in mesh_.materials:
88 if material.id
in used_materials_id:
89 active_materials.append(material)
90 mesh_.materials = active_materials
93 used_effects_id = set()
94 for material
in mesh_.materials:
95 used_effects_id.add(material.effect.id)
97 for effect
in mesh_.effects:
98 if effect.id
in used_effects_id:
99 active_effects.append(effect)
100 mesh_.effects = active_effects
103 mesh_.animations = []
105 node = mesh_.xmlnode.find(tag(
"library_animations"))
107 mesh_.xmlnode.getroot().remove(node)
def search_used_geom_mat(nodes, used_geometries_id, used_materials_id)
def simplify_collada(mesh_)