Add Easy_Weight
to Addons
#47
@ -1,11 +1,11 @@
|
||||
import bpy
|
||||
from bpy.types import Object, Operator, VIEW3D_MT_paint_weight, VIEW3D_MT_object
|
||||
|
||||
# This operator is added to the Object menu.
|
||||
|
||||
# It does the following:
|
||||
# Set active object to weight paint mode
|
||||
# Make sure active object is not in wireframe or bounding box display type
|
||||
# Set shading mode to a Flat, Single Color, White shading
|
||||
# Find first armature via the object's modifiers.
|
||||
# Ensure it is visible, select it and set it to pose mode.
|
||||
|
||||
@ -13,7 +13,7 @@ import bpy
|
||||
|
||||
# When running the operator again, it should restore everything to how it was before.
|
||||
|
||||
def get_armature_of_meshob(obj: bpy.types.Object):
|
||||
def get_armature_of_meshob(obj: Object):
|
||||
"""Find and return the armature that deforms this mesh object."""
|
||||
for m in obj.modifiers:
|
||||
if m.type=='ARMATURE':
|
||||
@ -126,7 +126,7 @@ def leave_wp(context):
|
||||
|
||||
return
|
||||
|
||||
class EASYWEIGHT_OT_toggle_weight_paint(bpy.types.Operator):
|
||||
class EASYWEIGHT_OT_toggle_weight_paint(Operator):
|
||||
"""Enter weight paint mode on a mesh object and pose mode on its armature"""
|
||||
bl_idname = "object.weight_paint_toggle"
|
||||
bl_label = "Toggle Weight Paint Mode"
|
||||
@ -157,12 +157,12 @@ def register():
|
||||
from bpy.utils import register_class
|
||||
register_class(EASYWEIGHT_OT_toggle_weight_paint)
|
||||
|
||||
bpy.types.VIEW3D_MT_paint_weight.append(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
bpy.types.VIEW3D_MT_object.append(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
VIEW3D_MT_paint_weight.append(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
VIEW3D_MT_object.append(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
|
||||
def unregister():
|
||||
from bpy.utils import unregister_class
|
||||
unregister_class(EASYWEIGHT_OT_toggle_weight_paint)
|
||||
|
||||
bpy.types.VIEW3D_MT_paint_weight.remove(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
bpy.types.VIEW3D_MT_object.remove(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
VIEW3D_MT_paint_weight.remove(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
||||
VIEW3D_MT_object.remove(EASYWEIGHT_OT_toggle_weight_paint.draw)
|
Loading…
Reference in New Issue
Block a user