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 /source/blender/modifiers | |
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 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshsequencecache.c | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index bcaf294ec8b..6982f95ef8d 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -328,14 +328,71 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(layout, ptr, "use_vertex_interpolation", 0, NULL, ICON_NONE); } + modifier_panel_end(layout, ptr); +} + +static void velocity_panel_draw(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ob_ptr; + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); + + PointerRNA fileptr; + if (!uiTemplateCacheFilePointer(ptr, "cache_file", &fileptr)) { + return; + } + + uiLayoutSetPropSep(layout, true); + uiTemplateCacheFileVelocity(layout, &fileptr); uiItemR(layout, ptr, "velocity_scale", 0, NULL, ICON_NONE); +} - modifier_panel_end(layout, ptr); +static void time_panel_draw(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ob_ptr; + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); + + PointerRNA fileptr; + if (!uiTemplateCacheFilePointer(ptr, "cache_file", &fileptr)) { + return; + } + + uiLayoutSetPropSep(layout, true); + uiTemplateCacheFileTimeSettings(layout, &fileptr); +} + +static void render_procedural_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ob_ptr; + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); + + PointerRNA fileptr; + if (!uiTemplateCacheFilePointer(ptr, "cache_file", &fileptr)) { + return; + } + + uiLayoutSetPropSep(layout, true); + uiTemplateCacheFileProcedural(layout, C, &fileptr); } static void panelRegister(ARegionType *region_type) { - modifier_panel_register(region_type, eModifierType_MeshSequenceCache, panel_draw); + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_MeshSequenceCache, panel_draw); + modifier_subpanel_register(region_type, "time", "Time", NULL, time_panel_draw, panel_type); + modifier_subpanel_register(region_type, + "render_procedural", + "Render Procedural", + NULL, + render_procedural_panel_draw, + panel_type); + modifier_subpanel_register( + region_type, "velocity", "Velocity", NULL, velocity_panel_draw, panel_type); } static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) |