UI:
* Added panels with dummy preview template. * Added constraints panel for bones next to objects, though it doesn't work that well yet, the operators and code need to be changed so they don't assume it is one or the other in/out of posemode. * Added some graying out in the scene and world buttons.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
import bpy
|
||||
|
||||
class DataButtonsPanel(bpy.types.Panel):
|
||||
class BoneButtonsPanel(bpy.types.Panel):
|
||||
__space_type__ = "BUTTONS_WINDOW"
|
||||
__region_type__ = "WINDOW"
|
||||
__context__ = "bone"
|
||||
@@ -10,8 +10,8 @@ class DataButtonsPanel(bpy.types.Panel):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'ARMATURE')
|
||||
|
||||
class DATA_PT_bone(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_bone"
|
||||
class BONE_PT_bone(BoneButtonsPanel):
|
||||
__idname__ = "BONE_PT_bone"
|
||||
__label__ = "Bone"
|
||||
|
||||
def draw(self, context):
|
||||
@@ -49,16 +49,5 @@ class DATA_PT_bone(DataButtonsPanel):
|
||||
|
||||
sub.itemR(bone, "cyclic_offset")
|
||||
|
||||
class DATA_PT_constraints(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_constraints"
|
||||
__label__ = "Constraints"
|
||||
|
||||
def draw(self, context):
|
||||
bone = context.active_object.data.bones[0]
|
||||
layout = self.layout
|
||||
split = layout.split()
|
||||
|
||||
sub = split.column()
|
||||
bpy.types.register(BONE_PT_bone)
|
||||
|
||||
bpy.types.register(DATA_PT_bone)
|
||||
#bpy.types.register(DATA_PT_constraints)
|
||||
@@ -9,6 +9,16 @@ class MaterialButtonsPanel(bpy.types.Panel):
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.active_material)
|
||||
|
||||
class MATERIAL_PT_preview(MaterialButtonsPanel):
|
||||
__idname__= "MATERIAL_PT_preview"
|
||||
__label__ = "Preview"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.active_object.active_material
|
||||
layout.template_preview(mat)
|
||||
|
||||
class MATERIAL_PT_material(MaterialButtonsPanel):
|
||||
__idname__= "MATERIAL_PT_material"
|
||||
@@ -188,8 +198,10 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
|
||||
sub.itemR(halo, "flare_seed", text="Seed")
|
||||
sub.itemR(halo, "flares_sub", text="Sub")
|
||||
|
||||
bpy.types.register(MATERIAL_PT_preview)
|
||||
bpy.types.register(MATERIAL_PT_material)
|
||||
bpy.types.register(MATERIAL_PT_raymir)
|
||||
bpy.types.register(MATERIAL_PT_raytransp)
|
||||
bpy.types.register(MATERIAL_PT_sss)
|
||||
bpy.types.register(MATERIAL_PT_halo)
|
||||
bpy.types.register(MATERIAL_PT_halo)
|
||||
|
||||
|
||||
@@ -1,34 +1,39 @@
|
||||
|
||||
import bpy
|
||||
|
||||
class DataButtonsPanel(bpy.types.Panel):
|
||||
class ConstraintButtonsPanel(bpy.types.Panel):
|
||||
__space_type__ = "BUTTONS_WINDOW"
|
||||
__region_type__ = "WINDOW"
|
||||
__context__ = "object"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
return (ob != None)
|
||||
|
||||
class DATA_PT_constraints(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_constraints"
|
||||
__label__ = "Constraints"
|
||||
|
||||
def draw(self, context):
|
||||
ob = context.active_object
|
||||
def draw_constraint(self, con):
|
||||
layout = self.layout
|
||||
box = layout.template_constraint(con)
|
||||
|
||||
row = layout.row()
|
||||
row.item_menu_enumO("OBJECT_OT_constraint_add", "type")
|
||||
row.itemL();
|
||||
if box:
|
||||
if con.type == "COPY_LOCATION":
|
||||
self.copy_location(box, con)
|
||||
|
||||
for con in ob.constraints:
|
||||
box = layout.template_constraint(con)
|
||||
# show/key buttons here are most likely obsolete now, with
|
||||
# keyframing functionality being part of every button
|
||||
if con.type not in ("RIGID_BODY_JOINT", "NULL"):
|
||||
box.itemR(con, "influence")
|
||||
|
||||
def space_template(self, layout, con, target=True, owner=True):
|
||||
if target or owner:
|
||||
row = layout.row()
|
||||
|
||||
if box:
|
||||
if con.type == 'COPY_LOCATION':
|
||||
self.copy_location(box, con)
|
||||
|
||||
row.itemL(text="Convert:")
|
||||
|
||||
if target:
|
||||
row.itemR(con, "target_space", text="")
|
||||
|
||||
if target and owner:
|
||||
row.itemL(icon=8) # XXX
|
||||
|
||||
if owner:
|
||||
row.itemR(con, "owner_space", text="")
|
||||
|
||||
def target_template(self, layout, con, subtargets=True):
|
||||
layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object
|
||||
|
||||
@@ -55,5 +60,49 @@ class DATA_PT_constraints(DataButtonsPanel):
|
||||
|
||||
layout.itemR(con, "offset")
|
||||
|
||||
bpy.types.register(DATA_PT_constraints)
|
||||
self.space_template(layout, con)
|
||||
|
||||
class OBJECT_PT_constraints(ConstraintButtonsPanel):
|
||||
__idname__ = "OBJECT_PT_constraints"
|
||||
__label__ = "Constraints"
|
||||
__context__ = "object"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
return (ob != None)
|
||||
|
||||
def draw(self, context):
|
||||
ob = context.active_object
|
||||
layout = self.layout
|
||||
|
||||
row = layout.row()
|
||||
row.item_menu_enumO("OBJECT_OT_constraint_add", "type")
|
||||
row.itemL();
|
||||
|
||||
for con in ob.constraints:
|
||||
self.draw_constraint(con)
|
||||
|
||||
class BONE_PT_constraints(ConstraintButtonsPanel):
|
||||
__idname__ = "BONE_PT_constraints"
|
||||
__label__ = "Constraints"
|
||||
__context__ = "bone"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == "ARMATURE")
|
||||
|
||||
def draw(self, context):
|
||||
ob = context.active_object
|
||||
pchan = ob.pose.pose_channels[0]
|
||||
layout = self.layout
|
||||
|
||||
#row = layout.row()
|
||||
#row.item_menu_enumO("BONE_OT_constraint_add", "type")
|
||||
#row.itemL();
|
||||
|
||||
for con in pchan.constraints:
|
||||
self.draw_constraint(con)
|
||||
|
||||
bpy.types.register(OBJECT_PT_constraints)
|
||||
bpy.types.register(BONE_PT_constraints)
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
|
||||
|
||||
for group in bpy.data.groups:
|
||||
if ob in group.objects:
|
||||
box = layout.box()
|
||||
col = layout.column(align=True)
|
||||
|
||||
row = box.row()
|
||||
row.itemR(group, "name")
|
||||
row = col.box().row()
|
||||
row.itemR(group, "name", text="")
|
||||
#row.itemO("OBJECT_OT_remove_group")
|
||||
|
||||
row = box.row()
|
||||
row.column().itemR(group, "layer")
|
||||
row.column().itemR(group, "dupli_offset")
|
||||
split = col.box().split()
|
||||
split.column().itemR(group, "layer")
|
||||
split.column().itemR(group, "dupli_offset")
|
||||
|
||||
class OBJECT_PT_display(ObjectButtonsPanel):
|
||||
__idname__ = "OBJECT_PT_display"
|
||||
@@ -131,4 +131,4 @@ bpy.types.register(OBJECT_PT_transform)
|
||||
bpy.types.register(OBJECT_PT_groups)
|
||||
bpy.types.register(OBJECT_PT_display)
|
||||
bpy.types.register(OBJECT_PT_duplication)
|
||||
bpy.types.register(OBJECT_PT_animation)
|
||||
bpy.types.register(OBJECT_PT_animation)
|
||||
|
||||
@@ -77,10 +77,11 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
layout = self.layout
|
||||
|
||||
rd = scene.render_data
|
||||
|
||||
layout = self.layout
|
||||
layout.active = rd.antialiasing
|
||||
|
||||
split = layout.split()
|
||||
|
||||
sub = split.column()
|
||||
@@ -182,10 +183,11 @@ class RENDER_PT_stamp(RenderButtonsPanel):
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
layout = self.layout
|
||||
|
||||
rd = scene.render_data
|
||||
|
||||
layout = self.layout
|
||||
layout.active = rd.stamp
|
||||
|
||||
split = layout.split()
|
||||
|
||||
sub = split.column()
|
||||
@@ -211,4 +213,5 @@ bpy.types.register(RENDER_PT_dimensions)
|
||||
bpy.types.register(RENDER_PT_antialiasing)
|
||||
bpy.types.register(RENDER_PT_shading)
|
||||
bpy.types.register(RENDER_PT_output)
|
||||
bpy.types.register(RENDER_PT_stamp)
|
||||
bpy.types.register(RENDER_PT_stamp)
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ class TextureButtonsPanel(bpy.types.Panel):
|
||||
try: return (context.active_object.active_material.active_texture.texture != None)
|
||||
except:return False
|
||||
|
||||
class TEXTURE_PT_preview(TextureButtonsPanel):
|
||||
__idname__= "TEXTURE_PT_preview"
|
||||
__label__ = "Preview"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
tex = context.active_object.active_material.active_texture.texture
|
||||
layout.template_preview(tex)
|
||||
|
||||
class TEXTURE_PT_texture(TextureButtonsPanel):
|
||||
__idname__= "TEXTURE_PT_texture"
|
||||
__label__ = "Texture"
|
||||
@@ -330,6 +340,7 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
|
||||
sub = split.column()
|
||||
sub.itemR(tex, "nabla")
|
||||
|
||||
bpy.types.register(TEXTURE_PT_preview)
|
||||
bpy.types.register(TEXTURE_PT_texture)
|
||||
bpy.types.register(TEXTURE_PT_clouds)
|
||||
bpy.types.register(TEXTURE_PT_wood)
|
||||
@@ -344,3 +355,4 @@ bpy.types.register(TEXTURE_PT_envmap)
|
||||
bpy.types.register(TEXTURE_PT_musgrave)
|
||||
bpy.types.register(TEXTURE_PT_voronoi)
|
||||
bpy.types.register(TEXTURE_PT_distortednoise)
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@ class WorldButtonsPanel(bpy.types.Panel):
|
||||
|
||||
def poll(self, context):
|
||||
return (context.scene.world != None)
|
||||
|
||||
class WORLD_PT_preview(WorldButtonsPanel):
|
||||
__label__ = "Preview"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
world = context.scene.world
|
||||
layout.template_preview(world)
|
||||
|
||||
class WORLD_PT_world(WorldButtonsPanel):
|
||||
__label__ = "World"
|
||||
@@ -49,6 +58,7 @@ class WORLD_PT_mist(WorldButtonsPanel):
|
||||
def draw(self, context):
|
||||
world = context.scene.world
|
||||
layout = self.layout
|
||||
layout.active = world.mist.enabled
|
||||
|
||||
flow = layout.column_flow()
|
||||
flow.itemR(world.mist, "start")
|
||||
@@ -71,6 +81,7 @@ class WORLD_PT_stars(WorldButtonsPanel):
|
||||
def draw(self, context):
|
||||
world = context.scene.world
|
||||
layout = self.layout
|
||||
layout.active = world.stars.enabled
|
||||
|
||||
flow = layout.column_flow()
|
||||
flow.itemR(world.stars, "size")
|
||||
@@ -89,9 +100,9 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
|
||||
|
||||
def draw(self, context):
|
||||
world = context.scene.world
|
||||
layout = self.layout
|
||||
|
||||
ao = world.ambient_occlusion
|
||||
layout = self.layout
|
||||
layout.active = ao.enabled
|
||||
|
||||
layout.itemR(ao, "gather_method", expand=True)
|
||||
|
||||
@@ -126,8 +137,10 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
|
||||
col.row().itemR(ao, "color", expand=True)
|
||||
col.itemR(ao, "energy")
|
||||
|
||||
bpy.types.register(WORLD_PT_preview)
|
||||
bpy.types.register(WORLD_PT_world)
|
||||
bpy.types.register(WORLD_PT_ambient_occlusion)
|
||||
bpy.types.register(WORLD_PT_mist)
|
||||
bpy.types.register(WORLD_PT_stars)
|
||||
bpy.types.register(WORLD_PT_color_correction)
|
||||
bpy.types.register(WORLD_PT_color_correction)
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ class OUTLINER_HT_header(bpy.types.Header):
|
||||
row = layout.row(align=True)
|
||||
row.itemR(so, "display_mode")
|
||||
|
||||
|
||||
class OUTLINER_MT_view(bpy.types.Menu):
|
||||
__space_type__ = "OUTLINER"
|
||||
__label__ = "View"
|
||||
@@ -30,7 +29,6 @@ class OUTLINER_MT_view(bpy.types.Menu):
|
||||
layout.column()
|
||||
row.itemR(so, "show_restriction_columns")
|
||||
#layout.itemO("TEXT_OT_new")
|
||||
|
||||
|
||||
bpy.types.register(OUTLINER_HT_header)
|
||||
bpy.types.register(OUTLINER_MT_view)
|
||||
|
||||
Reference in New Issue
Block a user