Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 1,429 Lines • ▼ Show 20 Lines | static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value) | ||||
| bNodeTree *ntree = (bNodeTree *)ptr->data; | bNodeTree *ntree = (bNodeTree *)ptr->data; | ||||
| int index = 0; | int index = 0; | ||||
| LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) { | LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &ntree->outputs, index) { | ||||
| SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT); | SET_FLAG_FROM_TEST(socket->flag, index == value, SELECT); | ||||
| } | } | ||||
| } | } | ||||
| static bool rna_NodeTree_contains_in(bNodeTree *tree, bNodeTree *parent_tree) | |||||
| { | |||||
| return ntreeContainsTree(parent_tree, tree); | |||||
| } | |||||
| static bNodeSocket *rna_NodeTree_inputs_new( | static bNodeSocket *rna_NodeTree_inputs_new( | ||||
| bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name) | bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name) | ||||
| { | { | ||||
| if (!rna_NodeTree_check(ntree, reports)) { | if (!rna_NodeTree_check(ntree, reports)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| bNodeSocket *sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name); | bNodeSocket *sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name); | ||||
| ▲ Show 20 Lines • Show All 11,266 Lines • ▼ Show 20 Lines | static void rna_def_nodetree(BlenderRNA *brna) | ||||
| RNA_def_property_update(prop, NC_NODE, NULL); | RNA_def_property_update(prop, NC_NODE, NULL); | ||||
| /* exposed as a function for runtime interface type properties */ | /* exposed as a function for runtime interface type properties */ | ||||
| func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update"); | func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update"); | ||||
| RNA_def_function_ui_description(func, "Updated node group interface"); | RNA_def_function_ui_description(func, "Updated node group interface"); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* Test to check if current node tree contained in parent_tree. | |||||
| * Generally use to avoid creating recursive nodegroups. | |||||
| */ | |||||
HooglyBoogly: This comment can be moved to the function's description. Suggestion: `Check if the node tree… | |||||
| func = RNA_def_function(srna, "contains_in", "rna_NodeTree_contains_in"); | |||||
HooglyBooglyUnsubmitted Done Inline Actionscontains_in -> contains_group HooglyBoogly: `contains_in` -> `contains_group` | |||||
ModerAuthorUnsubmitted Done Inline ActionsA . contains_in . B mean, that searching in B group try to find A group. Moder: `A` . `contains_in` . `B` mean, that searching in `B` group try to find `A` group.
but
`A` . | |||||
HooglyBooglyUnsubmitted Done Inline ActionsI think contains_group is clearer. The function acts like a question-- "Does A contain B". A is the subject and B is the direct object. "contains_in" sounds like incorrect grammar IMO HooglyBoogly: I think `contains_group` is clearer. The function acts like a question-- "Does A contain B". A… | |||||
| RNA_def_function_ui_description( | |||||
| func, "Recursively check if this node group contained in other node group"); | |||||
| parm = RNA_def_pointer( | |||||
| func, "parent_tree", "NodeTree", "Node Group", "Node group for recursive check"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | |||||
| parm = RNA_def_property(func, "contained", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_function_return(func, parm); | |||||
| /* registration */ | /* registration */ | ||||
| prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname"); | RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname"); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_property_ui_text(prop, "ID Name", ""); | RNA_def_property_ui_text(prop, "ID Name", ""); | ||||
| prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name"); | RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name"); | ||||
| ▲ Show 20 Lines • Show All 312 Lines • Show Last 20 Lines | |||||
This comment can be moved to the function's description. Suggestion: Check if the node tree contains another. Used to avoid creating recursive node groups