From 43f5e761a66e87fed664a199cda867639f8daf3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Thu, 23 Dec 2021 18:05:00 +0100 Subject: Cache File: use panels to organize UI This adds interface panels to organize the Cache File UI parameters for modifiers and constraints into related components: velocity, time, and render procedural. Properties relating to the three aforementioned components are separated from `uiTemplateCacheFile` into their own functions (e.g. `uiTemplateCacheFileVelocity` for the velocity one), which are in turn called from the specific panel creation routines of the modifiers and constraints (for constraints, the functions are exposed to the RNA). `uiTemplateCacheFile` now only shows the properties for the file path, and in the case of constraints, the scale property. The properties that are only defined per modifier (like the velocity scale), are shown in the proper modifier layout panel if applicable. Reviewed By: sybren Differential Revision: https://developer.blender.org/D13652 --- .../scripts/startup/bl_ui/properties_constraint.py | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'release') diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index b4ff2d30e05..570a437c213 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -1146,6 +1146,30 @@ class ConstraintButtonsSubPanel: col.prop(con, "frame_start", text="Frame Start") col.prop(con, "frame_end", text="End") + def draw_transform_cache_velocity(self, context): + self.draw_transform_cache_subpanel( + context, self.layout.template_cache_file_velocity + ) + + def draw_transform_cache_procedural(self, context): + self.draw_transform_cache_subpanel( + context, self.layout.template_cache_file_procedural + ) + + def draw_transform_cache_time(self, context): + self.draw_transform_cache_subpanel( + context, self.layout.template_cache_file_time_settings + ) + + def draw_transform_cache_subpanel(self, context, template_func): + con = self.get_constraint(context) + if con.cache_file is None: + return + + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = True + template_func(con, "cache_file") # Child Of Constraint @@ -1534,6 +1558,54 @@ class BONE_PT_bTransformCacheConstraint(BoneConstraintPanel, ConstraintButtonsPa self.draw_transform_cache(context) +class OBJECT_PT_bTransformCacheConstraint_velocity(ObjectConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "OBJECT_PT_bTransformCacheConstraint" + bl_label = "Velocity" + + def draw(self, context): + self.draw_transform_cache_velocity(context) + + +class BONE_PT_bTransformCacheConstraint_velocity(BoneConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "BONE_PT_bTransformCacheConstraint" + bl_label = "Velocity" + + def draw(self, context): + self.draw_transform_cache_velocity(context) + + +class OBJECT_PT_bTransformCacheConstraint_procedural(ObjectConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "OBJECT_PT_bTransformCacheConstraint" + bl_label = "Render Procedural" + + def draw(self, context): + self.draw_transform_cache_procedural(context) + + +class BONE_PT_bTransformCacheConstraint_procedural(BoneConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "BONE_PT_bTransformCacheConstraint" + bl_label = "Render Procedural" + + def draw(self, context): + self.draw_transform_cache_procedural(context) + + +class OBJECT_PT_bTransformCacheConstraint_time(ObjectConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "OBJECT_PT_bTransformCacheConstraint" + bl_label = "Time" + + def draw(self, context): + self.draw_transform_cache_time(context) + + +class BONE_PT_bTransformCacheConstraint_time(BoneConstraintPanel, ConstraintButtonsSubPanel, Panel): + bl_parent_id = "BONE_PT_bTransformCacheConstraint" + bl_label = "Time" + + def draw(self, context): + self.draw_transform_cache_time(context) + + # Python Constraint class OBJECT_PT_bPythonConstraint(ObjectConstraintPanel, ConstraintButtonsPanel, Panel): @@ -1620,6 +1692,9 @@ classes = ( OBJECT_PT_bCameraSolverConstraint, OBJECT_PT_bObjectSolverConstraint, OBJECT_PT_bTransformCacheConstraint, + OBJECT_PT_bTransformCacheConstraint_time, + OBJECT_PT_bTransformCacheConstraint_procedural, + OBJECT_PT_bTransformCacheConstraint_velocity, OBJECT_PT_bPythonConstraint, OBJECT_PT_bArmatureConstraint, OBJECT_PT_bArmatureConstraint_bones, @@ -1657,6 +1732,9 @@ classes = ( BONE_PT_bCameraSolverConstraint, BONE_PT_bObjectSolverConstraint, BONE_PT_bTransformCacheConstraint, + BONE_PT_bTransformCacheConstraint_time, + BONE_PT_bTransformCacheConstraint_procedural, + BONE_PT_bTransformCacheConstraint_velocity, BONE_PT_bPythonConstraint, BONE_PT_bArmatureConstraint, BONE_PT_bArmatureConstraint_bones, -- cgit v1.2.3