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:
authorJulian Eisel <julian@blender.org>2022-05-24 18:00:59 +0300
committerJulian Eisel <julian@blender.org>2022-05-24 18:08:02 +0300
commitb0da080c2cb951c167c6154de75e154532ab0f0d (patch)
tree339546b0aeb952fc4f31a1eceb9149cdc82303ec /source/blender/editors/space_node/node_add.cc
parent7b778166db4048b5109146bc073ab85fa49261f4 (diff)
Drag & drop: Use session UUID of IDs instead of name for dropping
Dropping would pass the name of the ID to drop to the properties of the drop operator. This would then lookup the ID by name. With linking and/or library overrides, multiple IDs of the same name and type may exist, which is why the session UUID should be used instead. All operators used for dropping support this now and the drop code passes the session UUID instead of the name. Also see 917c096be6b9 and 8f79fa9c6780. Some drop operators were already using the session UUIDs. This converts the remaining ones. The "name" property is kept working as before, since some scripts use this. Side-effect: The "Name" property won't show up in the Adjust Last Operation anymore, which was the case for some of these operators, and its value won't be remembered over multiple executions of the operator. Both were not at all useful from what I can tell, and I doubt this was done intentionally.
Diffstat (limited to 'source/blender/editors/space_node/node_add.cc')
-rw-r--r--source/blender/editors/space_node/node_add.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc
index 9510db9b416..975d4eda7e3 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -303,10 +303,8 @@ static bNodeTree *node_add_group_get_and_poll_group_node_tree(Main *bmain,
wmOperator *op,
bNodeTree *ntree)
{
- char name[MAX_ID_NAME - 2];
- RNA_string_get(op->ptr, "name", name);
-
- bNodeTree *node_group = (bNodeTree *)BKE_libblock_find_name(bmain, ID_NT, name);
+ bNodeTree *node_group = reinterpret_cast<bNodeTree *>(
+ WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_NT));
if (!node_group) {
return nullptr;
}
@@ -423,7 +421,7 @@ void NODE_OT_add_group(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Data-block name to assign");
+ WM_operator_properties_id_lookup(ot, true);
}
/** \} */
@@ -721,7 +719,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH,
FILE_DEFAULTDISPLAY,
FILE_SORT_DEFAULT);
- RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Data-block name to assign");
+ WM_operator_properties_id_lookup(ot, true);
}
/** \} */