From 6caba7bba2e44a3020242ab3165274edf779b6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 21 Apr 2015 11:50:19 +0200 Subject: Use a dedicated panel for cache library UI instead of appending to the duplication UI. --- release/scripts/startup/bl_ui/properties_object.py | 82 +++++++++++++--------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 5a3d0b9f5ee..7e61ded5ef6 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -312,6 +312,48 @@ def cachelib_object_items(cachelib, ob): class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): bl_label = "Duplication" + def draw(self, context): + layout = self.layout + + ob = context.object + + layout.prop(ob, "dupli_type", expand=True) + + if ob.dupli_type == 'FRAMES': + split = layout.split() + + col = split.column(align=True) + col.prop(ob, "dupli_frames_start", text="Start") + col.prop(ob, "dupli_frames_end", text="End") + + col = split.column(align=True) + col.prop(ob, "dupli_frames_on", text="On") + col.prop(ob, "dupli_frames_off", text="Off") + + layout.prop(ob, "use_dupli_frames_speed", text="Speed") + + elif ob.dupli_type == 'VERTS': + layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") + + elif ob.dupli_type == 'FACES': + row = layout.row() + row.prop(ob, "use_dupli_faces_scale", text="Scale") + sub = row.row() + sub.active = ob.use_dupli_faces_scale + sub.prop(ob, "dupli_faces_scale", text="Inherit Scale") + + elif ob.dupli_type == 'GROUP': + layout.prop(ob, "dupli_group", text="Group") + + +class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel): + bl_label = "Cache" + + @classmethod + def poll(cls, context): + ob = context.object + return (ob and ob.dupli_type == 'GROUP' and ob.dupli_group) + def draw_cache_modifier(self, context, layout, cachelib, md): layout.context_pointer_set("cache_modifier", md) @@ -395,43 +437,15 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): self.draw_cache_modifier(context, box, cachelib, md) def draw(self, context): - layout = self.layout - ob = context.object - layout.prop(ob, "dupli_type", expand=True) - - if ob.dupli_type == 'FRAMES': - split = layout.split() - - col = split.column(align=True) - col.prop(ob, "dupli_frames_start", text="Start") - col.prop(ob, "dupli_frames_end", text="End") - - col = split.column(align=True) - col.prop(ob, "dupli_frames_on", text="On") - col.prop(ob, "dupli_frames_off", text="Off") - - layout.prop(ob, "use_dupli_frames_speed", text="Speed") - - elif ob.dupli_type == 'VERTS': - layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") - - elif ob.dupli_type == 'FACES': - row = layout.row() - row.prop(ob, "use_dupli_faces_scale", text="Scale") - sub = row.row() - sub.active = ob.use_dupli_faces_scale - sub.prop(ob, "dupli_faces_scale", text="Inherit Scale") - - elif ob.dupli_type == 'GROUP': - layout.prop(ob, "dupli_group", text="Group") - row = layout.row(align=True) - row.template_ID(ob, "cache_library", new="cachelibrary.new") + layout = self.layout + row = layout.row(align=True) + row.template_ID(ob, "cache_library", new="cachelibrary.new") - if ob.cache_library: - cache_objects = cachelib_objects(ob.cache_library, ob.dupli_group) - self.draw_cachelib(context, layout, ob, ob.cache_library, cache_objects) + if ob.cache_library: + cache_objects = cachelib_objects(ob.cache_library, ob.dupli_group) + self.draw_cachelib(context, layout, ob, ob.cache_library, cache_objects) def HAIR_SIMULATION(self, context, layout, cachelib, md): params = md.parameters -- cgit v1.2.3