Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_add.c
| Show First 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | static int new_node_tree_exec(bContext *C, wmOperator *op) | ||||
| if (!ntreeTypeFind(idname)) { | if (!ntreeTypeFind(idname)) { | ||||
| BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname); | BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ntree = ntreeAddTree(bmain, treename, idname); | ntree = ntreeAddTree(bmain, treename, idname); | ||||
| /* hook into UI */ | /* hook into UI */ | ||||
| uiIDContextProperty(C, &ptr, &prop); | UI_context_active_but_prop_get_templateID(C, &ptr, &prop); | ||||
| if (prop) { | if (prop) { | ||||
| /* RNA_property_pointer_set increases the user count, | /* RNA_property_pointer_set increases the user count, | ||||
| * fixed here as the editor is the initial user. | * fixed here as the editor is the initial user. | ||||
| */ | */ | ||||
| ntree->id.us--; | ntree->id.us--; | ||||
| RNA_id_pointer_create(&ntree->id, &idptr); | RNA_id_pointer_create(&ntree->id, &idptr); | ||||
| Show All 37 Lines | |||||