Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-01-25 20:46:55 +0300
committerHans Goudey <h.goudey@me.com>2021-01-25 20:46:55 +0300
commitaa030d34599387aa560da7db38b0e119c06f1530 (patch)
tree6ac4655928bf598e90dfd8446099a18b13981ae5 /source/blender/modifiers
parentef6d6524280d27d5e665658b538ed226bc67c65c (diff)
Fix: Unable to animate nodes modifier exposed properties
The RNA path used for animating the settings passed to the node tree is incorrect. Currently it's just `settings.property_name`, but it's the path from the ID, not the modifier, so it should be `modifiers[modifier_name].settings.property_name`. However, the "Settings" struct is separated in RNA and DNA, which means that the callback to get the RNA path does not know about the modifier's name in order to fill the above path, so some reference to the modifier in the "Settings" struct would be necessary, which would create a convoluted layout in the `ModifierData` struct. Instead, this commit simply removes the "Settings" struct from RNA, which isn't as elegant from the point of view of the Python API, but otherwise it's a nice simplification. Note that we don't remove the "Settings" struct from DNA, because it would break reading old files. Differential Revision: https://developer.blender.org/D10175
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_nodes.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 5ef17aeddd1..f3d6cf49dd6 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1053,7 +1053,7 @@ static void modifyGeometrySet(ModifierData *md,
* the correct label displayed in the UI. */
static void draw_property_for_socket(uiLayout *layout,
PointerRNA *bmain_ptr,
- PointerRNA *settings_ptr,
+ PointerRNA *md_ptr,
const IDProperty *modifier_props,
const bNodeSocket &socket)
{
@@ -1081,12 +1081,12 @@ static void draw_property_for_socket(uiLayout *layout,
switch (socket.type) {
case SOCK_OBJECT: {
uiItemPointerR(
- layout, settings_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA);
+ layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA);
break;
}
case SOCK_COLLECTION: {
uiItemPointerR(layout,
- settings_ptr,
+ md_ptr,
rna_path,
bmain_ptr,
"collections",
@@ -1095,7 +1095,7 @@ static void draw_property_for_socket(uiLayout *layout,
break;
}
default:
- uiItemR(layout, settings_ptr, rna_path, 0, socket.name, ICON_NONE);
+ uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE);
}
}
}
@@ -1109,8 +1109,7 @@ static void panel_draw(const bContext *C, Panel *panel)
NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data);
uiLayoutSetPropSep(layout, true);
- /* This should be removed, but animation currently doesn't work with the IDProperties. */
- uiLayoutSetPropDecorate(layout, false);
+ uiLayoutSetPropDecorate(layout, true);
uiTemplateID(layout,
C,
@@ -1124,15 +1123,11 @@ static void panel_draw(const bContext *C, Panel *panel)
nullptr);
if (nmd->node_group != nullptr && nmd->settings.properties != nullptr) {
- PointerRNA settings_ptr;
- RNA_pointer_create(ptr->owner_id, &RNA_NodesModifierSettings, &nmd->settings, &settings_ptr);
-
PointerRNA bmain_ptr;
RNA_main_pointer_create(bmain, &bmain_ptr);
LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->inputs) {
- draw_property_for_socket(
- layout, &bmain_ptr, &settings_ptr, nmd->settings.properties, *socket);
+ draw_property_for_socket(layout, &bmain_ptr, ptr, nmd->settings.properties, *socket);
}
}