diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-12-23 20:05:00 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-12-23 20:05:26 +0300 |
commit | 43f5e761a66e87fed664a199cda867639f8daf3e (patch) | |
tree | 58f60abb03ed87df10d69f7d9cc6a1955f599760 /release | |
parent | 7a71a95f32e57d8df51619e2e52384e5d217c439 (diff) |
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
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_constraint.py | 78 |
1 files changed, 78 insertions, 0 deletions
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, |