diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c9ebf2d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python-envs.defaultEnvManager": "ms-python.python:system" +} \ No newline at end of file diff --git a/Plugin-dev.blend b/Plugin-dev.blend index ecd7b00..7f40393 100644 Binary files a/Plugin-dev.blend and b/Plugin-dev.blend differ diff --git a/Plugin-dev.blend1 b/Plugin-dev.blend1 index 692db41..d5b9530 100644 Binary files a/Plugin-dev.blend1 and b/Plugin-dev.blend1 differ diff --git a/Plugin-test-environment.blend b/Plugin-test-environment.blend new file mode 100644 index 0000000..900c9fa Binary files /dev/null and b/Plugin-test-environment.blend differ diff --git a/Plugin-test-environment.blend1 b/Plugin-test-environment.blend1 new file mode 100644 index 0000000..9b55d24 Binary files /dev/null and b/Plugin-test-environment.blend1 differ diff --git a/addon dev/mabulig-rigger/__init__.py b/addon dev/mabulig-rigger/__init__.py new file mode 100644 index 0000000..2c5859d --- /dev/null +++ b/addon dev/mabulig-rigger/__init__.py @@ -0,0 +1,438 @@ +bl_info = { + "name": "Mabulig Rigger Plugin", + "author": "Fritz Villahermosa", + "version": (1, 0), + "blender": (5, 2, 0), + "location": "View3D > Sidebar > Mabulig Rigger", + "description": "Frog rigging made simple!", + "category": "3D View", +} + + +import bpy +import os +from bpy.props import FloatProperty, PointerProperty, BoolProperty + +from . import rigger_functionality + +# ========================================================================= +# GLOBAL VARIABLES +# ========================================================================= + +# +# current_dir = os.path.dirname(bpy.data.filepath) +# filepath = os.path.join(current_dir, source_blend_name) + +# ========================================================================= +# PROPERTIES +# ========================================================================= + +# SVL Properties +class SpecimenProperties(bpy.types.PropertyGroup): + svl: FloatProperty( + name="Specimen SVL", + description="Snout-Vent Length of the specimen in meters", + default=0.1, # 10 cm default + min=0.001, + soft_max=10.0, + unit='LENGTH' + ) # pyright: ignore[reportInvalidTypeForm] + + # Model Picker + target_model: PointerProperty( + type=bpy.types.Object, + name="Target Model", + description="Points to the specimen's 3d model" + ) # pyright: ignore[reportInvalidTypeForm] + +class PanelProperties(bpy.types.PropertyGroup): + panel1_g2: BoolProperty( + name="Panel 1, Group 2", + description="Toggle panel/group visibility", + default=True + ) # pyright: ignore[reportInvalidTypeForm] + panel2_g1: BoolProperty( + name="Panel 2, Group 1", + description="Toggle panel/group visibility", + default=True + ) # pyright: ignore[reportInvalidTypeForm] + panel3_g1: BoolProperty( + name="Panel 3, Group 1", + description="Toggle panel/group visibility", + default=False + ) # pyright: ignore[reportInvalidTypeForm] + + +# ========================================================================= +# Functions +# ========================================================================= + +def hide_all_coll(): + mabulig_rig_coll = bpy.data.collections['Mabulig-Rig'].children + for collection in mabulig_rig_coll: + collection.hide_viewport = True + + mabulig_rig_objects = bpy.data.collections['Mabulig-Rig'].objects + for obj in mabulig_rig_objects: + obj.hide_viewport = True + + +def show_all_helpers(): + mabulig_rig_coll = bpy.data.collections['Mabulig-Rig'].children + for collection in mabulig_rig_coll: + collection.hide_viewport = False + + mabulig_rig_objects = bpy.data.collections['Mabulig-Rig'].objects + for obj in mabulig_rig_objects: + obj.hide_viewport = False + + +def inspect_scene(): + coll_name = "Mabulig-Rig" + if bpy.data.collections.get(coll_name) is not None: + bpy.context.scene.panel_propert.panel2_g1 = False + bpy.context.scene.panel_propert.panel3_g1 = True + else: + bpy.context.scene.panel_propert.panel3_g1 = False + bpy.context.scene.panel_propert.panel2_g1 = True + + + +# ========================================================================= +# OPERATORS +# ========================================================================= + +# SETUP SCENE BUTTON +class SceneSetup(bpy.types.Operator): + bl_idname = "scene_setup.operator" + bl_label = "Setup Scene" + bl_description = "Imports all the necessary rigging setup components" + + def execute(self, context): + source_blend_name = "rig_setup.blend" + collection_name = "Mabulig-Rig" + script_dir = os.path.dirname(os.path.abspath(__file__)) + filepath = os.path.join(script_dir, source_blend_name) + + with bpy.data.libraries.load(filepath) as (data_from, data_to): + if collection_name in data_from.collections: + data_to.collections.append(collection_name) + else: + print(f"Collection '{collection_name}' not found in {source_blend_name}") + + appended_collection = bpy.data.collections.get(collection_name) + if appended_collection: + # Link it to the scene's master collection + bpy.context.scene.collection.children.link(appended_collection) + print(f"Successfully appended and linked collection: '{collection_name}'") + + # initially hide all collections + hide_all_coll(); + + #make certain layers unselectable + bpy.data.collections['gular'].hide_select = True + bpy.data.collections['belly_l'].hide_select = True + bpy.data.collections['belly_r'].hide_select = True + bpy.data.collections['nostril_l'].hide_select = True + bpy.data.collections['nostril_r'].hide_select = True + + #Disable self panel group + bpy.context.scene.panel_propert.panel2_g1 = False + bpy.context.scene.panel_propert.panel3_g1 = True + return {'FINISHED'} + +# SETUP SKELETAL BONES +class SkelSetup(bpy.types.Operator): + bl_idname = "skel_setup.operator" + bl_label = "Skeleton" + bl_description = "Enables the empties for easier skeletal bone placement" + + def execute(self, context): + hide_all_coll(); + bpy.data.collections['helpers'].hide_viewport = False + return {'FINISHED'} + +# SETUP GULAR BONES +class GularSetup(bpy.types.Operator): + bl_idname = "gular_setup.operator" + bl_label = "Gular" + bl_description = "Enables the gular mesh" + + def execute(self, context): + hide_all_coll(); + bpy.data.objects['gular_mesh'].hide_viewport = False + # bpy.data.collections['gular'].hide_viewport = False + return {'FINISHED'} + +# SETUP BELLY BONES +class BellySetup(bpy.types.Operator): + bl_idname = "belly_setup.operator" + bl_label = "Belly" + bl_description = "Enables the belly mesh" + + def execute(self, context): + hide_all_coll(); + bpy.data.objects['belly_mesh'].hide_viewport = False + # bpy.data.collections['belly_l'].hide_viewport = False + # bpy.data.collections['belly_r'].hide_viewport = False + return {'FINISHED'} + +# SETUP NOSTRIL BONES +class NostrilsSetup(bpy.types.Operator): + bl_idname = "nostrils_setup.operator" + bl_label = "Nostrils" + bl_description = "Enables the nostrils mesh" + + def execute(self, context): + hide_all_coll(); + bpy.data.objects['nostril_mesh'].hide_viewport = False + # bpy.data.collections['nostril_l'].hide_viewport = False + # bpy.data.collections['nostril_r'].hide_viewport = False + return {'FINISHED'} + +# SETUP FINGER BONES +class FingersSetup(bpy.types.Operator): + bl_idname = "fingers_setup.operator" + bl_label = "Fingers" + bl_description = "Enables the empties for finger bones placement" + + def execute(self, context): + hide_all_coll(); + bpy.data.collections['fingers'].hide_viewport = False + return {'FINISHED'} + +# SETUP TOES BONES +class ToesSetup(bpy.types.Operator): + bl_idname = "toes_setup.operator" + bl_label = "Toes" + bl_description = "Enables the empties for toe bones placement" + + def execute(self, context): + hide_all_coll(); + bpy.data.collections['toes'].hide_viewport = False + return {'FINISHED'} + +# SPAWN RULER PLANE +class RulerPlane(bpy.types.Operator): + bl_idname = "ruler_plane.operator" + bl_label = "Spawn Ruler Plane" + bl_description = "Spawns a plane with the SVL length" + + def execute(self, context): + props = context.scene.specimen_props + svl_val = props.svl + + # Directly reset the scene cursor location and rotation + context.scene.cursor.location = (0.0, 0.0, 0.0) + context.scene.cursor.rotation_euler = (0.0, 0.0, 0.0) + + # Spawn plane mesh, set size to SVL, diplaymode to wireframe, then show in front + bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', scale=(1, 1, 1)) + rulerplane_obj = context.active_object + rulerplane_obj.scale = (svl_val, svl_val, 1.0) + bpy.ops.object.transform_apply(location=False, rotation=False, scale=True) + rulerplane_obj.name = f"Specimen_Plane_{svl_val:.2f}m" + rulerplane_obj.display_type = 'WIRE' + rulerplane_obj.show_in_front = True + + # Enable Panel 2, Group 2 + bpy.context.scene.panel_propert.panel1_g2 = True + + return {'FINISHED'} + +# APPLY SCALE +class ApplyScale(bpy.types.Operator): + bl_idname = "apply_scale.operator" + bl_label = "Apply Scale and Adjust" + bl_description = "Applies the scale and adjusts the mesh for the 3d viewer scale" + + def execute(self, context): + props = context.scene.specimen_props + + bpy.ops.object.select_all(action='DESELECT') + + target_obj = props.target_model + + if target_obj: + target_obj.select_set(True) + target_obj.scale = (10, 10, 10) + bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) + + # Enable Panel 2, Group 2 + bpy.context.scene.panel_propert.panel2_g1 = True + + else: + print("No model selected") + + return {'FINISHED'} + +# SHOW ALL +class ShowAllComponents(bpy.types.Operator): + bl_idname = "show_all_components.operator" + bl_label = "Show All" + bl_description = "Show all rigging components" + + def execute(self, context): + show_all_helpers() + bpy.data.objects['OG_Armature'].hide_viewport = True + bpy.data.collections['rig_shapes'].hide_viewport = True + bpy.data.collections['gular'].hide_viewport = True + bpy.data.collections['belly_l'].hide_viewport = True + bpy.data.collections['belly_r'].hide_viewport = True + bpy.data.collections['nostril_l'].hide_viewport = True + bpy.data.collections['nostril_r'].hide_viewport = True + return {'FINISHED'} + +# GENERATE CONTROL RIG +class GenerateControlRig(bpy.types.Operator): + bl_idname = "generate_control_rig.operator" + bl_label = "Generate Control Rig" + bl_description = "Builds the control rig according to helper placement" + + def execute(self, context): + return {'FINISHED'} + +# REFRESH BUTTON +class RefreshScene(bpy.types.Operator): + bl_idname = "refresh_inspect.operator" + bl_label = "Refresh" + bl_description = "Forces re-check to see if the Mabulig-Rig setup exists" + + def execute(self, context): + inspect_scene() + return {'FINISHED'} + +# ADJUST ARMATURE +class AdjustArmature(bpy.types.Operator): + bl_idname = "adjust_armature.operator" + bl_label = "Adjust Armature" + bl_description = "Auto setup armature to follow helpers" + + def execute(self, context): + rigger_functionality.startAutoRig() + return {'FINISHED'} + + +# ========================================================================= +# PANELS +# ========================================================================= + + + +class ModelPrepPanel(bpy.types.Panel): + + bl_label = "1. Model Preparation" + bl_idname = "model_prep.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw(self, context): + layout = self.layout + props = context.scene.specimen_props + + mod_prep_col1 = layout.column() + mod_prep_col1.prop(props, "svl") + mod_prep_col1.operator("ruler_plane.operator", icon='MESH_PLANE') + + layout.separator() + + mod_prep_col2 = layout.column() + mod_prep_col2.prop(props, "target_model") + mod_prep_col2.operator("apply_scale.operator", icon='FIXED_SIZE') + mod_prep_col2.enabled = bpy.context.scene.panel_propert.panel1_g2 + + + +class MabuligRiggerSceneSetupPanel(bpy.types.Panel): + + bl_label = "2. Scene Setup" + bl_idname = "scene_setup.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw_header_preset(self, context): + layout = self.layout + layout.operator("refresh_inspect.operator", icon='FILE_REFRESH') + + + def draw(self, context): + layout = self.layout + + #Add Scene Setup button + scene_prep_col1 = layout.column() + scene_prep_col1.operator("scene_setup.operator", icon='OUTLINER_COLLECTION') + scene_prep_col1.enabled = bpy.context.scene.panel_propert.panel2_g1 + + + + +class RiggingProcessPanel(bpy.types.Panel): + + bl_label = "3. Rigging Process" + bl_idname = "rigging_process.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw(self, context): + layout = self.layout + + rig_proc_row = layout.row() + rig_proc_row.alignment = 'CENTER' + rig_proc_row.label(text="Setup Helpers") + + rig_proc_grid = layout.grid_flow(columns=3, align=True) + #Add Buttons + rig_proc_grid.operator("skel_setup.operator") + rig_proc_grid.operator("gular_setup.operator") + rig_proc_grid.operator("fingers_setup.operator") + rig_proc_grid.operator("belly_setup.operator") + rig_proc_grid.operator("toes_setup.operator") + rig_proc_grid.operator("nostrils_setup.operator") + + rig_proc_row2 = layout.column() + rig_proc_row2.alignment = 'CENTER' + rig_proc_row2.operator("show_all_components.operator") + + + layout.separator() + + rig_proc_row3 = layout.column() + rig_proc_row3.alignment = 'CENTER' + rig_proc_row3.operator("adjust_armature.operator") + rig_proc_row3.operator("generate_control_rig.operator") + + + rig_proc_grid.enabled = bpy.context.scene.panel_propert.panel3_g1 + rig_proc_row2.enabled = bpy.context.scene.panel_propert.panel3_g1 + rig_proc_row3.enabled = bpy.context.scene.panel_propert.panel3_g1 + +classes = (SceneSetup, SkelSetup, GularSetup, BellySetup, NostrilsSetup, FingersSetup, ToesSetup, RulerPlane, ApplyScale, ModelPrepPanel, MabuligRiggerSceneSetupPanel, RiggingProcessPanel, SpecimenProperties, PanelProperties, ShowAllComponents, GenerateControlRig, RefreshScene, AdjustArmature) + +def register(): + for i in classes: + bpy.utils.register_class(i) + + + bpy.types.Scene.specimen_props = bpy.props.PointerProperty(type=SpecimenProperties) + bpy.types.Scene.panel_propert = bpy.props.PointerProperty(type=PanelProperties) + + +def unregister(): + + for i in classes: + bpy.utils.unregister_class(i) + + + del bpy.types.Scene.specimen_props + del bpy.types.Scene.panel_propert + + + +if __name__ == "__main__": + # bpy.context.scene.panel_propert.panel2_g1 = True + # bpy.context.scene.panel_propert.panel3_g1 = False + register() + inspect_scene() \ No newline at end of file diff --git a/addon dev/mabulig-rigger/__pycache__/__init__.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..daf58b2 Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/__init__.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/__pycache__/bones_fingers_struct.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/bones_fingers_struct.cpython-313.pyc new file mode 100644 index 0000000..060ac9c Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/bones_fingers_struct.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/__pycache__/bones_skel_struct.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/bones_skel_struct.cpython-313.pyc new file mode 100644 index 0000000..26c3315 Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/bones_skel_struct.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/__pycache__/bones_toes_struct.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/bones_toes_struct.cpython-313.pyc new file mode 100644 index 0000000..3614350 Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/bones_toes_struct.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/__pycache__/bones_web_struct.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/bones_web_struct.cpython-313.pyc new file mode 100644 index 0000000..f902dbf Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/bones_web_struct.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/__pycache__/rigger_functionality.cpython-313.pyc b/addon dev/mabulig-rigger/__pycache__/rigger_functionality.cpython-313.pyc new file mode 100644 index 0000000..220939b Binary files /dev/null and b/addon dev/mabulig-rigger/__pycache__/rigger_functionality.cpython-313.pyc differ diff --git a/addon dev/mabulig-rigger/bones_fingers_struct.py b/addon dev/mabulig-rigger/bones_fingers_struct.py new file mode 100644 index 0000000..45d7fb2 --- /dev/null +++ b/addon dev/mabulig-rigger/bones_fingers_struct.py @@ -0,0 +1,162 @@ +fingers_data = [ + { + "bone_name": "metacarpal_01_l", + "head_helper": "wrist_l", + "tail_helper": "index_01_l" + }, + { + "bone_name": "metacarpal_02_l", + "head_helper": "wrist_l", + "tail_helper": "middle_01_l" + }, + { + "bone_name": "metacarpal_03_l", + "head_helper": "wrist_l", + "tail_helper": "ring_01_l" + }, + { + "bone_name": "metacarpal_04_l", + "head_helper": "wrist_l", + "tail_helper": "pinky_01_l" + }, + { + "bone_name": "metacarpal_01_r", + "head_helper": "wrist_r", + "tail_helper": "index_01_r" + }, + { + "bone_name": "metacarpal_02_r", + "head_helper": "wrist_r", + "tail_helper": "middle_01_r" + }, + { + "bone_name": "metacarpal_03_r", + "head_helper": "wrist_r", + "tail_helper": "ring_01_r" + }, + { + "bone_name": "metacarpal_04_r", + "head_helper": "wrist_r", + "tail_helper": "pinky_01_r" + }, + { + "bone_name": "index_01_l", + "head_helper": "index_01_l", + "tail_helper": "index_02_l" + }, + { + "bone_name": "index_02_l", + "head_helper": "index_02_l", + "tail_helper": "index_03_l" + }, + { + "bone_name": "index_03_l", + "head_helper": "index_03_l", + "tail_helper": "index_tip_l" + }, + { + "bone_name": "middle_01_l", + "head_helper": "middle_01_l", + "tail_helper": "middle_02_l" + }, + { + "bone_name": "middle_02_l", + "head_helper": "middle_02_l", + "tail_helper": "middle_03_l" + }, + { + "bone_name": "middle_03_l", + "head_helper": "middle_03_l", + "tail_helper": "middle_tip_l" + }, + { + "bone_name": "ring_01_l", + "head_helper": "ring_01_l", + "tail_helper": "ring_02_l" + }, + { + "bone_name": "ring_02_l", + "head_helper": "ring_02_l", + "tail_helper": "ring_03_l" + }, + { + "bone_name": "ring_03_l", + "head_helper": "ring_03_l", + "tail_helper": "ring_tip_l" + }, + { + "bone_name": "pinky_01_l", + "head_helper": "pinky_01_l", + "tail_helper": "pinky_02_l" + }, + { + "bone_name": "pinky_02_l", + "head_helper": "pinky_02_l", + "tail_helper": "pinky_03_l" + }, + { + "bone_name": "pinky_03_l", + "head_helper": "pinky_03_l", + "tail_helper": "pinky_tip_l" + }, + { + "bone_name": "index_01_r", + "head_helper": "index_01_r", + "tail_helper": "index_02_r" + }, + { + "bone_name": "index_02_r", + "head_helper": "index_02_r", + "tail_helper": "index_03_r" + }, + { + "bone_name": "index_03_r", + "head_helper": "index_03_r", + "tail_helper": "index_tip_r" + }, + { + "bone_name": "middle_01_r", + "head_helper": "middle_01_r", + "tail_helper": "middle_02_r" + }, + { + "bone_name": "middle_02_r", + "head_helper": "middle_02_r", + "tail_helper": "middle_03_r" + }, + { + "bone_name": "middle_03_r", + "head_helper": "middle_03_r", + "tail_helper": "middle_tip_r" + }, + { + "bone_name": "ring_01_r", + "head_helper": "ring_01_r", + "tail_helper": "ring_02_r" + }, + { + "bone_name": "ring_02_r", + "head_helper": "ring_02_r", + "tail_helper": "ring_03_r" + }, + { + "bone_name": "ring_03_r", + "head_helper": "ring_03_r", + "tail_helper": "ring_tip_r" + }, + { + "bone_name": "pinky_01_r", + "head_helper": "pinky_01_r", + "tail_helper": "pinky_02_r" + }, + { + "bone_name": "pinky_02_r", + "head_helper": "pinky_02_r", + "tail_helper": "pinky_03_r" + }, + { + "bone_name": "pinky_03_r", + "head_helper": "pinky_03_r", + "tail_helper": "pinky_tip_r" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/bones_skel_struct.py b/addon dev/mabulig-rigger/bones_skel_struct.py new file mode 100644 index 0000000..4eea90d --- /dev/null +++ b/addon dev/mabulig-rigger/bones_skel_struct.py @@ -0,0 +1,152 @@ +bones_data = [ + { + "bone_name": "urostyle", + "head_helper": "cloaca", + "tail_helper": "sacrum" + }, + { + "bone_name": "spine_01", + "head_helper": "sacrum", + "tail_helper": "spine_01" + }, + { + "bone_name": "spine_02", + "head_helper": "spine_01", + "tail_helper": "spine_02" + }, + { + "bone_name": "spine_03", + "head_helper": "spine_02", + "tail_helper": "scapula_base" + }, + { + "bone_name": "spine_04", + "head_helper": "scapula_base", + "tail_helper": "head" + }, + { + "bone_name": "head", + "head_helper": "head", + "tail_helper": "snout" + }, + { + "bone_name": "scapula_l", + "head_helper": "scapula_base", + "tail_helper": "scapula_l" + }, + { + "bone_name": "scapula_r", + "head_helper": "scapula_base", + "tail_helper": "scapula_r" + }, + { + "bone_name": "sternum_l", + "head_helper": "sternum", + "tail_helper": "shoulder_l" + }, + { + "bone_name": "sternum_r", + "head_helper": "sternum", + "tail_helper": "shoulder_r" + }, + { + "bone_name": "eye_l", + "head_helper": "eye_base_l", + "tail_helper": "eye_l" + }, + { + "bone_name": "eye_r", + "head_helper": "eye_base_r", + "tail_helper": "eye_r" + }, + { + "bone_name": "upperarm_l", + "head_helper": "shoulder_l", + "tail_helper": "elbow_l" + }, + { + "bone_name": "upperarm_r", + "head_helper": "shoulder_r", + "tail_helper": "elbow_r" + }, + { + "bone_name": "lowerarm_l", + "head_helper": "elbow_l", + "tail_helper": "wrist_l" + }, + { + "bone_name": "lowerarm_r", + "head_helper": "elbow_r", + "tail_helper": "wrist_r" + }, + { + "bone_name": "hand_l", + "head_helper": "wrist_l", + "tail_helper": "hand_l" + }, + { + "bone_name": "hand_r", + "head_helper": "wrist_r", + "tail_helper": "hand_r" + }, + { + "bone_name": "upperleg_l", + "head_helper": "thigh_l", + "tail_helper": "knee_01_l" + }, + { + "bone_name": "upperleg_r", + "head_helper": "thigh_r", + "tail_helper": "knee_01_r" + }, + { + "bone_name": "knee_l", + "head_helper": "knee_01_l", + "tail_helper": "knee_02_l" + }, + { + "bone_name": "knee_r", + "head_helper": "knee_01_r", + "tail_helper": "knee_02_r" + }, + { + "bone_name": "lowerleg_l", + "head_helper": "knee_02_l", + "tail_helper": "ankle_01_l" + }, + { + "bone_name": "lowerleg_r", + "head_helper": "knee_02_r", + "tail_helper": "ankle_01_r" + }, + { + "bone_name": "heel_l", + "head_helper": "ankle_01_l", + "tail_helper": "ankle_02_l" + }, + { + "bone_name": "heel_r", + "head_helper": "ankle_01_r", + "tail_helper": "ankle_02_r" + }, + { + "bone_name": "tarsus_l", + "head_helper": "ankle_02_l", + "tail_helper": "heel_l" + }, + { + "bone_name": "tarsus_r", + "head_helper": "ankle_02_r", + "tail_helper": "heel_r" + }, + { + "bone_name": "feet_l", + "head_helper": "heel_l", + "tail_helper": "foot_l" + }, + { + "bone_name": "feet_r", + "head_helper": "heel_r", + "tail_helper": "foot_r" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/bones_toes_struct.py b/addon dev/mabulig-rigger/bones_toes_struct.py new file mode 100644 index 0000000..e790a52 --- /dev/null +++ b/addon dev/mabulig-rigger/bones_toes_struct.py @@ -0,0 +1,212 @@ +toes_data = [ + { + "bone_name": "metatarsus_01_l", + "head_helper": "heel_l", + "tail_helper": "toe_01_l" + }, + { + "bone_name": "metatarsus_02_l", + "head_helper": "heel_l", + "tail_helper": "toe_index_01_l" + }, + { + "bone_name": "metatarsus_03_l", + "head_helper": "heel_l", + "tail_helper": "toe_middle_01_l" + }, + { + "bone_name": "metatarsus_04_l", + "head_helper": "heel_l", + "tail_helper": "toe_ring_01_l" + }, + { + "bone_name": "metatarsus_05_l", + "head_helper": "heel_l", + "tail_helper": "toe_pinky_01_l" + }, + { + "bone_name": "metatarsus_01_r", + "head_helper": "heel_r", + "tail_helper": "toe_01_r" + }, + { + "bone_name": "metatarsus_02_r", + "head_helper": "heel_r", + "tail_helper": "toe_index_01_r" + }, + { + "bone_name": "metatarsus_03_r", + "head_helper": "heel_r", + "tail_helper": "toe_middle_01_r" + }, + { + "bone_name": "metatarsus_04_r", + "head_helper": "heel_r", + "tail_helper": "toe_ring_01_r" + }, + { + "bone_name": "metatarsus_05_r", + "head_helper": "heel_r", + "tail_helper": "toe_pinky_01_r" + }, + { + "bone_name": "toe_01_l", + "head_helper": "toe_01_l", + "tail_helper": "toe_02_l" + }, + { + "bone_name": "toe_02_l", + "head_helper": "toe_02_l", + "tail_helper": "toe_03_l" + }, + { + "bone_name": "toe_03_l", + "head_helper": "toe_03_l", + "tail_helper": "toe_tip_l" + }, + { + "bone_name": "toe_index_01_l", + "head_helper": "toe_index_01_l", + "tail_helper": "toe_index_02_l" + }, + { + "bone_name": "toe_index_02_l", + "head_helper": "toe_index_02_l", + "tail_helper": "toe_index_03_l" + }, + { + "bone_name": "toe_index_03_l", + "head_helper": "toe_index_03_l", + "tail_helper": "toe_index_tip_l" + }, + { + "bone_name": "toe_middle_01_l", + "head_helper": "toe_middle_01_l", + "tail_helper": "toe_middle_02_l" + }, + { + "bone_name": "toe_middle_02_l", + "head_helper": "toe_middle_02_l", + "tail_helper": "toe_middle_03_l" + }, + { + "bone_name": "toe_middle_03_l", + "head_helper": "toe_middle_03_l", + "tail_helper": "toe_middle_tip_l" + }, + { + "bone_name": "toe_ring_01_l", + "head_helper": "toe_ring_01_l", + "tail_helper": "toe_ring_02_l" + }, + { + "bone_name": "toe_ring_02_l", + "head_helper": "toe_ring_02_l", + "tail_helper": "toe_ring_03_l" + }, + { + "bone_name": "toe_ring_03_l", + "head_helper": "toe_ring_03_l", + "tail_helper": "toe_ring_04_l" + }, + { + "bone_name": "toe_ring_04_l", + "head_helper": "toe_ring_04_l", + "tail_helper": "toe_ring_tip_l" + }, + { + "bone_name": "toe_pinky_01_l", + "head_helper": "toe_pinky_01_l", + "tail_helper": "toe_pinky_02_l" + }, + { + "bone_name": "toe_pinky_02_l", + "head_helper": "toe_pinky_02_l", + "tail_helper": "toe_pinky_03_l" + }, + { + "bone_name": "toe_pinky_03_l", + "head_helper": "toe_pinky_03_l", + "tail_helper": "toe_pinky_tip_l" + }, + { + "bone_name": "toe_01_r", + "head_helper": "toe_01_r", + "tail_helper": "toe_02_r" + }, + { + "bone_name": "toe_02_r", + "head_helper": "toe_02_r", + "tail_helper": "toe_03_r" + }, + { + "bone_name": "toe_03_r", + "head_helper": "toe_03_r", + "tail_helper": "toe_tip_r" + }, + { + "bone_name": "toe_index_01_r", + "head_helper": "toe_index_01_r", + "tail_helper": "toe_index_02_r" + }, + { + "bone_name": "toe_index_02_r", + "head_helper": "toe_index_02_r", + "tail_helper": "toe_index_03_r" + }, + { + "bone_name": "toe_index_03_r", + "head_helper": "toe_index_03_r", + "tail_helper": "toe_index_tip_r" + }, + { + "bone_name": "toe_middle_01_r", + "head_helper": "toe_middle_01_r", + "tail_helper": "toe_middle_02_r" + }, + { + "bone_name": "toe_middle_02_r", + "head_helper": "toe_middle_02_r", + "tail_helper": "toe_middle_03_r" + }, + { + "bone_name": "toe_middle_03_r", + "head_helper": "toe_middle_03_r", + "tail_helper": "toe_middle_tip_r" + }, + { + "bone_name": "toe_ring_01_r", + "head_helper": "toe_ring_01_r", + "tail_helper": "toe_ring_02_r" + }, + { + "bone_name": "toe_ring_02_r", + "head_helper": "toe_ring_02_r", + "tail_helper": "toe_ring_03_r" + }, + { + "bone_name": "toe_ring_03_r", + "head_helper": "toe_ring_03_r", + "tail_helper": "toe_ring_04_r" + }, + { + "bone_name": "toe_ring_04_r", + "head_helper": "toe_ring_04_r", + "tail_helper": "toe_ring_tip_r" + }, + { + "bone_name": "toe_pinky_01_r", + "head_helper": "toe_pinky_01_r", + "tail_helper": "toe_pinky_02_r" + }, + { + "bone_name": "toe_pinky_02_r", + "head_helper": "toe_pinky_02_r", + "tail_helper": "toe_pinky_03_r" + }, + { + "bone_name": "toe_pinky_03_r", + "head_helper": "toe_pinky_03_r", + "tail_helper": "toe_pinky_tip_r" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/bones_web_struct.py b/addon dev/mabulig-rigger/bones_web_struct.py new file mode 100644 index 0000000..8ed32e7 --- /dev/null +++ b/addon dev/mabulig-rigger/bones_web_struct.py @@ -0,0 +1,142 @@ +webbing_data = [ + { + "bone_name": "web_01_l", + "head_helper": "toe_index_tip_l", + "tail_helper": "toe_middle_tip_l" + }, + { + "bone_name": "web_02_l", + "head_helper": "toe_index_03_l", + "tail_helper": "toe_middle_02_l" + }, + { + "bone_name": "web_03_l", + "head_helper": "toe_index_01_l", + "tail_helper": "toe_middle_01_l" + }, + { + "bone_name": "web_04_l", + "head_helper": "toe_middle_tip_l", + "tail_helper": "toe_ring_tip_l" + }, + { + "bone_name": "web_05_l", + "head_helper": "toe_middle_03_l", + "tail_helper": "toe_ring_03_l" + }, + { + "bone_name": "web_06_l", + "head_helper": "toe_middle_02_l", + "tail_helper": "toe_ring_02_l" + }, + { + "bone_name": "web_07_l", + "head_helper": "toe_middle_01_l", + "tail_helper": "toe_ring_01_l" + }, + { + "bone_name": "web_08_l", + "head_helper": "toe_ring_tip_l", + "tail_helper": "toe_pinky_tip_l" + }, + { + "bone_name": "web_09_l", + "head_helper": "toe_ring_03_l", + "tail_helper": "toe_pinky_03_l" + }, + { + "bone_name": "web_10_l", + "head_helper": "toe_ring_02_l", + "tail_helper": "toe_pinky_02_l" + }, + { + "bone_name": "web_11_l", + "head_helper": "toe_ring_01_l", + "tail_helper": "toe_pinky_01_l" + }, + { + "bone_name": "web_12_l", + "head_helper": "toe_tip_l", + "tail_helper": "toe_index_tip_l" + }, + { + "bone_name": "web_13_l", + "head_helper": "toe_03_l", + "tail_helper": "toe_index_02_l" + }, + { + "bone_name": "web_14_l", + "head_helper": "toe_02_l", + "tail_helper": "toe_index_01_l" + }, + { + "bone_name": "web_01_r", + "head_helper": "toe_index_tip_r", + "tail_helper": "toe_middle_tip_r" + }, + { + "bone_name": "web_02_r", + "head_helper": "toe_index_03_r", + "tail_helper": "toe_middle_02_r" + }, + { + "bone_name": "web_03_r", + "head_helper": "toe_index_01_r", + "tail_helper": "toe_middle_01_r" + }, + { + "bone_name": "web_04_r", + "head_helper": "toe_middle_tip_r", + "tail_helper": "toe_ring_tip_r" + }, + { + "bone_name": "web_05_r", + "head_helper": "toe_middle_03_r", + "tail_helper": "toe_ring_03_r" + }, + { + "bone_name": "web_06_r", + "head_helper": "toe_middle_02_r", + "tail_helper": "toe_ring_02_r" + }, + { + "bone_name": "web_07_r", + "head_helper": "toe_middle_01_r", + "tail_helper": "toe_ring_01_r" + }, + { + "bone_name": "web_08_r", + "head_helper": "toe_ring_tip_r", + "tail_helper": "toe_pinky_tip_r" + }, + { + "bone_name": "web_09_r", + "head_helper": "toe_ring_03_r", + "tail_helper": "toe_pinky_03_r" + }, + { + "bone_name": "web_10_r", + "head_helper": "toe_ring_02_r", + "tail_helper": "toe_pinky_02_r" + }, + { + "bone_name": "web_11_r", + "head_helper": "toe_ring_01_r", + "tail_helper": "toe_pinky_01_r" + }, + { + "bone_name": "web_12_r", + "head_helper": "toe_tip_r", + "tail_helper": "toe_index_tip_r" + }, + { + "bone_name": "web_13_r", + "head_helper": "toe_03_r", + "tail_helper": "toe_index_02_r" + }, + { + "bone_name": "web_14_r", + "head_helper": "toe_02_r", + "tail_helper": "toe_index_01_r" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/ctrl_bones_color_struct.py b/addon dev/mabulig-rigger/ctrl_bones_color_struct.py new file mode 100644 index 0000000..8c4ea89 --- /dev/null +++ b/addon dev/mabulig-rigger/ctrl_bones_color_struct.py @@ -0,0 +1,162 @@ +bone_color_data = [ + { + "bone_name": "lowerarm_l", + "color": "THEME02" + }, + { + "bone_name": "upperarm_l", + "color": "THEME02" + }, + { + "bone_name": "lowerarm_r", + "color": "THEME02" + }, + { + "bone_name": "upperarm_r", + "color": "THEME02" + }, + { + "bone_name": "upperleg_l", + "color": "THEME02" + }, + { + "bone_name": "knee_l", + "color": "THEME02" + }, + { + "bone_name": "lowerleg_l", + "color": "THEME02" + }, + { + "bone_name": "heel_l", + "color": "THEME02" + }, + { + "bone_name": "tarsus_l", + "color": "THEME02" + }, + { + "bone_name": "upperleg_r", + "color": "THEME02" + }, + { + "bone_name": "knee_r", + "color": "THEME02" + }, + { + "bone_name": "lowerleg_r", + "color": "THEME02" + }, + { + "bone_name": "heel_r", + "color": "THEME02" + }, + { + "bone_name": "tarsus_r", + "color": "THEME02" + }, + { + "bone_name": "urostyle", + "color": "THEME07" + }, + { + "bone_name": "spine_01", + "color": "THEME07" + }, + { + "bone_name": "spine_02", + "color": "THEME07" + }, + { + "bone_name": "spine_03", + "color": "THEME07" + }, + { + "bone_name": "spine_04", + "color": "THEME07" + }, + { + "bone_name": "head", + "color": "THEME03" + }, + { + "bone_name": "eye_l", + "color": "THEME08" + }, + { + "bone_name": "eye_r", + "color": "THEME08" + }, + { + "bone_name": "metatarsus_01_l", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_02_l", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_03_l", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_04_l", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_05_l", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_01_r", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_02_r", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_03_r", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_04_r", + "color": "THEME05" + }, + { + "bone_name": "metatarsus_05_r", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_01_l", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_02_l", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_03_l", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_04_l", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_01_r", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_02_r", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_03_r", + "color": "THEME05" + }, + { + "bone_name": "metacarpal_04_r", + "color": "THEME05" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/ctrl_bones_shape_struct.py b/addon dev/mabulig-rigger/ctrl_bones_shape_struct.py new file mode 100644 index 0000000..13cdd44 --- /dev/null +++ b/addon dev/mabulig-rigger/ctrl_bones_shape_struct.py @@ -0,0 +1,662 @@ +bone_shape_data = [ + { + "bone_name": "hand_l", + "rot_X": "20", + "rot_Y": "0", + "rot_Z": "4", + "scale": "0.750", + "shape": "rig_shape_circle", + "color": "THEME09", + "width": "3" + }, + { + "bone_name": "hand_r", + "rot_X": "20", + "rot_Y": "0", + "rot_Z": "-4", + "scale": "0.750", + "shape": "rig_shape_circle", + "color": "THEME09", + "width": "3" + }, + { + "bone_name": "feet_l", + "rot_X": "12", + "rot_Y": "0", + "rot_Z": "-5", + "scale": "1.0", + "shape": "rig_shape_circle", + "color": "THEME09", + "width": "3" + }, + { + "bone_name": "feet_r", + "rot_X": "12", + "rot_Y": "0", + "rot_Z": "5", + "scale": "1.0", + "shape": "rig_shape_circle", + "color": "THEME09", + "width": "3" + }, + { + "bone_name": "toe_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_04_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_index_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_middle_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_ring_04_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "toe_pinky_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ctrl_ik_arm_target_l", + "rot_X": "0", + "rot_Y": "0", + "rot_Z": "0", + "scale": "0.100", + "shape": "rig_shape_cross", + "color": "THEME04", + "width": "3" + }, + { + "bone_name": "ctrl_ik_arm_target_r", + "rot_X": "0", + "rot_Y": "0", + "rot_Z": "0", + "scale": "0.100", + "shape": "rig_shape_cross", + "color": "THEME04", + "width": "3" + }, + { + "bone_name": "root", + "rot_X": "90", + "rot_Y": "0", + "rot_Z": "0", + "scale": "5", + "shape": "rig_shape_circle", + "color": "THEME12", + "width": "5" + }, + { + "bone_name": "ctrl_belly", + "rot_X": "0", + "rot_Y": "0", + "rot_Z": "0", + "scale": "0.500", + "shape": "rig_shape_sphere", + "color": "THEME06", + "width": "3" + }, + { + "bone_name": "ctrl_gular", + "rot_X": "0", + "rot_Y": "0", + "rot_Z": "0", + "scale": "0.500", + "shape": "rig_shape_sphere", + "color": "THEME06", + "width": "3" + }, + { + "bone_name": "ctrl_nostrils", + "rot_X": "0", + "rot_Y": "0", + "rot_Z": "0", + "scale": "0.500", + "shape": "rig_shape_sphere", + "color": "THEME06", + "width": "3" + }, + { + "bone_name": "index_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "index_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "index_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_01_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_02_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_03_l", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "index_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "index_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "index_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "middle_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "ring_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_01_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_02_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + }, + { + "bone_name": "pinky_03_r", + "rot_X": "0", + "rot_Y": "90", + "rot_Z": "90", + "scale": "0.300", + "shape": "rig_shape_circle", + "color": "THEME14", + "width": "3" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/deform_bones_struct.py b/addon dev/mabulig-rigger/deform_bones_struct.py new file mode 100644 index 0000000..633c850 --- /dev/null +++ b/addon dev/mabulig-rigger/deform_bones_struct.py @@ -0,0 +1,507 @@ +deform_bones_data = [ + { + "bone_name": "belly_01_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_02_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_03_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_04_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_05_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_06_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_07_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_08_l", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_09_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_10_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_11_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_12_l", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_13_l", + "parent": "ctrl_belly", + "influence": "0.750" + }, + { + "bone_name": "belly_14_l", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_15_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_16_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_17_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_18_l", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_19_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_20_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_21_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_22_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_23_l", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_24_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_25_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_26_l", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_27_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_28_l", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_29_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_30_l", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_31_l", + "parent": "ctrl_belly", + "influence": "0.016" + }, + { + "bone_name": "belly_32_l", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_33_l", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_34_l", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_35_l", + "parent": "ctrl_belly", + "influence": "0.016" + }, + { + "bone_name": "belly_01_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_02_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_03_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_04_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_05_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_06_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_07_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_08_r", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_09_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_10_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_11_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_12_r", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_13_r", + "parent": "ctrl_belly", + "influence": "0.750" + }, + { + "bone_name": "belly_14_r", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_15_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_16_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_17_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_18_r", + "parent": "ctrl_belly", + "influence": "0.500" + }, + { + "bone_name": "belly_19_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_20_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_21_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_22_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_23_r", + "parent": "ctrl_belly", + "influence": "0.250" + }, + { + "bone_name": "belly_24_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_25_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_26_r", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_27_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_28_r", + "parent": "ctrl_belly", + "influence": "0.125" + }, + { + "bone_name": "belly_29_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_30_r", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_31_r", + "parent": "ctrl_belly", + "influence": "0.016" + }, + { + "bone_name": "belly_32_r", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_33_r", + "parent": "ctrl_belly", + "influence": "0.063" + }, + { + "bone_name": "belly_34_r", + "parent": "ctrl_belly", + "influence": "0.031" + }, + { + "bone_name": "belly_35_r", + "parent": "ctrl_belly", + "influence": "0.016" + }, + { + "bone_name": "gular_01", + "parent": "ctrl_gular", + "influence": "0.0625" + }, + { + "bone_name": "gular_02", + "parent": "ctrl_gular", + "influence": "0.125" + }, + { + "bone_name": "gular_03", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_04", + "parent": "ctrl_gular", + "influence": "0.1255" + }, + { + "bone_name": "gular_05", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_06", + "parent": "ctrl_gular", + "influence": "0.5" + }, + { + "bone_name": "gular_07", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_08", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_09", + "parent": "ctrl_gular", + "influence": "0.5" + }, + { + "bone_name": "gular_10", + "parent": "ctrl_gular", + "influence": "0.75" + }, + { + "bone_name": "gular_11", + "parent": "ctrl_gular", + "influence": "0.5" + }, + { + "bone_name": "gular_12", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_13", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "gular_14", + "parent": "ctrl_gular", + "influence": "0.5" + }, + { + "bone_name": "gular_15", + "parent": "ctrl_gular", + "influence": "0.25" + }, + { + "bone_name": "nostril_01_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_02_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_03_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_04_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_05_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_06_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_07_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_08_l", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_01_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_02_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_03_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_04_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_05_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_06_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_07_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + }, + { + "bone_name": "nostril_08_r", + "parent": "ctrl_nostrils", + "influence": "1.0" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/ik_bones_struct.py b/addon dev/mabulig-rigger/ik_bones_struct.py new file mode 100644 index 0000000..278cf23 --- /dev/null +++ b/addon dev/mabulig-rigger/ik_bones_struct.py @@ -0,0 +1,26 @@ +IK_bones_data = [ + { + "bone_name": "lowerarm_l", + "target": "hand_l", + "pole_target": "ctrl_ik_arm_target_l", + "chain": "2" + }, + { + "bone_name": "lowerarm_r", + "target": "hand_r", + "pole_target": "ctrl_ik_arm_target_r", + "chain": "2" + }, + { + "bone_name": "tarsus_l", + "target": "feet_l", + "pole_target": "none", + "chain": "5" + }, + { + "bone_name": "tarsus_r", + "target": "feet_r", + "pole_target": "none", + "chain": "5" + } +] \ No newline at end of file diff --git a/addon dev/mabulig-rigger/rig_setup.blend b/addon dev/mabulig-rigger/rig_setup.blend new file mode 100644 index 0000000..683224c Binary files /dev/null and b/addon dev/mabulig-rigger/rig_setup.blend differ diff --git a/addon dev/mabulig-rigger/rig_setup.blend1 b/addon dev/mabulig-rigger/rig_setup.blend1 new file mode 100644 index 0000000..3ed58f4 Binary files /dev/null and b/addon dev/mabulig-rigger/rig_setup.blend1 differ diff --git a/addon dev/mabulig-rigger/rigger_functionality.py b/addon dev/mabulig-rigger/rigger_functionality.py new file mode 100644 index 0000000..e2c98f5 --- /dev/null +++ b/addon dev/mabulig-rigger/rigger_functionality.py @@ -0,0 +1,174 @@ +import bpy +import math + +from . import bones_skel_struct +from . import bones_fingers_struct +from . import bones_toes_struct +from . import bones_web_struct + +# mabulig_coll_name = None +# new_amt_obj = None +# matrix_world_inv = None + + +# Modify Bone Function +def modifybone(bone, head_empt, tail_empt, armature, matrixworldinv): + edit_bone = armature.data.edit_bones.get(bone) + print(edit_bone) + empty_head = bpy.data.objects.get(head_empt) + empty_tail = bpy.data.objects.get(tail_empt) + allowhead = False + allowtail = False + alloweditbone = False + + # Fetch world coordinates of the empties + if empty_head: + allowhead = True + # else: + # print(f"Helper '{head_empt}' not found.") + + if empty_tail: + allowtail = True + # else: + # print(f"Helper '{tail_empt}' not found.") + + if edit_bone: + alloweditbone = True + # else: + # print(f"Bone '{bone}' not found.") + + if allowhead and allowtail and alloweditbone: + head_world_pos = empty_head.matrix_world.translation + print(f"Head: {head_empt} - success") + tail_world_pos = empty_tail.matrix_world.translation + print(f"Tail: {tail_empt} - success") + # Multiply the inverse matrix by the world positions using the '@' operator + edit_bone.head = matrixworldinv @ head_world_pos + edit_bone.tail = matrixworldinv @ tail_world_pos + # else: + # print("Error") + + + +def startAutoRig(): + mabulig_coll_name = "Mabulig-Rig" + og_amt_obj = bpy.data.objects.get("OG_Armature") + + # =========== Duplicate OG armature for future editing =========== + target_coll = bpy.data.collections.get(mabulig_coll_name) + armaturecheck = bpy.data.objects.get("Armature") + + if armaturecheck: + print("Armature already exist") + new_amt_obj = armaturecheck + + else: + # Duplicate the armature object + new_amt_obj = og_amt_obj.copy() + + # Duplicate the underlying armature data (bones, constraints, etc.) + new_amt_obj.data = og_amt_obj.data.copy() + + new_amt_obj.name = "Armature" + new_amt_obj.data.name = "Armature" + + target_coll.objects.link(new_amt_obj) + + new_amt_obj.hide_viewport = False + + + + # Calculate the armature's inverse world matrix + matrix_world_inv = new_amt_obj.matrix_world.inverted() + + print(new_amt_obj.name) + + # =========== Skeleton Bones Setup =========== + + bone_data_list = bones_skel_struct.bones_data + + for item in bone_data_list: + b_name = item["bone_name"] + h_helper = item["head_helper"] + t_helper = item["tail_helper"] + + modifybone(b_name, h_helper, t_helper, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Belly Bones Setup =========== + + # belly_l_collection = bpy.data.collections.get("belly_l") + # belly_r_collection = bpy.data.collections.get("belly_r") + + # # For Left Belly + # for obj in belly_l_collection.objects: + # modifybone(obj.name, "belly_base_l", obj.name, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + # # For Right Belly + # for obj in belly_r_collection.objects: + # modifybone(obj.name, "belly_base_r", obj.name, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Gullar Bones Setup =========== + + # gular_collection = bpy.data.collections.get("gular") + + # for obj in gular_collection.objects: + # modifybone(obj.name, "gular_base", obj.name, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Nostril Bones Setup =========== + + # nostril_l_collection = bpy.data.collections.get("nostril_l") + # nostril_r_collection = bpy.data.collections.get("nostril_r") + + # # For Left Nostril + # for obj in nostril_l_collection.objects: + # modifybone(obj.name, "nostril_base_l", obj.name, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + # # For Right Nostril + # for obj in nostril_r_collection.objects: + # modifybone(obj.name, "nostril_base_r", obj.name, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Metacarpal and Finger Bones Setup =========== + + # bones_fingers_data_list = bones_fingers_struct.fingers_data + + # for item in bones_fingers_data_list: + # b_name = item["bone_name"] + # h_helper = item["head_helper"] + # t_helper = item["tail_helper"] + + # modifybone(b_name, h_helper, t_helper, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Metatarsus and Toe Bones Setup =========== + + # bones_toes_data_list = bones_toes_struct.toes_data + + # for item in bones_toes_data_list: + # b_name = item["bone_name"] + # h_helper = item["head_helper"] + # t_helper = item["tail_helper"] + + # modifybone(b_name, h_helper, t_helper, new_amt_obj, matrix_world_inv) # Call Modify Bone Function + + + + # # =========== Webbing Bones =========== + + # bones_web_data_list = bones_web_struct.webbing_data + + # for item in bones_web_data_list: + # b_name = item["bone_name"] + # h_helper = item["head_helper"] + # t_helper = item["tail_helper"] + + # modifybone(b_name, h_helper, t_helper, new_amt_obj, matrix_world_inv) # Call Modify Bone Function diff --git a/mabulig-rigger.py b/mabulig-rigger.py new file mode 100644 index 0000000..00c6d80 --- /dev/null +++ b/mabulig-rigger.py @@ -0,0 +1,290 @@ +bl_info = { + "name": "Mabulig Rigger Plugin", + "author": "Fritz Villahermosa", + "version": (1, 0), + "blender": (5, 2, 0), + "location": "View3D > Sidebar > Mabulig Rigger", + "description": "Frog rigging made simple!", + "category": "3D View", +} + + +import bpy +import os +from bpy.props import FloatProperty, PointerProperty, BoolProperty + +# ========================================================================= +# GLOBAL VARIABLES +# ========================================================================= + + + +# ========================================================================= +# PROPERTIES +# ========================================================================= + +# SVL Properties +class SpecimenProperties(bpy.types.PropertyGroup): + svl: FloatProperty( + name="Specimen SVL", + description="Snout-Vent Length of the specimen in meters", + default=0.1, # 10 cm default + min=0.001, + soft_max=10.0, + unit='LENGTH' + ) # pyright: ignore[reportInvalidTypeForm] + + # Model Picker + target_model: PointerProperty( + type=bpy.types.Object, + name="Target Model", + description="Points to the specimen's 3d model" + ) # type: ignore + +class PanelProperties(bpy.types.PropertyGroup): + panel2_g1: BoolProperty( + name="Panel 2, Group 1", + description="Toggle panel/group visibility", + default=False + ) # pyright: ignore[reportInvalidTypeForm] + panel2_g2: BoolProperty( + name="Panel 2, Group 2", + description="Toggle panel/group visibility", + default=False + ) # pyright: ignore[reportInvalidTypeForm] + panel3_g1: BoolProperty( + name="Panel 2, Group 1", + description="Toggle panel/group visibility", + default=False + ) # pyright: ignore[reportInvalidTypeForm] + + + + +# ========================================================================= +# OPERATORS +# ========================================================================= + +# SETUP SCENE BUTTON +class SceneSetup(bpy.types.Operator): + bl_idname = "scene_setup.operator" + bl_label = "Setup Scene_test" + bl_description = "Imports all the necessary rigging setup components" + + def execute(self, context): + + # Enable Panel 2, Group 1 + bpy.context.scene.panel_propert.panel2_g1 = True + + return {'FINISHED'} + +# SETUP SKELETAL BONES +class SkelSetup(bpy.types.Operator): + bl_idname = "skel_setup.operator" + bl_label = "Skeletal Bones" + bl_description = "Enables the empties for easier skeletal bone placement" + + def execute(self, context): + print("Hello World") + return {'FINISHED'} + +# SETUP GULAR BONES +class GularSetup(bpy.types.Operator): + bl_idname = "gular_setup.operator" + bl_label = "Gular Bones" + bl_description = "Enables the gular mesh and empties" + + def execute(self, context): + print("Hello World") + return {'FINISHED'} + +# SETUP BELLY BONES +class BellySetup(bpy.types.Operator): + bl_idname = "belly_setup.operator" + bl_label = "Belly Bones" + bl_description = "Enables the belly mesh and empties" + + def execute(self, context): + print("Hello World") + return {'FINISHED'} + +# SETUP NOSTRIL BONES +class NostrilsSetup(bpy.types.Operator): + bl_idname = "nostrils_setup.operator" + bl_label = "Nostril Bones" + bl_description = "Enables the nostrils mesh" + + def execute(self, context): + print("Hello World") + return {'FINISHED'} + +# SPAWN RULER PLANE +class RulerPlane(bpy.types.Operator): + bl_idname = "ruler_plane.operator" + bl_label = "Spawn Ruler Plane" + bl_description = "Spawns a plane with the SVL length" + + def execute(self, context): + props = context.scene.specimen_props + svl_val = props.svl + + # Directly reset the scene cursor location and rotation + context.scene.cursor.location = (0.0, 0.0, 0.0) + context.scene.cursor.rotation_euler = (0.0, 0.0, 0.0) + + # Spawn plane mesh, set size to SVL, diplaymode to wireframe, then show in front + bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', scale=(1, 1, 1)) + rulerplane_obj = context.active_object + rulerplane_obj.scale = (svl_val, svl_val, 1.0) + bpy.ops.object.transform_apply(location=False, rotation=False, scale=True) + rulerplane_obj.name = f"Specimen_Plane_{svl_val:.2f}m" + rulerplane_obj.display_type = 'WIRE' + rulerplane_obj.show_in_front = True + + # Enable Panel 2, Group 2 + bpy.context.scene.panel_propert.panel2_g2 = True + + return {'FINISHED'} + +# APPLY SCALE +class ApplyScale(bpy.types.Operator): + bl_idname = "apply_scale.operator" + bl_label = "Apply Scale and Adjust" + bl_description = "Applies the scale and adjusts the mesh for the 3d viewer scale" + + def execute(self, context): + props = context.scene.specimen_props + + bpy.ops.object.select_all(action='DESELECT') + + target_obj = props.target_model + + if target_obj: + target_obj.select_set(True) + target_obj.scale = (10, 10, 10) + bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) + + # Enable Panel 2, Group 2 + bpy.context.scene.panel_propert.panel3_g1 = True + + else: + print("No model selected") + + return {'FINISHED'} + + +# ========================================================================= +# PANELS +# ========================================================================= + +class MabuligRiggerSceneSetupPanel(bpy.types.Panel): + + bl_label = "1. Scene Setup" + bl_idname = "scene_setup.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw(self, context): + layout = self.layout + + #Add Scene Setup button + layout.operator("scene_setup.operator", icon='OUTLINER_COLLECTION') + +class ModelPrepPanel(bpy.types.Panel): + + bl_label = "2. Model Preparation" + bl_idname = "model_prep.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw(self, context): + layout = self.layout + props = context.scene.specimen_props +# paneler = context.scene.panel_propert +# paneler.panel2_g1 = True + + mod_prep_col1 = layout.column() + mod_prep_col1.prop(props, "svl") + mod_prep_col1.operator("ruler_plane.operator", icon='MESH_PLANE') + mod_prep_col1.enabled = bpy.context.scene.panel_propert.panel2_g1 + + layout.separator() + + mod_prep_col2 = layout.column() + mod_prep_col2.prop(props, "target_model") + mod_prep_col2.operator("apply_scale.operator", icon='FIXED_SIZE') + mod_prep_col2.enabled = bpy.context.scene.panel_propert.panel2_g2 + + +class RiggingProcessPanel(bpy.types.Panel): + + bl_label = "3. Rigging Process" + bl_idname = "rigging_process.panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = "Mabulig Rigger" + + def draw(self, context): + layout = self.layout + + rig_proc_row = layout.row() + rig_proc_row.alignment = 'CENTER' + rig_proc_row.label(text="Setup Helpers") + + rig_proc_grid = layout.grid_flow(columns=2, align=True) + #Add Buttons + rig_proc_grid.operator("skel_setup.operator") + rig_proc_grid.operator("gular_setup.operator") + rig_proc_grid.operator("belly_setup.operator") + rig_proc_grid.operator("nostrils_setup.operator") + rig_proc_grid.enabled = bpy.context.scene.panel_propert.panel3_g1 + +classes = (SceneSetup, SkelSetup, GularSetup, BellySetup, NostrilsSetup, RulerPlane, ApplyScale, MabuligRiggerSceneSetupPanel, ModelPrepPanel, RiggingProcessPanel, SpecimenProperties, PanelProperties) + +def register(): + for i in classes: + bpy.utils.register_class(i) + + + bpy.types.Scene.specimen_props = bpy.props.PointerProperty(type=SpecimenProperties) + bpy.types.Scene.panel_propert = bpy.props.PointerProperty(type=PanelProperties) + +# for scene in bpy.data.scenes: +# if "panel_propert" in scene: +# del scene["panel_propert"] +# print("test") +# +# if "specimen_props" in scene: +# del scene["specimen_props"] +# print("test") + + +def unregister(): +# for scene in bpy.data.scenes: +# if "panel_propert" in scene: +# del scene["panel_propert"] +# print("test") +# +# if "specimen_props" in scene: +# del scene["specimen_props"] +# print("test") + + for i in classes: + bpy.utils.unregister_class(i) + + + del bpy.types.Scene.specimen_props + del bpy.types.Scene.panel_propert + + + + +if __name__ == "__main__": +# bpy.context.scene.panel_propert.panel2_g1 = False +# bpy.context.scene.panel_propert.panel2_g2 = False +# bpy.context.scene.panel_propert.panel3_g1 = False + register() + +#del bpy.context.scene["panel_propert"] \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..e674670 --- /dev/null +++ b/test.py @@ -0,0 +1,3 @@ +import bpy + +bpy.ops.mesh.primitive_monkey_add() \ No newline at end of file