bump to v0.0.7: Add convert to empties operator and add icon to specials menu operator #6

Merged
dupoxy merged 7 commits from v0.0.7 into main 2024-09-26 21:06:19 +02:00
Showing only changes of commit e7600da66c - Show all commits

View File

@ -32,8 +32,8 @@ class C3DB_MT_menu_specials(bpy.types.Menu):
layout.separator()
layout.operator("c3db.delete_all", icon="TRASH")
layout.separator()
# layout.operator("C3DB_OT_export_selected_to_empty", icon="OUTLINER")
layout.operator("C3DB_OT_export_all_to_empties", icon="OUTLINER")
layout.operator("C3DB_OT_export_selected_to_empty", icon="OUTLINER")
layout.operator("C3DB_OT_export_all_to_empties")
class C3DB_UL_list(bpy.types.UIList):
@ -304,7 +304,7 @@ class C3DB_OT_move_down_list(bpy.types.Operator):
return {"FINISHED"}
# TODO Do the same for only the selected cursor and see how to sync the names too.
# TODO see how to sync the names too.
class C3DB_OT_export_all_to_empties(bpy.types.Operator):
"""Export all 3D Cursors to empty objects. This operator is inactive if:
You are not in Object Mode ..."""
@ -344,6 +344,33 @@ class C3DB_OT_export_all_to_empties(bpy.types.Operator):
)
return {"FINISHED"}
# TODO see how to sync the names too.
class C3DB_OT_export_selected_to_empty(bpy.types.Operator):
"""Export selected 3D Cursor to an empty object"""
bl_idname = "c3db.export_selected_to_empty"
bl_label = "Export Selected to Empty"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
return (context.scene.C3DB_3Dcursors_collection and
context.scene.C3DB_3Dcursors_index < len(context.scene.C3DB_3Dcursors_collection) and
context.mode == "OBJECT")
def execute(self, context):
item = context.scene.C3DB_3Dcursors_collection[context.scene.C3DB_3Dcursors_index]
if item.rotation_mode == "QUATERNION":
rotation = Quaternion(item.rotation_quaternion)
rotation_euler = rotation.to_euler()
elif item.rotation_mode == "AXIS_ANGLE":
rotation = Quaternion(Vector(item.rotation_axis_angle).yzw, item.rotation_axis_angle[0])
rotation_euler = rotation.to_euler()
else:
rotation_euler = item.rotation_euler
bpy.ops.object.empty_add(type="PLAIN_AXES", radius=1, location=item.location, rotation=rotation_euler)
return {"FINISHED"}
class C3DB_PT_panel(bpy.types.Panel):
bl_label = "3D Cursors Briefcase"
@ -399,8 +426,9 @@ classes = (
C3DB_OT_move_up_list,
C3DB_OT_move_down_list,
C3DB_OT_export_all_to_empties,
C3DB_OT_export_selected_to_empty,
C3DB_PT_panel,
) # TODO C3DB_OT_export_selected_to_empty,
)
c3db_keymaps = []