Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Weld (function and config) #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,31 @@ def execute(self, context):
bpy.ops.mesh.face_split_by_edges()
bpy.ops.mesh.select_all(action='DESELECT')
return {'FINISHED'}


class TargetWeldToggle(bpy.types.Operator):
bl_idname = "qm.target_weld_toggle"
bl_label = "Target Weld Toggle"
bl_options = {'REGISTER', 'UNDO'}

def toggle_target_weld(self, context):
if bpy.context.mode != 'EDIT_MESH':
bpy.ops.object.mode_set(mode='EDIT')

if context.scene.tool_settings.use_mesh_automerge and bpy.context.scene.tool_settings.use_snap:
context.scene.tool_settings.use_mesh_automerge = False
bpy.context.scene.tool_settings.use_snap = False
else:
context.scene.tool_settings.snap_elements |= {'VERTEX'}
context.scene.tool_settings.use_mesh_automerge = True
bpy.context.scene.tool_settings.use_snap = True

bpy.ops.mesh.select_mode(type='VERT') # Switch to vertex select mode
bpy.ops.wm.tool_set_by_id(name="builtin.select") # Set the active tool to Select

def execute(self, context):
self.toggle_target_weld(context)
return{'FINISHED'}

class ToggleAutoKeyingOperator(bpy.types.Operator):
"""Toggle Auto Keying"""
bl_idname, bl_label, bl_options = 'qm.toggle_auto_keying', 'Toggle Auto Keying', {'REGISTER', 'UNDO'}
Expand Down Expand Up @@ -2050,4 +2074,4 @@ def unregister():
km.keymap_items.remove(kmi)
app['keymaps'].clear()

if __name__ == '__main__': register()
if __name__ == '__main__': register()
6 changes: 5 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@
"path": "(E) Boolean - Knife/(A) Weld Edges Into Faces",
"operator": "qm.weld_edges_into_faces"
},
{
"path": "(E) Boolean - Knife/(F)Target Weld Toggle",
"operator": "qm.target_weld_toggle"
},
{
"path": "(R) Animation/Parent To New Empty",
"operator": "qm.parent_to_new_empty"
Expand Down Expand Up @@ -769,4 +773,4 @@
"operator": "qm.view"
}
]
}
}