2022-04-06 10:12:32 +02:00
|
|
|
import bpy
|
2024-02-19 11:53:15 +01:00
|
|
|
from bpy.props import (EnumProperty, StringProperty, PointerProperty, BoolProperty,
|
|
|
|
CollectionProperty, IntProperty)
|
|
|
|
|
2022-04-06 10:12:32 +02:00
|
|
|
import inspect
|
|
|
|
|
|
|
|
'''
|
|
|
|
def get_operator_items(self,context):
|
|
|
|
items = []
|
|
|
|
from . import func_picker as mod
|
|
|
|
|
|
|
|
for name, func in inspect.getmembers(mod, inspect.isfunction):
|
|
|
|
if inspect.getmodule(func) == mod:
|
|
|
|
items.append((name,name,""))
|
|
|
|
|
|
|
|
return items
|
|
|
|
'''
|
|
|
|
|
|
|
|
def bones_item(self,context):
|
|
|
|
items = []
|
|
|
|
|
|
|
|
if context.scene.rig_picker.rig:
|
|
|
|
for bone in context.scene.rig_picker.rig.pose.bones:
|
|
|
|
items.append((bone.name,bone.name,''))
|
|
|
|
return items
|
|
|
|
|
2024-02-19 11:53:15 +01:00
|
|
|
|
|
|
|
class RP_PG_picker_source(bpy.types.PropertyGroup):
|
|
|
|
source : StringProperty(subtype='FILE_PATH')
|
|
|
|
|
|
|
|
|
2022-04-06 10:12:32 +02:00
|
|
|
class RP_PG_armature_ui_settings(bpy.types.PropertyGroup):
|
|
|
|
name: StringProperty()
|
|
|
|
source: StringProperty(subtype='FILE_PATH')
|
2024-02-19 11:53:15 +01:00
|
|
|
sources: CollectionProperty(type=RP_PG_picker_source)
|
2022-04-06 10:12:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class RP_PG_object_ui_settings(bpy.types.PropertyGroup):
|
|
|
|
shape_type: EnumProperty(items=[(i.upper(), i, "") for i in ('Bone', 'Display', 'Operator')])
|
|
|
|
#idname: StringProperty()
|
|
|
|
#arguments: StringProperty()
|
|
|
|
operator: StringProperty()
|
|
|
|
shortcut: StringProperty()
|
|
|
|
name: StringProperty()
|
|
|
|
|
|
|
|
|
|
|
|
class RP_PG_scene_ui_settings(bpy.types.PropertyGroup):
|
2024-02-19 11:53:15 +01:00
|
|
|
enabled : BoolProperty(default=False)
|
2022-04-06 10:12:32 +02:00
|
|
|
rig: PointerProperty(type=bpy.types.Object)
|
|
|
|
canvas: PointerProperty(type=bpy.types.Object)
|
|
|
|
symmetry: PointerProperty(type=bpy.types.Object)
|
|
|
|
#idname: EnumProperty(items=[])
|
|
|
|
destination: StringProperty(subtype='FILE_PATH')
|
2023-03-31 14:53:41 +02:00
|
|
|
#bone_list: bpy.props.EnumProperty(items = bones_item
|
|
|
|
use_pick_bone : BoolProperty(default=False)
|
2022-04-06 10:12:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class RP_OT_operator_selector(bpy.types.Operator):
|
|
|
|
bl_label = "Select function"
|
|
|
|
bl_idname = "rigpicker.operator_selector"
|
|
|
|
bl_property = "idname"
|
|
|
|
#bl_options = {'REGISTER', 'UNDO'}
|
|
|
|
|
|
|
|
idname: EnumProperty(items=[])
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
ob = context.object
|
|
|
|
ob.rig_picker.idname = self.idname
|
|
|
|
context.area.tag_redraw()
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
wm = context.window_manager
|
|
|
|
wm.invoke_search_popup(self)
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
|
|
|
|
classes = (
|
2024-02-19 11:53:15 +01:00
|
|
|
RP_PG_picker_source,
|
2022-04-06 10:12:32 +02:00
|
|
|
RP_PG_object_ui_settings,
|
|
|
|
RP_PG_scene_ui_settings,
|
|
|
|
RP_PG_armature_ui_settings,
|
|
|
|
RP_OT_operator_selector,
|
|
|
|
)
|
|
|
|
|
|
|
|
def register():
|
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.register_class(cls)
|
|
|
|
|
|
|
|
bpy.types.Armature.rig_picker = bpy.props.PointerProperty(type=RP_PG_armature_ui_settings)
|
|
|
|
bpy.types.Object.rig_picker = bpy.props.PointerProperty(type=RP_PG_object_ui_settings)
|
|
|
|
bpy.types.Scene.rig_picker = bpy.props.PointerProperty(type=RP_PG_scene_ui_settings)
|
2024-02-19 11:53:15 +01:00
|
|
|
bpy.types.Collection.rig_picker = bpy.props.PointerProperty(type=RP_PG_scene_ui_settings)
|
2022-04-06 10:12:32 +02:00
|
|
|
|
|
|
|
def unregister():
|
|
|
|
del bpy.types.Scene.rig_picker
|
|
|
|
del bpy.types.Object.rig_picker
|
|
|
|
del bpy.types.Armature.rig_picker
|
|
|
|
|
|
|
|
for cls in reversed(classes):
|
|
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
|