[Bf-blender-cvs] [b2890d6366e] fcurve-modifier-panels: Merge branch 'master' into fcurve-modifier-panels
Hans Goudey
noreply at git.blender.org
Mon Oct 19 04:45:05 CEST 2020
Commit: b2890d6366e548960bccfa2a99c023696dce83bc
Author: Hans Goudey
Date: Wed Sep 2 14:16:04 2020 -0500
Branches: fcurve-modifier-panels
https://developer.blender.org/rBb2890d6366e548960bccfa2a99c023696dce83bc
Merge branch 'master' into fcurve-modifier-panels
===================================================================
===================================================================
diff --cc source/blender/editors/animation/fmodifier_ui.c
index 89408a4afea,1ecdf5accb8..8e54828d4d4
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@@ -865,195 -790,247 +865,195 @@@ static void envelope_panel_draw(const b
UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, POINTER_FROM_INT(i));
UI_block_align_begin(block);
}
-}
-/* --------------- */
+ fmodifier_influence_draw(layout, ptr);
+}
-/* draw settings for limits modifier */
-static void draw_modifier__limits(uiLayout *layout,
- ID *fcurve_owner_id,
- FModifier *fcm,
- short UNUSED(width))
+void ANIM_fcm_envelope_panel_register(ARegionType *region_type,
+ const char *id_prefix,
+ PanelTypePollFn poll_fn)
{
- uiLayout *split, *col /* , *row */ /* UNUSED */;
- PointerRNA ptr;
-
- /* init the RNA-pointer */
- RNA_pointer_create(fcurve_owner_id, &RNA_FModifierLimits, fcm, &ptr);
-
- /* row 1: minimum */
- {
- /* row = uiLayoutRow(layout, false); */ /* UNUSED */
-
- /* split into 2 columns */
- split = uiLayoutSplit(layout, 0.5f, false);
+ PanelType *panel_type = fmodifier_panel_register(
+ region_type, FMODIFIER_TYPE_ENVELOPE, envelope_panel_draw, poll_fn, id_prefix);
+ fmodifier_subpanel_register(region_type,
+ "frame_range",
+ "Restrict Frame Range",
+ fmodifier_frame_range_header_draw,
+ fmodifier_frame_range_draw,
+ poll_fn,
+ panel_type);
+}
- /* x-minimum */
- col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
+/** \} */
- /* y-minimum*/
- col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
- }
+/* -------------------------------------------------------------------- */
+/** \name Limits Modifier
+ * \{ */
- /* row 2: maximum */
- {
- /* row = uiLayoutRow(layout, false); */ /* UNUSED */
+static void limits_panel_draw(const bContext *UNUSED(C), Panel *panel)
+{
+ uiLayout *col, *row, *sub;
+ uiLayout *layout = panel->layout;
- /* split into 2 columns */
- split = uiLayoutSplit(layout, 0.5f, false);
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
- /* x-minimum */
- col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
- /* y-minimum*/
- col = uiLayoutColumn(split, true);
- uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
- }
+ /* Minimums. */
+ col = uiLayoutColumn(layout, false);
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Minumum X"));
+ uiItemR(row, ptr, "use_min_x", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min_x"));
+ uiItemR(sub, ptr, "min_x", 0, "", ICON_NONE);
+
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Y"));
+ uiItemR(row, ptr, "use_min_y", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min_y"));
+ uiItemR(sub, ptr, "min_y", 0, "", ICON_NONE);
+
+ /* Maximums. */
+ col = uiLayoutColumn(layout, false);
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Maximum X"));
+ uiItemR(row, ptr, "use_max_x", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max_x"));
+ uiItemR(sub, ptr, "max_x", 0, "", ICON_NONE);
+
+ row = uiLayoutRowWithHeading(col, true, IFACE_("Y"));
+ uiItemR(row, ptr, "use_max_y", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max_y"));
+ uiItemR(sub, ptr, "max_y", 0, "", ICON_NONE);
+
+ fmodifier_influence_draw(layout, ptr);
}
-/* --------------- */
-
-/* draw settings for stepped interpolation modifier */
-static void draw_modifier__stepped(uiLayout *layout,
- ID *fcurve_owner_id,
- FModifier *fcm,
- short UNUSED(width))
+void ANIM_fcm_limits_panel_register(ARegionType *region_type,
+ const char *id_prefix,
+ PanelTypePollFn poll_fn)
{
- uiLayout *col, *sub;
- PointerRNA ptr;
+ PanelType *panel_type = fmodifier_panel_register(
+ region_type, FMODIFIER_TYPE_LIMITS, limits_panel_draw, poll_fn, id_prefix);
+ fmodifier_subpanel_register(region_type,
+ "frame_range",
+ "Restrict Frame Range",
+ fmodifier_frame_range_header_draw,
+ fmodifier_frame_range_draw,
+ poll_fn,
+ panel_type);
+}
- /* init the RNA-pointer */
- RNA_pointer_create(fcurve_owner_id, &RNA_FModifierStepped, fcm, &ptr);
+/** \} */
- /* block 1: "stepping" settings */
- col = uiLayoutColumn(layout, false);
- uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
+/* -------------------------------------------------------------------- */
+/** \name Stepped Interpolation Modifier
+ * \{ */
- /* block 2: start range settings */
- col = uiLayoutColumn(layout, true);
- uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
+static void stepped_panel_draw(const bContext *UNUSED(C), Panel *panel)
+{
+ uiLayout *col, *sub, *row;
+ uiLayout *layout = panel->layout;
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
- uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
- /* block 3: end range settings */
- col = uiLayoutColumn(layout, true);
- uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
- uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
+ /* Stepping Settings. */
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "frame_step", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NONE);
+
+ /* Start range settings. */
+ row = uiLayoutRowWithHeading(layout, true, IFACE_("Start Frame"));
+ uiItemR(row, ptr, "use_frame_start", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_frame_start"));
+ uiItemR(sub, ptr, "frame_start", 0, "", ICON_NONE);
+
+ /* End range settings. */
+ row = uiLayoutRowWithHeading(layout, true, IFACE_("End Frame"));
+ uiItemR(row, ptr, "use_frame_end", 0, "", ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_frame_end"));
+ uiItemR(sub, ptr, "frame_end", 0, "", ICON_NONE);
+
+ fmodifier_influence_draw(layout, ptr);
}
-/* --------------- */
-
-void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout,
- ID *fcurve_owner_id,
- ListBase *modifiers,
- FModifier *fcm)
+void ANIM_fcm_stepped_panel_register(ARegionType *region_type,
+ const char *id_prefix,
+ PanelTypePollFn poll_fn)
{
- const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
- uiLayout *box, *row, *sub, *col;
- uiBlock *block;
- uiBut *but;
- short width = 314;
- PointerRNA ptr;
+ PanelType *panel_type = fmodifier_panel_register(
+ region_type, FMODIFIER_TYPE_STEPPED, stepped_panel_draw, poll_fn, id_prefix);
+ fmodifier_subpanel_register(region_type,
+ "frame_range",
+ "Restrict Frame Range",
+ fmodifier_frame_range_header_draw,
+ fmodifier_frame_range_draw,
+ poll_fn,
+ panel_type);
+}
- /* init the RNA-pointer */
- RNA_pointer_create(fcurve_owner_id, &RNA_FModifier, fcm, &ptr);
+/** \} */
- /* draw header */
- {
- /* get layout-row + UI-block for this */
- box = uiLayoutBox(layout);
+/* -------------------------------------------------------------------- */
+/** \name Panel Creator "Template"
+ *
+ * Checks if the panels match the FCurve's modifiers, rebubilds them if they don't.
+ * \{ */
- row = uiLayoutRow(box, false);
- block = uiLayoutGetBlock(row); // err...
+void ANIM_fmodifier_panels(const bContext *C,
+ ID *owner_id,
+ ListBase *fmodifiers,
+ uiListPanelIDFromDataFunc panel_id_fn)
+{
+ ARegion *region = CTX_wm_region(C);
- /* left-align -------------------------------------------- */
- sub = uiLayoutRow(row, true);
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
+ bool panels_match = UI_panel_list_matches_data(region, fmodifiers, panel_id_fn);
- UI_block_emboss_set(block, UI_EMBOSS_NONE);
+ if (!panels_match) {
+ UI_panels_free_instanced(C, region);
+ FModifier *fcm = fmodifiers->first;
+ for (int i = 0; fcm; i++, fcm = fcm->next) {
+ char panel_idname[MAX_NAME];
+ panel_id_fn(fcm, panel_idname);
- /* expand */
- uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+ PointerRNA *fcm_ptr = MEM_mallocN(sizeof(PointerRNA), "panel customdata");
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list