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 4,019 Lines • ▼ Show 20 Lines | static void def_sh_tex_wireframe(StructRNA *srna) | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); | RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); | ||||
| RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units"); | RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units"); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| } | } | ||||
| static void def_sh_tex_pointdensity(StructRNA *srna) | static void def_sh_tex_pointdensity(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | |||||
| static EnumPropertyItem point_source_items[] = { | static EnumPropertyItem point_source_items[] = { | ||||
| {SHD_POINTDENSITY_SOURCE_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", | {SHD_POINTDENSITY_SOURCE_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", | ||||
| "Generate point density from a particle system"}, | "Generate point density from a particle system"}, | ||||
| {SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices", | {SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices", | ||||
| "Generate point density from an object's vertices"}, | "Generate point density from an object's vertices"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | static void def_sh_tex_pointdensity(StructRNA *srna) | ||||
| RNA_def_pointer(func, "scene", "Scene", "", ""); | RNA_def_pointer(func, "scene", "Scene", "", ""); | ||||
| RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | ||||
| func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc"); | func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc"); | ||||
| RNA_def_function_ui_description(func, "Calculate point density"); | RNA_def_function_ui_description(func, "Calculate point density"); | ||||
| RNA_def_pointer(func, "scene", "Scene", "", ""); | RNA_def_pointer(func, "scene", "Scene", "", ""); | ||||
| RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | ||||
| /* TODO, See how array size of 0 works, this shouldnt be used. */ | /* TODO, See how array size of 0 works, this shouldnt be used. */ | ||||
| prop = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0); | parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0); | ||||
| RNA_def_property_flag(prop, PROP_DYNAMIC); | RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); | ||||
| RNA_def_function_output(func, prop); | RNA_def_function_output(func, parm); | ||||
| func = RNA_def_function(srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax"); | func = RNA_def_function(srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax"); | ||||
| RNA_def_function_ui_description(func, "Calculate point density"); | RNA_def_function_ui_description(func, "Calculate point density"); | ||||
| RNA_def_pointer(func, "scene", "Scene", "", ""); | RNA_def_pointer(func, "scene", "Scene", "", ""); | ||||
| RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); | ||||
| prop = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS); | parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS); | ||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(parm, 3); | ||||
| RNA_def_property_flag(prop, PROP_THICK_WRAP); | RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); | ||||
| RNA_def_function_output(func, prop); | RNA_def_function_output(func, parm); | ||||
| prop = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS); | parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS); | ||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(parm, 3); | ||||
| RNA_def_property_flag(prop, PROP_THICK_WRAP); | RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); | ||||
| RNA_def_function_output(func, prop); | RNA_def_function_output(func, parm); | ||||
| } | } | ||||
| static void def_glossy(StructRNA *srna) | static void def_glossy(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "custom1"); | RNA_def_property_enum_sdna(prop, NULL, "custom1"); | ||||
| ▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | static void def_sh_script(StructRNA *srna) | ||||
| RNA_def_struct_sdna_from(srna, "bNode", NULL); | RNA_def_struct_sdna_from(srna, "bNode", NULL); | ||||
| /* API functions */ | /* API functions */ | ||||
| #if 0 /* XXX TODO use general node api for this */ | #if 0 /* XXX TODO use general node api for this */ | ||||
| func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket"); | func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket"); | ||||
| RNA_def_function_ui_description(func, "Find a socket by name"); | RNA_def_function_ui_description(func, "Find a socket by name"); | ||||
| parm = RNA_def_string(func, "name", NULL, 0, "Socket name", ""); | parm = RNA_def_string(func, "name", NULL, 0, "Socket name", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output"); | /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output"); | ||||
| parm = RNA_def_pointer(func, "result", "NodeSocket", "", ""); | parm = RNA_def_pointer(func, "result", "NodeSocket", "", ""); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket"); | func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket"); | ||||
| RNA_def_function_ui_description(func, "Add a socket socket"); | RNA_def_function_ui_description(func, "Add a socket socket"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_string(func, "name", NULL, 0, "Name", ""); | parm = RNA_def_string(func, "name", NULL, 0, "Name", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", ""); | parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output"); | /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output"); | ||||
| parm = RNA_def_pointer(func, "result", "NodeSocket", "", ""); | parm = RNA_def_pointer(func, "result", "NodeSocket", "", ""); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket"); | func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket"); | ||||
| RNA_def_function_ui_description(func, "Remove a socket socket"); | RNA_def_function_ui_description(func, "Remove a socket socket"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", ""); | parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* -- Compositor Nodes ------------------------------------------------------ */ | /* -- Compositor Nodes ------------------------------------------------------ */ | ||||
| static void def_cmp_alpha_over(StructRNA *srna) | static void def_cmp_alpha_over(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, PropertyRNA *cprop, const char *struct_name) | ||||
| srna = RNA_def_struct(brna, struct_name, NULL); | srna = RNA_def_struct(brna, struct_name, NULL); | ||||
| RNA_def_struct_sdna(srna, "bNode"); | RNA_def_struct_sdna(srna, "bNode"); | ||||
| RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots"); | RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots"); | ||||
| func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new"); | func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new"); | ||||
| RNA_def_function_ui_description(func, "Add a file slot to this node"); | RNA_def_function_ui_description(func, "Add a file slot to this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_CONTEXT); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_CONTEXT); | ||||
| parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* NB: methods below can use the standard node socket API functions, | /* NB: methods below can use the standard node socket API functions, | ||||
| * included here for completeness. | * included here for completeness. | ||||
| */ | */ | ||||
| func = RNA_def_function(srna, "remove", "rna_Node_socket_remove"); | func = RNA_def_function(srna, "remove", "rna_Node_socket_remove"); | ||||
| RNA_def_function_ui_description(func, "Remove a file slot from this node"); | RNA_def_function_ui_description(func, "Remove a file slot from this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear"); | func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear"); | ||||
| RNA_def_function_ui_description(func, "Remove all file slots from this node"); | RNA_def_function_ui_description(func, "Remove all file slots from this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| func = RNA_def_function(srna, "move", "rna_Node_inputs_move"); | func = RNA_def_function(srna, "move", "rna_Node_inputs_move"); | ||||
| RNA_def_function_ui_description(func, "Move a file slot to another position"); | RNA_def_function_ui_description(func, "Move a file slot to another position"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| } | } | ||||
| static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna) | static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage"); | RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage"); | ||||
| prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH); | prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH); | ||||
| ▲ Show 20 Lines • Show All 2,069 Lines • ▼ Show 20 Lines | static void rna_def_node_socket(BlenderRNA *brna) | ||||
| 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", ""); | ||||
| /* draw socket */ | /* draw socket */ | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw socket"); | RNA_def_function_ui_description(func, "Draw socket"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "Node"); | RNA_def_property_struct_type(parm, "Node"); | ||||
| RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE); | parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties"); | RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties"); | ||||
| // RNA_def_property_string_default(parm, ""); | // RNA_def_property_string_default(parm, ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "draw_color", NULL); | func = RNA_def_function(srna, "draw_color", NULL); | ||||
| RNA_def_function_ui_description(func, "Color of the socket icon"); | RNA_def_function_ui_description(func, "Color of the socket icon"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "Node"); | RNA_def_property_struct_type(parm, "Node"); | ||||
| RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| } | } | ||||
| static void rna_def_node_socket_interface(BlenderRNA *brna) | static void rna_def_node_socket_interface(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| Show All 34 Lines | static void rna_def_node_socket_interface(BlenderRNA *brna) | ||||
| 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", ""); | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw template settings"); | RNA_def_function_ui_description(func, "Draw template settings"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "draw_color", NULL); | func = RNA_def_function(srna, "draw_color", NULL); | ||||
| RNA_def_function_ui_description(func, "Color of the socket icon"); | RNA_def_function_ui_description(func, "Color of the socket icon"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| func = RNA_def_function(srna, "register_properties", NULL); | func = RNA_def_function(srna, "register_properties", NULL); | ||||
| RNA_def_function_ui_description(func, "Define RNA properties of a socket"); | RNA_def_function_ui_description(func, "Define RNA properties of a socket"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties"); | parm = RNA_def_pointer(func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "init_socket", NULL); | func = RNA_def_function(srna, "init_socket", NULL); | ||||
| RNA_def_function_ui_description(func, "Initialize a node socket instance"); | RNA_def_function_ui_description(func, "Initialize a node socket instance"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize"); | parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data"); | parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "from_socket", NULL); | func = RNA_def_function(srna, "from_socket", NULL); | ||||
| RNA_def_function_ui_description(func, "Setup template parameters from an existing socket"); | RNA_def_function_ui_description(func, "Setup template parameters from an existing socket"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket"); | parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| } | } | ||||
| static void rna_def_node_socket_float(BlenderRNA *brna, const char *idname, const char *interface_idname, PropertySubType subtype) | static void rna_def_node_socket_float(BlenderRNA *brna, const char *idname, const char *interface_idname, PropertySubType subtype) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| float value_default; | float value_default; | ||||
| ▲ Show 20 Lines • Show All 318 Lines • ▼ Show 20 Lines | static void rna_def_node_socket_standard_types(BlenderRNA *brna) | ||||
| srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket"); | srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket"); | ||||
| RNA_def_struct_sdna(srna, "bNodeSocket"); | RNA_def_struct_sdna(srna, "bNodeSocket"); | ||||
| /* draw socket */ | /* draw socket */ | ||||
| func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw"); | func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| RNA_def_function_ui_description(func, "Draw socket"); | RNA_def_function_ui_description(func, "Draw socket"); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "Node"); | RNA_def_property_struct_type(parm, "Node"); | ||||
| RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE); | parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties"); | RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties"); | ||||
| // RNA_def_property_string_default(parm, ""); | // RNA_def_property_string_default(parm, ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color"); | func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| RNA_def_function_ui_description(func, "Color of the socket icon"); | RNA_def_function_ui_description(func, "Color of the socket icon"); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "Node"); | RNA_def_property_struct_type(parm, "Node"); | ||||
| RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface"); | srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface"); | ||||
| RNA_def_struct_sdna(srna, "bNodeSocket"); | RNA_def_struct_sdna(srna, "bNodeSocket"); | ||||
| /* for easier type comparison in python */ | /* for easier type comparison in python */ | ||||
| prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type"); | RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type"); | ||||
| RNA_def_property_enum_items(prop, node_socket_type_items); | RNA_def_property_enum_items(prop, node_socket_type_items); | ||||
| RNA_def_property_enum_default(prop, SOCK_FLOAT); | RNA_def_property_enum_default(prop, SOCK_FLOAT); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Type", "Data type"); | RNA_def_property_ui_text(prop, "Type", "Data type"); | ||||
| func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw"); | func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| RNA_def_function_ui_description(func, "Draw template settings"); | RNA_def_function_ui_description(func, "Draw template settings"); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color"); | func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| RNA_def_function_ui_description(func, "Color of the socket icon"); | RNA_def_function_ui_description(func, "Color of the socket icon"); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| /* XXX These types should eventually be registered at runtime. | /* XXX These types should eventually be registered at runtime. | ||||
| * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions | * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions | ||||
| * to get the idname strings from int type and subtype (see node_socket.c, register_standard_node_socket_types). | * to get the idname strings from int type and subtype (see node_socket.c, register_standard_node_socket_types). | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | static void rna_def_internal_node(BlenderRNA *brna) | ||||
| RNA_def_struct_sdna(srna, "bNode"); | RNA_def_struct_sdna(srna, "bNode"); | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll"); | func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll"); | ||||
| RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree"); | RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | ||||
| parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance"); | func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance"); | ||||
| RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree"); | RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree"); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | ||||
| parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* update */ | /* update */ | ||||
| func = RNA_def_function(srna, "update", "rna_NodeInternal_update"); | func = RNA_def_function(srna, "update", "rna_NodeInternal_update"); | ||||
| RNA_def_function_ui_description(func, "Update on editor changes"); | RNA_def_function_ui_description(func, "Update on editor changes"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE); | ||||
| /* draw buttons */ | /* draw buttons */ | ||||
| func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons"); | func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons"); | ||||
| RNA_def_function_ui_description(func, "Draw node buttons"); | RNA_def_function_ui_description(func, "Draw node buttons"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* draw buttons extended */ | /* draw buttons extended */ | ||||
| func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext"); | func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext"); | ||||
| RNA_def_function_ui_description(func, "Draw node buttons in the sidebar"); | RNA_def_function_ui_description(func, "Draw node buttons in the sidebar"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| } | } | ||||
| static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) | static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs"); | const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs"); | ||||
| const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs"); | const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs"); | ||||
| const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new"); | const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new"); | ||||
| const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear"); | const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear"); | ||||
| const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move"); | const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move"); | ||||
| RNA_def_property_srna(cprop, structtype); | RNA_def_property_srna(cprop, structtype); | ||||
| srna = RNA_def_struct(brna, structtype, NULL); | srna = RNA_def_struct(brna, structtype, NULL); | ||||
| RNA_def_struct_sdna(srna, "bNode"); | RNA_def_struct_sdna(srna, "bNode"); | ||||
| RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets"); | RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets"); | ||||
| func = RNA_def_function(srna, "new", newfunc); | func = RNA_def_function(srna, "new", newfunc); | ||||
| RNA_def_function_ui_description(func, "Add a socket to this node"); | RNA_def_function_ui_description(func, "Add a socket to this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | ||||
| parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type"); | parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier"); | RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier"); | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_Node_socket_remove"); | func = RNA_def_function(srna, "remove", "rna_Node_socket_remove"); | ||||
| RNA_def_function_ui_description(func, "Remove a socket from this node"); | RNA_def_function_ui_description(func, "Remove a socket from this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove"); | parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "clear", clearfunc); | func = RNA_def_function(srna, "clear", clearfunc); | ||||
| RNA_def_function_ui_description(func, "Remove all sockets from this node"); | RNA_def_function_ui_description(func, "Remove all sockets from this node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| func = RNA_def_function(srna, "move", movefunc); | func = RNA_def_function(srna, "move", movefunc); | ||||
| RNA_def_function_ui_description(func, "Move a socket to another position"); | RNA_def_function_ui_description(func, "Move a socket to another position"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| } | } | ||||
| static void rna_def_node(BlenderRNA *brna) | static void rna_def_node(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| ▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | static void rna_def_node(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Show Texture", "Draw node in viewport textured draw mode"); | RNA_def_property_ui_text(prop, "Show Texture", "Draw node in viewport textured draw mode"); | ||||
| RNA_def_property_update(prop, 0, "rna_Node_update"); | RNA_def_property_update(prop, 0, "rna_Node_update"); | ||||
| /* generic property update function */ | /* generic property update function */ | ||||
| func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update"); | func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update"); | ||||
| RNA_def_function_ui_description(func, "Update after property changes"); | RNA_def_function_ui_description(func, "Update after property changes"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | RNA_def_function_flag(func, FUNC_USE_SELF_ID); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type"); | func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type"); | ||||
| RNA_def_function_ui_description(func, "True if a registered node type"); | RNA_def_function_ui_description(func, "True if a registered node type"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | ||||
| parm = RNA_def_boolean(func, "result", false, "Result", ""); | parm = RNA_def_boolean(func, "result", false, "Result", ""); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| prop = RNA_def_property(srna, "shading_compatibility", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "shading_compatibility", PROP_ENUM, PROP_NONE); | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | static void rna_def_node(BlenderRNA *brna) | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", NULL); | func = RNA_def_function(srna, "poll", NULL); | ||||
| RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree"); | RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | ||||
| parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "poll_instance", NULL); | func = RNA_def_function(srna, "poll_instance", NULL); | ||||
| RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree"); | RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | ||||
| parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* update */ | /* update */ | ||||
| func = RNA_def_function(srna, "update", NULL); | func = RNA_def_function(srna, "update", NULL); | ||||
| RNA_def_function_ui_description(func, "Update on editor changes"); | RNA_def_function_ui_description(func, "Update on editor changes"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| /* insert_link */ | /* insert_link */ | ||||
| func = RNA_def_function(srna, "insert_link", NULL); | func = RNA_def_function(srna, "insert_link", NULL); | ||||
| RNA_def_function_ui_description(func, "Handle creation of a link to or from the node"); | RNA_def_function_ui_description(func, "Handle creation of a link to or from the node"); | ||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted"); | parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* init */ | /* init */ | ||||
| func = RNA_def_function(srna, "init", NULL); | func = RNA_def_function(srna, "init", NULL); | ||||
| RNA_def_function_ui_description(func, "Initialize a new instance of this node"); | RNA_def_function_ui_description(func, "Initialize a new instance of this node"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* copy */ | /* copy */ | ||||
| func = RNA_def_function(srna, "copy", NULL); | func = RNA_def_function(srna, "copy", NULL); | ||||
| RNA_def_function_ui_description(func, "Initialize a new instance of this node from an existing node"); | RNA_def_function_ui_description(func, "Initialize a new instance of this node from an existing node"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy"); | parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* free */ | /* free */ | ||||
| func = RNA_def_function(srna, "free", NULL); | func = RNA_def_function(srna, "free", NULL); | ||||
| RNA_def_function_ui_description(func, "Clean up node on removal"); | RNA_def_function_ui_description(func, "Clean up node on removal"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| /* draw buttons */ | /* draw buttons */ | ||||
| func = RNA_def_function(srna, "draw_buttons", NULL); | func = RNA_def_function(srna, "draw_buttons", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw node buttons"); | RNA_def_function_ui_description(func, "Draw node buttons"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* draw buttons extended */ | /* draw buttons extended */ | ||||
| func = RNA_def_function(srna, "draw_buttons_ext", NULL); | func = RNA_def_function(srna, "draw_buttons_ext", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw node buttons in the sidebar"); | RNA_def_function_ui_description(func, "Draw node buttons in the sidebar"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "UILayout"); | RNA_def_property_struct_type(parm, "UILayout"); | ||||
| RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | RNA_def_property_ui_text(parm, "Layout", "Layout in the UI"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* dynamic label */ | /* dynamic label */ | ||||
| func = RNA_def_function(srna, "draw_label", NULL); | func = RNA_def_function(srna, "draw_label", NULL); | ||||
| RNA_def_function_ui_description(func, "Returns a dynamic label string"); | RNA_def_function_ui_description(func, "Returns a dynamic label string"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", ""); | parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", ""); | ||||
| RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ | RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| } | } | ||||
| static void rna_def_node_link(BlenderRNA *brna) | static void rna_def_node_link(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| func = RNA_def_function(srna, "new", "rna_NodeTree_node_new"); | func = RNA_def_function(srna, "new", "rna_NodeTree_node_new"); | ||||
| RNA_def_function_ui_description(func, "Add a node to this node tree"); | RNA_def_function_ui_description(func, "Add a node to this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | ||||
| /* XXX warning note should eventually be removed, | /* XXX warning note should eventually be removed, | ||||
| * added this here to avoid frequent confusion with API changes from "type" to "bl_idname" | * added this here to avoid frequent confusion with API changes from "type" to "bl_idname" | ||||
| */ | */ | ||||
| parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)"); | parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_pointer(func, "node", "Node", "", "New node"); | parm = RNA_def_pointer(func, "node", "Node", "", "New node"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove"); | func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove"); | ||||
| RNA_def_function_ui_description(func, "Remove a node from this node tree"); | RNA_def_function_ui_description(func, "Remove a node from this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove"); | parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | ||||
| func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear"); | func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear"); | ||||
| RNA_def_function_ui_description(func, "Remove all nodes from this node tree"); | RNA_def_function_ui_description(func, "Remove all nodes from this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Node"); | RNA_def_property_struct_type(prop, "Node"); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL); | ||||
| Show All 12 Lines | static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| srna = RNA_def_struct(brna, "NodeLinks", NULL); | srna = RNA_def_struct(brna, "NodeLinks", NULL); | ||||
| RNA_def_struct_sdna(srna, "bNodeTree"); | RNA_def_struct_sdna(srna, "bNodeTree"); | ||||
| RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links"); | RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links"); | ||||
| func = RNA_def_function(srna, "new", "rna_NodeTree_link_new"); | func = RNA_def_function(srna, "new", "rna_NodeTree_link_new"); | ||||
| RNA_def_function_ui_description(func, "Add a node link to this node tree"); | RNA_def_function_ui_description(func, "Add a node link to this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket"); | parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket"); | parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| RNA_def_boolean(func, "verify_limits", true, "Verify Limits", "Remove existing links if connection limit is exceeded"); | RNA_def_boolean(func, "verify_limits", true, "Verify Limits", "Remove existing links if connection limit is exceeded"); | ||||
| /* return */ | /* return */ | ||||
| parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link"); | parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove"); | func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove"); | ||||
| RNA_def_function_ui_description(func, "remove a node link from the node tree"); | RNA_def_function_ui_description(func, "remove a node link from the node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove"); | parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | ||||
| func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear"); | func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear"); | ||||
| RNA_def_function_ui_description(func, "remove all node links from the node tree"); | RNA_def_function_ui_description(func, "remove all node links from the node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| } | } | ||||
| static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) | static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) | ||||
| { | { | ||||
| Show All 10 Lines | static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) | ||||
| srna = RNA_def_struct(brna, structtype, NULL); | srna = RNA_def_struct(brna, structtype, NULL); | ||||
| RNA_def_struct_sdna(srna, "bNodeTree"); | RNA_def_struct_sdna(srna, "bNodeTree"); | ||||
| RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets"); | RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets"); | ||||
| func = RNA_def_function(srna, "new", newfunc); | func = RNA_def_function(srna, "new", newfunc); | ||||
| RNA_def_function_ui_description(func, "Add a socket to this node tree"); | RNA_def_function_ui_description(func, "Add a socket to this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type"); | parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket"); | parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove"); | func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove"); | ||||
| RNA_def_function_ui_description(func, "Remove a socket from this node tree"); | RNA_def_function_ui_description(func, "Remove a socket from this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove"); | parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "clear", clearfunc); | func = RNA_def_function(srna, "clear", clearfunc); | ||||
| RNA_def_function_ui_description(func, "Remove all sockets from this node tree"); | RNA_def_function_ui_description(func, "Remove all sockets from this node tree"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| func = RNA_def_function(srna, "move", movefunc); | func = RNA_def_function(srna, "move", movefunc); | ||||
| RNA_def_function_ui_description(func, "Move a socket to another position"); | RNA_def_function_ui_description(func, "Move a socket to another position"); | ||||
| parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| } | } | ||||
| static void rna_def_nodetree(BlenderRNA *brna) | static void rna_def_nodetree(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | static void rna_def_nodetree(BlenderRNA *brna) | ||||
| RNA_def_property_int_funcs(prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL); | RNA_def_property_int_funcs(prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL); | ||||
| RNA_def_property_ui_text(prop, "Active Output", "Index of the active output"); | RNA_def_property_ui_text(prop, "Active Output", "Index of the active output"); | ||||
| 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_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* 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); | ||||
| Show All 12 Lines | static void rna_def_nodetree(BlenderRNA *brna) | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_property_ui_text(prop, "Icon", "The node tree icon"); | RNA_def_property_ui_text(prop, "Icon", "The node tree icon"); | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", NULL); | func = RNA_def_function(srna, "poll", NULL); | ||||
| RNA_def_function_ui_description(func, "Check visibility in the editor"); | RNA_def_function_ui_description(func, "Check visibility in the editor"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", "")); | ||||
| /* update */ | /* update */ | ||||
| func = RNA_def_function(srna, "update", NULL); | func = RNA_def_function(srna, "update", NULL); | ||||
| RNA_def_function_ui_description(func, "Update on editor changes"); | RNA_def_function_ui_description(func, "Update on editor changes"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| /* get a node tree from context */ | /* get a node tree from context */ | ||||
| func = RNA_def_function(srna, "get_from_context", NULL); | func = RNA_def_function(srna, "get_from_context", NULL); | ||||
| RNA_def_function_ui_description(func, "Get a node tree from the context"); | RNA_def_function_ui_description(func, "Get a node tree from the context"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "result_1", "NodeTree", "Node Tree", "Active node tree from context"); | parm = RNA_def_pointer(func, "result_1", "NodeTree", "Node Tree", "Active node tree from context"); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree"); | parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree"); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); | parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | static StructRNA *define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name, | ||||
| /* Exposes the socket template type lists in RNA for use in scripts | /* Exposes the socket template type lists in RNA for use in scripts | ||||
| * Only used in the C nodes and not exposed in the base class to keep the namespace clean for pynodes. | * Only used in the C nodes and not exposed in the base class to keep the namespace clean for pynodes. | ||||
| */ | */ | ||||
| func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template"); | func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template"); | ||||
| RNA_def_function_ui_description(func, "Input socket template"); | RNA_def_function_ui_description(func, "Input socket template"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | ||||
| parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED); | parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_ui_text(parm, "Index", ""); | RNA_def_property_ui_text(parm, "Index", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate"); | RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate"); | ||||
| RNA_def_property_flag(parm, PROP_RNAPTR); | RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template"); | func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template"); | ||||
| RNA_def_function_ui_description(func, "Output socket template"); | RNA_def_function_ui_description(func, "Output socket template"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE); | ||||
| parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED); | parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_ui_text(parm, "Index", ""); | RNA_def_property_ui_text(parm, "Index", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE); | parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate"); | RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate"); | ||||
| RNA_def_property_flag(parm, PROP_RNAPTR); | RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| if (def_func) | if (def_func) | ||||
| def_func(srna); | def_func(srna); | ||||
| return srna; | return srna; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||