[Bf-blender-cvs] [7c977ae4c91] fcurve-modifier-panels: Merge branch 'master' into fcurve-modifier-panels
Hans Goudey
noreply at git.blender.org
Mon Oct 19 04:45:06 CEST 2020
Commit: 7c977ae4c91250a2577b1413c38b869df73529ec
Author: Hans Goudey
Date: Wed Oct 7 16:18:31 2020 -0500
Branches: fcurve-modifier-panels
https://developer.blender.org/rB7c977ae4c91250a2577b1413c38b869df73529ec
Merge branch 'master' into fcurve-modifier-panels
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_290.c
index 4d67e511cd2,520a5da878c..862cfbf6c45
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -548,19 -780,45 +780,60 @@@ void blo_do_versions_290(FileData *fd,
*/
{
/* Keep this block, even when empty. */
+
+ /* Move to storing expansion for all panels of FModifiers. */
+ LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
+ LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
+ LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
+ if (fcm->flag & FMODIFIER_FLAG_EXPANDED_DEPRECATED) {
+ fcm->ui_expand_flag = 1;
+ }
+ else {
+ fcm->ui_expand_flag = 0;
+ }
+ }
+ }
+ }
++
+ if (!DNA_struct_elem_find(fd->filesdna, "WorkSpaceDataRelation", "int", "parentid")) {
+ LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
+ LISTBASE_FOREACH_MUTABLE (
+ WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations) {
+ relation->parent = blo_read_get_new_globaldata_address(fd, relation->parent);
+ BLI_assert(relation->parentid == 0);
+ if (relation->parent != NULL) {
+ LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
+ wmWindow *win = BLI_findptr(
+ &wm->windows, relation->parent, offsetof(wmWindow, workspace_hook));
+ if (win != NULL) {
+ relation->parentid = win->winid;
+ break;
+ }
+ }
+ if (relation->parentid == 0) {
+ BLI_assert(
+ !"Found a valid parent for workspace data relation, but no valid parent id.");
+ }
+ }
+ if (relation->parentid == 0) {
+ BLI_freelinkN(&workspace->hook_layout_relations, relation);
+ }
+ }
+ }
+ }
+
+ /* UV/Image show overlay option. */
+ if (!DNA_struct_find(fd->filesdna, "SpaceImageOverlay")) {
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
+ if (space->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)space;
+ sima->overlay.flag = SI_OVERLAY_SHOW_OVERLAYS;
+ }
+ }
+ }
+ }
+ }
}
}
diff --cc source/blender/editors/animation/fmodifier_ui.c
index 8e54828d4d4,a8fb0be4fbf..5cef02e8921
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@@ -258,173 -112,244 +258,170 @@@ static void delete_fmodifier_cb(bContex
deg_update(C, ctx->fcurve_owner_id, NULL);
}
-/* --------------- */
-/* draw settings for generator modifier */
-static void draw_modifier__generator(uiLayout *layout,
- ID *fcurve_owner_id,
- FModifier *fcm,
- short width)
+static void fmodifier_influence_draw(uiLayout *layout, PointerRNA *ptr)
{
- FMod_Generator *data = (FMod_Generator *)fcm->data;
- uiLayout /* *col, */ /* UNUSED */ *row;
- uiBlock *block;
- uiBut *but;
- PointerRNA ptr;
- short bwidth = width - 1.5 * UI_UNIT_X; /* max button width */
-
- /* init the RNA-pointer */
- RNA_pointer_create(fcurve_owner_id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
-
- /* basic settings (backdrop + mode selector + some padding) */
- /* col = uiLayoutColumn(layout, true); */ /* UNUSED */
- block = uiLayoutGetBlock(layout);
- UI_block_align_begin(block);
- but = uiDefButR(block,
- UI_BTYPE_MENU,
- B_FMODIFIER_REDRAW,
- NULL,
- 0,
- 0,
- bwidth,
- UI_UNIT_Y,
- &ptr,
- "mode",
- -1,
- 0,
- 0,
- -1,
- -1,
- NULL);
- UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
-
- uiDefButR(block,
- UI_BTYPE_TOGGLE,
- B_FMODIFIER_REDRAW,
- NULL,
- 0,
- 0,
- bwidth,
- UI_UNIT_Y,
- &ptr,
- "use_additive",
- -1,
- 0,
- 0,
- -1,
- -1,
- NULL);
- UI_block_align_end(block);
-
- /* now add settings for individual modes */
- switch (data->mode) {
- case FCM_GENERATOR_POLYNOMIAL: /* polynomial expression */
- {
- const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
- float *cp = NULL;
- char xval[32];
- int maxXWidth;
+ FModifier *fcm = (FModifier *)ptr->data;
+ uiItemS(layout);
- /* draw polynomial order selector */
- row = uiLayoutRow(layout, false);
- block = uiLayoutGetBlock(row);
-
- but = uiDefButI(
- block,
- UI_BTYPE_NUM,
- B_FMODIFIER_REDRAW,
- IFACE_("Poly Order:"),
- 0.5f * UI_UNIT_X,
- 0,
- bwidth,
- UI_UNIT_Y,
- &data->poly_order,
- 1,
- 100,
- 0,
- 0,
- TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
- UI_but_number_step_size_set(but, 1);
- UI_but_func_set(but, validate_fmodifier_cb, fcm, fcurve_owner_id);
-
- /* calculate maximum width of label for "x^n" labels */
- if (data->arraysize > 2) {
- BLI_snprintf(xval, sizeof(xval), "x^%u", data->arraysize);
- /* XXX: UI_fontstyle_string_width is not accurate */
- maxXWidth = UI_fontstyle_string_width(fstyle, xval) + 0.5 * UI_UNIT_X;
- }
- else {
- /* basic size (just "x") */
- maxXWidth = UI_fontstyle_string_width(fstyle, "x") + 0.5 * UI_UNIT_X;
- }
+ uiLayout *row = uiLayoutRowWithHeading(layout, true, IFACE_("Influence"));
+ uiItemR(row, ptr, "use_influence", 0, "", ICON_NONE);
+ uiLayout *sub = uiLayoutRow(row, true);
- /* draw controls for each coefficient and a + sign at end of row */
- row = uiLayoutRow(layout, true);
- block = uiLayoutGetBlock(row);
+ uiLayoutSetActive(sub, fcm->flag & FMODIFIER_FLAG_USEINFLUENCE);
+ uiItemR(sub, ptr, "influence", 0, "", ICON_NONE);
+}
- /* Update depsgraph when values change */
- UI_block_func_set(block, deg_update, fcurve_owner_id, NULL);
+static void fmodifier_frame_range_header_draw(const bContext *UNUSED(C), Panel *panel)
+{
+ uiLayout *layout = panel->layout;
- cp = data->coefficients;
- for (uint i = 0; (i < data->arraysize) && (cp); i++, cp++) {
- /* To align with first line... */
- if (i) {
- uiDefBut(block,
- UI_BTYPE_LABEL,
- 1,
- " ",
- 0,
- 0,
- 2 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- "");
- }
- else {
- uiDefBut(block,
- UI_BTYPE_LABEL,
- 1,
- "y =",
- 0,
- 0,
- 2 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- "");
- }
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
- /* coefficient */
- but = uiDefButF(block,
- UI_BTYPE_NUM,
- B_FMODIFIER_REDRAW,
- "",
- 0,
- 0,
- bwidth / 2,
- UI_UNIT_Y,
- cp,
- -UI_FLT_MAX,
- UI_FLT_MAX,
- 0,
- 0,
- TIP_("Coefficient for polynomial"));
- UI_but_number_step_size_set(but, 10);
- UI_but_number_precision_set(but, 3);
+ uiItemR(layout, ptr, "use_restricted_range", 0, "", ICON_NONE);
+}
- /* 'x' param (and '+' if necessary) */
- if (i == 0) {
- BLI_strncpy(xval, " ", sizeof(xval));
- }
- else if (i == 1) {
- BLI_strncpy(xval, "x", sizeof(xval));
- }
- else {
- BLI_snprintf(xval, sizeof(xval), "x^%u", i);
- }
- uiDefBut(block,
- UI_BTYPE_LABEL,
- 1,
- xval,
- 0,
- 0,
- maxXWidth,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- TIP_("Power of x"));
+static void fmodifier_frame_range_draw(const bContext *UNUSED(C), Panel *panel)
+{
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
- if ((i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2)) {
- uiDefBut(
- block, UI_BTYPE_LABEL, 1, "+", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ PointerRNA *ptr = fmodifier_get_pointers(panel, NULL);
- /* next coefficient on a new row */
- row = uiLayoutRow(layout, true);
- block = uiLayoutGetBlock(row);
- }
- else {
- /* For alignment in UI! */
- uiDefBut(
- block, UI_BTYPE_LABEL, 1, " ", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- }
+ uiLayoutSetPropSep(layout, true);
+
+ FModifier *fcm = (FModifier *)ptr->data;
+ uiLayoutSetActive(layout, fcm->flag & FMODIFIER_FLAG_RANGERESTRICT);
+
+ col = u
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list