def _convert_fmdl(self, fmdl):
# If no parent is given, create an empty object holding the FSHP child mesh objects of this FMDL.
if self.operator.parent_ob_name:
fmdl_ob = None
else:
fmdl_ob = bpy.data.objects.new(fmdl.header.file_name_offset.name, None)
Importer._add_object_to_group(fmdl_ob, "BFRES")
bpy.context.scene.objects.link(fmdl_ob)
# Go through the polygons in this model and create mesh objects representing them.
for fshp_node in fmdl.fshp_index_group[1:]:
fshp_ob = self._convert_fshp(fmdl, fshp_node.data)
if self.operator.parent_ob_name:
# Just parent the mesh object to the given object.
fshp_ob.parent = bpy.data.objects[self.operator.parent_ob_name]
else:
# Parent to the empty FMDL object and link it to the scene.
fshp_ob.parent = fmdl_ob
Importer._add_object_to_group(fshp_ob, "BFRES")
bpy.context.scene.objects.link(fshp_ob)
评论列表
文章目录