From ef4d0e08b2d312bcf3034aa3ae48436f5d8b56a5 Mon Sep 17 00:00:00 2001 From: Owl Date: Thu, 21 Aug 2025 20:07:13 -0400 Subject: all the stuff --- obj_kcl_export.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'obj_kcl_export.py') diff --git a/obj_kcl_export.py b/obj_kcl_export.py index b106869..56b6d18 100644 --- a/obj_kcl_export.py +++ b/obj_kcl_export.py @@ -12,29 +12,27 @@ def write_kcl_obj(context, filepath): scene = bpy.context.scene # if nothing is selected end the exporter - if (scene.objects.active == None or scene.objects.active.type != 'ARMATURE'): + if (scene.objects.active == None or scene.objects.active.type != "ARMATURE"): if (scene.objects.active == None): blender_funcs.disp_msg("No Armature selected. Select one and try again.") else: - blender_funcs.disp_msg("No Armature selected. Currently selecting: \"%s\"" - % (scene.objects.active.name)) - return {'FINISHED'} + blender_funcs.disp_msg("No Armature selected. Currently selecting: \"%s\"" % (scene.objects.active.name)) + return {"FINISHED"} # get armature object armature = scene.objects.active print("\nArmature found: \"%s\"" % (armature.name)) - # change to object mode - bpy.ops.object.mode_set(mode='OBJECT') + # select it well + blender_funcs.select_obj(armature, False, "OBJECT") # check if the armature contains only mesh objects inside for obj in armature.children: - if (obj.type != 'MESH'): - blender_funcs.disp_msg("\"%s\": contains non-mesh object (%s)." - % (armature.name, obj.name)) - return {'FINISHED'} + if (obj.type != "MESH"): + blender_funcs.disp_msg("\"%s\": contains non-mesh object (%s)." % (armature.name, obj.name)) + return {"FINISHED"} # select all the meshes inside the armature - blender_funcs.select_obj(scene, armature, True) + blender_funcs.select_obj(armature, True, "OBJECT") # export the object bpy.ops.export_scene.obj(filepath = filepath, axis_up = "Y", axis_forward = "-Z", @@ -42,9 +40,9 @@ def write_kcl_obj(context, filepath): use_materials = True, use_normals = True) # done! - blender_funcs.select_obj(scene, armature, False) + blender_funcs.select_obj(armature, False, "OBJECT") blender_funcs.disp_msg("Meshes from \"%s\" exported!" % (armature.name)) - return {'FINISHED'} + return {"FINISHED"} # Stuff down is for the menu appending # of the exporter to work plus some setting stuff -- cgit v1.2.3-70-g09d2