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>2020-11-19 22:35:48 +0300
committerHans Goudey <h.goudey@me.com>2020-11-19 22:35:48 +0300
commit097e1ca1a1daa463e5fb62ffd5006d21ba2aba75 (patch)
tree35ceb891d02ae796a161f40cc123c06278c461ac /source/blender/makesrna/intern
parentdc628e7c389e1a2127db8788dac3bfbc6a4d4164 (diff)
Geometry Nodes: Add the concept of an active modifier
This commit adds functions to set and get the object's active modifier, which is stored as a flag in the ModifierData struct, similar to constraints. This will be used to set the context in the node editor. There are no visible changes in this commit.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 965395bf314..632c9bb9de3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1541,6 +1541,29 @@ static bool rna_Modifier_show_expanded_get(PointerRNA *ptr)
return md->ui_expand_flag & UI_PANEL_DATA_EXPAND_ROOT;
}
+static void rna_Modifier_is_active_set(PointerRNA *ptr, bool value)
+{
+ ModifierData *md = ptr->data;
+
+ if (value) {
+ /* Disable the active flag of all other modifiers. */
+ for (ModifierData *prev_md = md->prev; prev_md != NULL; prev_md = prev_md->prev) {
+ prev_md->flag &= ~eModifierFlag_Active;
+ }
+ for (ModifierData *next_md = md->next; next_md != NULL; next_md = next_md->next) {
+ next_md->flag &= ~eModifierFlag_Active;
+ }
+ }
+
+ SET_FLAG_FROM_TEST(md->flag, value, eModifierFlag_Active);
+}
+
+static bool rna_Modifier_is_active_get(PointerRNA *ptr)
+{
+ ModifierData *md = ptr->data;
+ return md->flag & eModifierFlag_Active;
+}
+
static int rna_MeshSequenceCacheModifier_has_velocity_get(PointerRNA *ptr)
{
# ifdef WITH_ALEMBIC
@@ -7259,6 +7282,13 @@ void RNA_def_modifier(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+ prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Modifier_is_active_get", "rna_Modifier_is_active_set");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+ RNA_def_property_ui_text(prop, "Active", "The active modifier in the list");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
RNA_def_property_ui_text(