forked from bartvdbraak/blender
d091856486
* Fix poll() callback changes in recent commit, note that these have to work with pinned context too. * Hide header for context panels in py layout. * Don't jump back when collapsing a panel, allow the view to be over some empty space until you scroll back. * Fix follow context icon, order had to be reversed in icon file. * ID template now has icon as part of browse button instead of outside the buttons.
98 lines
2.2 KiB
Python
98 lines
2.2 KiB
Python
|
|
import bpy
|
|
|
|
class BoneButtonsPanel(bpy.types.Panel):
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
__region_type__ = "WINDOW"
|
|
__context__ = "bone"
|
|
|
|
def poll(self, context):
|
|
return (context.bone or context.edit_bone)
|
|
|
|
class BONE_PT_context_bone(BoneButtonsPanel):
|
|
__idname__ = "BONE_PT_context_bone"
|
|
__no_header__ = True
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
bone = context.bone
|
|
if not bone:
|
|
bone = context.edit_bone
|
|
|
|
split = layout.split(percentage=0.06)
|
|
split.itemL(text="", icon="ICON_BONE_DATA")
|
|
split.itemR(bone, "name", text="")
|
|
|
|
class BONE_PT_bone(BoneButtonsPanel):
|
|
__idname__ = "BONE_PT_bone"
|
|
__label__ = "Bone"
|
|
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
bone = context.bone
|
|
if not bone:
|
|
bone = context.edit_bone
|
|
|
|
split = layout.split()
|
|
|
|
sub = split.column()
|
|
sub.itemR(bone, "parent")
|
|
sub.itemR(bone, "connected")
|
|
|
|
sub.itemL(text="Layers:")
|
|
sub.template_layers(bone, "layer")
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemL(text="Inherit:")
|
|
sub.itemR(bone, "hinge", text="Rotation")
|
|
sub.itemR(bone, "inherit_scale", text="Scale")
|
|
|
|
sub.itemL(text="Display:")
|
|
sub.itemR(bone, "draw_wire", text="Wireframe")
|
|
sub.itemR(bone, "hidden", text="Hide")
|
|
|
|
|
|
|
|
class BONE_PT_deform(BoneButtonsPanel):
|
|
__idname__ = "BONE_PT_deform"
|
|
__label__ = "Deform"
|
|
|
|
def draw_header(self, context):
|
|
layout = self.layout
|
|
bone = context.bone
|
|
if not bone:
|
|
bone = context.edit_bone
|
|
|
|
layout.itemR(bone, "deform", text="")
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
bone = context.bone
|
|
if not bone:
|
|
bone = context.edit_bone
|
|
|
|
layout.active = bone.deform
|
|
|
|
split = layout.split()
|
|
|
|
sub = split.column()
|
|
sub.itemL(text="Envelope:")
|
|
sub.itemR(bone, "envelope_distance", text="Distance")
|
|
sub.itemR(bone, "envelope_weight", text="Weight")
|
|
sub.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
|
|
sub = split.column()
|
|
|
|
sub.itemL(text="Curved Bones:")
|
|
sub.itemR(bone, "bbone_segments", text="Segments")
|
|
sub.itemR(bone, "bbone_in", text="Ease In")
|
|
sub.itemR(bone, "bbone_out", text="Ease Out")
|
|
|
|
sub.itemR(bone, "cyclic_offset")
|
|
|
|
|
|
bpy.types.register(BONE_PT_context_bone)
|
|
bpy.types.register(BONE_PT_bone)
|
|
bpy.types.register(BONE_PT_deform)
|