Skip to content

Commit

Permalink
Merge pull request #359 from SleepyEngi/master
Browse files Browse the repository at this point in the history
Added rig edit generator
  • Loading branch information
HENDRIX-ZT2 authored Nov 12, 2023
2 parents 134afdc + 8c61bf7 commit ddb1c9e
Show file tree
Hide file tree
Showing 2 changed files with 410 additions and 0 deletions.
48 changes: 48 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ def execute(self, context):
return {'FINISHED'}


class GenerateRigEdit(bpy.types.Operator):
"""Generate rig edit nodes for all posed bones"""
bl_idname = "pose.generate_rig_edit"
bl_label = "Generate Rig Edit from Pose"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
return handle_errors(self, shell.generate_rig_edit, {})


class ConvertScaleToLoc(bpy.types.Operator):
"""Convert pose mode scale transforms into location transforms"""
bl_idname = "pose.convert_scale_to_loc"
bl_label = "Convert scale to location"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
return handle_errors(self, shell.convert_scale_to_loc, {})


class MESH_PT_CobraTools(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "Cobra Mesh Tools"
Expand Down Expand Up @@ -160,6 +180,31 @@ def draw(self, context):
addon_updater_ops.update_notice_box_ui(self, context)


class POSE_PT_CobraTools(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "Cobra Rig Tools"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"

@classmethod
def poll(cls, context):
if not context.armature:
return False
return True

def draw(self, context):
addon_updater_ops.check_for_update_background()
layout = self.layout
icon = preview_collection["frontier.png"].icon_id
row = layout.row(align=True)
sub = row.row()
sub.operator("pose.generate_rig_edit", icon_value=icon)
row = layout.row(align=True)
sub = row.row()
sub.operator("pose.convert_scale_to_loc", icon_value=icon)


class SCENE_PT_CobraTools(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "Cobra Scene Tools"
Expand Down Expand Up @@ -273,6 +318,8 @@ def CT_FileBrowser_Context_Menu(self, context):
ImportVoxelskirt,
CreateFins,
CreateLods,
GenerateRigEdit,
ConvertScaleToLoc,
VcolToHair,
HairToVcol,
TransferHairCombing,
Expand All @@ -282,6 +329,7 @@ def CT_FileBrowser_Context_Menu(self, context):
CobraMeshSettings,
CobraCollisionSettings,
MESH_PT_CobraTools,
POSE_PT_CobraTools,
SCENE_PT_CobraTools,
COLLISION_PT_CobraTools,
InstallDependencies,
Expand Down
Loading

0 comments on commit ddb1c9e

Please sign in to comment.