diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 187 |
1 files changed, 39 insertions, 148 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 3237f33835e..e91b0d860c6 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -55,7 +55,7 @@ #include "MEM_guardedalloc.h" -#include "RE_render_ext.h" +#include "RE_texture.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" @@ -84,21 +84,6 @@ static const EnumPropertyItem node_socket_type_items[] = { {SOCK_SHADER, "SHADER", 0, "Shader", ""}, {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, - {SOCK_EMITTERS, "EMITTERS", 0, "Emitters", ""}, - {SOCK_EVENTS, "EVENTS", 0, "Events", ""}, - {SOCK_FORCES, "FORCES", 0, "Forces", ""}, - {SOCK_CONTROL_FLOW, "CONTROL_FLOW", 0, "Control Flow", ""}, - {0, NULL, 0, NULL, NULL}, -}; - -static const EnumPropertyItem particle_attribute_socket_type_items[] = { - {SOCK_FLOAT, "FLOAT", 0, "Float", ""}, - {SOCK_INT, "INT", 0, "Int", ""}, - {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""}, - {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, - {SOCK_RGBA, "RGBA", 0, "Color", ""}, - {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, - {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -3244,7 +3229,7 @@ static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) while (rl) { tmp.identifier = rl->name; /* Little trick: using space char instead empty string - * makes the item selectable in the dropdown. */ + * makes the item selectable in the drop-down. */ if (rl->name[0] == '\0') { tmp.name = " "; } @@ -3320,7 +3305,7 @@ static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) while (rv) { tmp.identifier = rv->name; /* Little trick: using space char instead empty string - * makes the item selectable in the dropdown. */ + * makes the item selectable in the drop-down. */ if (rv->name[0] == '\0') { tmp.name = " "; } @@ -3758,15 +3743,6 @@ static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA rna_Node_update(bmain, scene, ptr); } -static void rna_SimulationNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - bNode *node = (bNode *)ptr->data; - - nodeUpdate(ntree, node); - rna_Node_update(bmain, scene, ptr); -} - static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr) { bNode *node = ptr->data; @@ -4386,10 +4362,38 @@ static void def_sh_vector_rotate(StructRNA *srna) static void def_sh_attribute(StructRNA *srna) { + static const EnumPropertyItem prop_attribute_type[] = { + {SHD_ATTRIBUTE_GEOMETRY, + "GEOMETRY", + 0, + "Geometry", + "The attribute is associated with the object geometry, and its value " + "varies from vertex to vertex, or within the object volume"}, + {SHD_ATTRIBUTE_OBJECT, + "OBJECT", + 0, + "Object", + "The attribute is associated with the object or mesh datablock itself, " + "and its value is uniform"}, + {SHD_ATTRIBUTE_INSTANCER, + "INSTANCER", + 0, + "Instancer", + "The attribute is associated with the instancer particle system or object, " + "falling back to the Object mode if the attribute isn't found, or the object " + "is not instanced"}, + {0, NULL, 0, NULL, NULL}, + }; PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage"); + prop = RNA_def_property(srna, "attribute_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_attribute_type); + RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Attribute Name", ""); @@ -4812,7 +4816,7 @@ static void def_sh_tex_voronoi(StructRNA *srna) {SHD_VORONOI_DISTANCE_TO_EDGE, "DISTANCE_TO_EDGE", 0, - "Distance To Edge", + "Distance to Edge", "Computes the distance to the edge of the voronoi cell"}, {SHD_VORONOI_N_SPHERE_RADIUS, "N_SPHERE_RADIUS", @@ -7114,7 +7118,7 @@ static void def_cmp_lensdist(StructRNA *srna) static void def_cmp_colorbalance(StructRNA *srna) { PropertyRNA *prop; - static float default_1[3] = {1.f, 1.f, 1.f}; + static float default_1[3] = {1.0f, 1.0f, 1.0f}; static const EnumPropertyItem type_items[] = { {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""}, @@ -7169,7 +7173,7 @@ static void def_cmp_colorbalance(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "power"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_1); - RNA_def_property_range(prop, 0.f, FLT_MAX); + RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); RNA_def_property_ui_text(prop, "Power", "Correction for Midtones"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl"); @@ -7178,7 +7182,7 @@ static void def_cmp_colorbalance(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "slope"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_1); - RNA_def_property_range(prop, 0.f, FLT_MAX); + RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl"); @@ -7749,15 +7753,15 @@ static void def_cmp_viewer(StructRNA *srna) static const EnumPropertyItem tileorder_items[] = { {0, "CENTEROUT", 0, "Center", "Expand from center"}, {1, "RANDOM", 0, "Random", "Random tiles"}, - {2, "BOTTOMUP", 0, "Bottom up", "Expand from bottom"}, - {3, "RULE_OF_THIRDS", 0, "Rule of thirds", "Expand from 9 places"}, + {2, "BOTTOMUP", 0, "Bottom Up", "Expand from bottom"}, + {3, "RULE_OF_THIRDS", 0, "Rule of Thirds", "Expand from 9 places"}, {0, NULL, 0, NULL, NULL}, }; prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, tileorder_items); - RNA_def_property_ui_text(prop, "Tile order", "Tile order"); + RNA_def_property_ui_text(prop, "Tile Order", "Tile order"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE); @@ -8061,7 +8065,7 @@ static void def_cmp_sunbeams(StructRNA *srna) static void def_cmp_cryptomatte(StructRNA *srna) { PropertyRNA *prop; - static float default_1[3] = {1.f, 1.f, 1.f}; + static float default_1[3] = {1.0f, 1.0f, 1.0f}; RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage"); prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE); @@ -8164,82 +8168,6 @@ static void def_tex_bricks(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } -/* -- Simulation Nodes --------------------------------------------------------- */ - -static void def_sim_particle_time_step_event(StructRNA *srna) -{ - static const EnumPropertyItem mode_items[] = { - {NODE_PARTICLE_TIME_STEP_EVENT_BEGIN, - "BEGIN", - 0, - "Begin", - "Execute for every particle at the beginning of each time step"}, - {NODE_PARTICLE_TIME_STEP_EVENT_END, - "END", - 0, - "End", - "Execute for every particle at the end of each time step"}, - {0, NULL, 0, NULL, NULL}, - }; - - PropertyRNA *prop; - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, mode_items); - RNA_def_property_ui_text(prop, "Mode", "When in each time step is the event triggered"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); -} - -static void def_sim_particle_attribute(StructRNA *srna) -{ - PropertyRNA *prop; - - prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, particle_attribute_socket_type_items); - RNA_def_property_ui_text( - prop, - "Data Type", - "Expected type of the attribute. A default value is returned if the type is not correct"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_SimulationNode_socket_update"); -} - -static void def_sim_set_particle_attribute(StructRNA *srna) -{ - PropertyRNA *prop; - - prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, particle_attribute_socket_type_items); - RNA_def_property_ui_text( - prop, - "Data Type", - "Expected type of the attribute. Nothing is done if the type is not correct"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_SimulationNode_socket_update"); -} - -static void def_sim_time(StructRNA *srna) -{ - static const EnumPropertyItem mode_items[] = { - {NODE_SIM_INPUT_SIMULATION_TIME, - "SIMULATION_TIME", - 0, - "Simulation Time", - "Time since start of simulation"}, - {NODE_SIM_INPUT_SCENE_TIME, "SCENE_TIME", 0, "Scene Time", "Time shown in the timeline"}, - {0, NULL, 0, NULL, NULL}, - }; - - PropertyRNA *prop; - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, mode_items); - RNA_def_property_ui_text(prop, "Mode", "The time to output"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_SimulationNode_socket_update"); -} - /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) @@ -8931,36 +8859,6 @@ static void rna_def_node_socket_image(BlenderRNA *brna, RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); } -static void rna_def_node_socket_effector(BlenderRNA *brna, - const char *identifier, - const char *interface_idname) -{ - StructRNA *srna; - - srna = RNA_def_struct(brna, identifier, "NodeSocketStandard"); - RNA_def_struct_ui_text(srna, "", ""); - RNA_def_struct_sdna(srna, "bNodeSocket"); - - srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard"); - RNA_def_struct_ui_text(srna, "", ""); - RNA_def_struct_sdna(srna, "bNodeSocket"); -} - -static void rna_def_node_socket_control_flow(BlenderRNA *brna, - const char *identifier, - const char *interface_idname) -{ - StructRNA *srna; - - srna = RNA_def_struct(brna, identifier, "NodeSocketStandard"); - RNA_def_struct_ui_text(srna, "", ""); - RNA_def_struct_sdna(srna, "bNodeSocket"); - - srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard"); - RNA_def_struct_ui_text(srna, "", ""); - RNA_def_struct_sdna(srna, "bNodeSocket"); -} - static void rna_def_node_socket_standard_types(BlenderRNA *brna) { /* XXX Workaround: Registered functions are not exposed in python by bpy, @@ -9099,13 +8997,6 @@ static void rna_def_node_socket_standard_types(BlenderRNA *brna) rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject"); rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage"); - - rna_def_node_socket_effector(brna, "NodeSocketEmitters", "NodeSocketInterfaceEmitters"); - rna_def_node_socket_effector(brna, "NodeSocketEvents", "NodeSocketInterfaceEvents"); - rna_def_node_socket_effector(brna, "NodeSocketForces", "NodeSocketInterfaceForces"); - - rna_def_node_socket_control_flow( - brna, "NodeSocketControlFlow", "NodeSocketInterfaceControlFlow"); } static void rna_def_internal_node(BlenderRNA *brna) |