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,958 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeFill_domain_itemf( | static const EnumPropertyItem *rna_GeometryNodeAttributeFill_domain_itemf( | ||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | ||||
| { | { | ||||
| *r_free = true; | *r_free = true; | ||||
| return itemf_function_check(rna_enum_attribute_domain_items, attribute_fill_domain_supported); | return itemf_function_check(rna_enum_attribute_domain_items, attribute_fill_domain_supported); | ||||
| } | } | ||||
| static bool attribute_math_operation_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return ELEM(item->value, | |||||
| NODE_MATH_ADD, | |||||
| NODE_MATH_SUBTRACT, | |||||
| NODE_MATH_MULTIPLY, | |||||
| NODE_MATH_DIVIDE) && | |||||
| (item->identifier[0] != '\0'); | |||||
| } | |||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeMath_operation_itemf( | |||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | |||||
| *r_free = true; | |||||
| return itemf_function_check(rna_enum_node_math_items, attribute_math_operation_supported); | |||||
| } | |||||
| /** | /** | ||||
| * This bit of ugly code makes sure the float / attribute option shows up instead of | * This bit of ugly code makes sure the float / attribute option shows up instead of | ||||
| * vector / attribute if the node uses an operation that uses a float for input B. | * vector / attribute if the node uses an operation that uses a float for input B. | ||||
| */ | */ | ||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeVectorMath_input_type_b_itemf( | static const EnumPropertyItem *rna_GeometryNodeAttributeVectorMath_input_type_b_itemf( | ||||
| bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | ||||
| { | { | ||||
| bNode *node = ptr->data; | bNode *node = ptr->data; | ||||
| ▲ Show 20 Lines • Show All 2,745 Lines • ▼ Show 20 Lines | static void def_sh_tex_sky(StructRNA *srna) | ||||
| RNA_def_property_float_default(prop, M_PI_2); | RNA_def_property_float_default(prop, M_PI_2); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE); | prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE); | ||||
| RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith"); | RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith"); | ||||
| RNA_def_property_float_default(prop, 0.0f); | RNA_def_property_float_default(prop, 0.0f); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_DISTANCE); | ||||
| RNA_def_property_ui_text(prop, "Altitude", "Height from sea level"); | RNA_def_property_ui_text(prop, "Altitude", "Height from sea level"); | ||||
| RNA_def_property_range(prop, 0.0f, 60.0f); | RNA_def_property_range(prop, 0.0f, 60000.0f); | ||||
| RNA_def_property_ui_range(prop, 0.0f, 60000.0f, 10, 1); | |||||
| RNA_def_property_float_default(prop, 0.0f); | RNA_def_property_float_default(prop, 0.0f); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR); | prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR); | ||||
| RNA_def_property_ui_text(prop, "Air", "Density of air molecules"); | RNA_def_property_ui_text(prop, "Air", "Density of air molecules"); | ||||
| RNA_def_property_range(prop, 0.0f, 10.0f); | RNA_def_property_range(prop, 0.0f, 10.0f); | ||||
| RNA_def_property_float_default(prop, 1.0f); | RNA_def_property_float_default(prop, 1.0f); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| ▲ Show 20 Lines • Show All 3,803 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeAttributeMath", "storage"); | RNA_def_struct_sdna_from(srna, "NodeAttributeMath", "storage"); | ||||
| prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "operation"); | RNA_def_property_enum_sdna(prop, NULL, "operation"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_node_math_items); | RNA_def_property_enum_items(prop, rna_enum_node_math_items); | ||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeMath_operation_itemf"); | |||||
| RNA_def_property_enum_default(prop, NODE_MATH_ADD); | RNA_def_property_enum_default(prop, NODE_MATH_ADD); | ||||
| RNA_def_property_ui_text(prop, "Operation", ""); | RNA_def_property_ui_text(prop, "Operation", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_a"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_a"); | ||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | ||||
| RNA_def_property_ui_text(prop, "Input Type A", ""); | RNA_def_property_ui_text(prop, "Input Type A", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_b"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_b"); | ||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | ||||
| RNA_def_property_ui_text(prop, "Input Type B", ""); | RNA_def_property_ui_text(prop, "Input Type B", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "input_type_c", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_c"); | |||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | |||||
| RNA_def_property_ui_text(prop, "Input Type C", ""); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| } | } | ||||
| static void def_geo_attribute_vector_math(StructRNA *srna) | static void def_geo_attribute_vector_math(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeAttributeVectorMath", "storage"); | RNA_def_struct_sdna_from(srna, "NodeAttributeVectorMath", "storage"); | ||||
| Show All 37 Lines | static const EnumPropertyItem instance_type_items[] = { | ||||
| "COLLECTION", | "COLLECTION", | ||||
| ICON_NONE, | ICON_NONE, | ||||
| "Collection", | "Collection", | ||||
| "Instance an entire collection on all points"}, | "Instance an entire collection on all points"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeGeometryPointInstance", "storage"); | |||||
| prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "custom1"); | RNA_def_property_enum_sdna(prop, NULL, "instance_type"); | ||||
| RNA_def_property_enum_items(prop, instance_type_items); | RNA_def_property_enum_items(prop, instance_type_items); | ||||
| RNA_def_property_enum_default(prop, GEO_NODE_POINT_INSTANCE_TYPE_OBJECT); | RNA_def_property_enum_default(prop, GEO_NODE_POINT_INSTANCE_TYPE_OBJECT); | ||||
| RNA_def_property_ui_text(prop, "Instance Type", ""); | RNA_def_property_ui_text(prop, "Instance Type", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GEO_NODE_POINT_INSTANCE_WHOLE_COLLECTION); | ||||
| RNA_def_property_ui_text(prop, "Whole Collection", "Instance entire collection on each point"); | RNA_def_property_ui_text(prop, "Whole Collection", "Instance entire collection on each point"); | ||||
| RNA_def_property_update(prop, 0, "rna_Node_socket_update"); | RNA_def_property_update(prop, 0, "rna_Node_socket_update"); | ||||
| } | } | ||||
| static void def_geo_attribute_mix(StructRNA *srna) | static void def_geo_attribute_mix(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| Show All 24 Lines | |||||
| static void def_geo_attribute_attribute_compare(StructRNA *srna) | static void def_geo_attribute_attribute_compare(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage"); | RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage"); | ||||
| prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, rna_enum_node_float_compare_items); | RNA_def_property_enum_items(prop, rna_enum_node_float_compare_items); | ||||
| RNA_def_property_enum_default(prop, NODE_MATH_ADD); | RNA_def_property_enum_default(prop, NODE_FLOAT_COMPARE_GREATER_THAN); | ||||
| RNA_def_property_ui_text(prop, "Operation", ""); | RNA_def_property_ui_text(prop, "Operation", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); | RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); | ||||
| RNA_def_property_ui_text(prop, "Input Type A", ""); | RNA_def_property_ui_text(prop, "Input Type A", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| ▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | static void def_geo_point_translate(StructRNA *srna) | ||||
| RNA_def_struct_sdna_from(srna, "NodeGeometryPointTranslate", "storage"); | RNA_def_struct_sdna_from(srna, "NodeGeometryPointTranslate", "storage"); | ||||
| prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); | RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); | ||||
| RNA_def_property_ui_text(prop, "Input Type", ""); | RNA_def_property_ui_text(prop, "Input Type", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| } | } | ||||
| static void def_geo_attribute_sample_texture(StructRNA *srna) | |||||
| { | |||||
| PropertyRNA *prop; | |||||
| prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_pointer_sdna(prop, NULL, "id"); | |||||
| RNA_def_property_struct_type(prop, "Texture"); | |||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | |||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | |||||
| RNA_def_property_ui_text(prop, "Texture", "Texture to sample values from"); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations"); | |||||
| } | |||||
| static void def_geo_object_info(StructRNA *srna) | static void def_geo_object_info(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = { | static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = { | ||||
| {GEO_NODE_TRANSFORM_SPACE_ORIGINAL, | {GEO_NODE_TRANSFORM_SPACE_ORIGINAL, | ||||
| "ORIGINAL", | "ORIGINAL", | ||||
| 0, | 0, | ||||
| Show All 14 Lines | static void def_geo_object_info(StructRNA *srna) | ||||
| prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, rna_node_geometry_object_info_transform_space_items); | RNA_def_property_enum_items(prop, rna_node_geometry_object_info_transform_space_items); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Transform Space", "The transformation of the vector and geometry outputs"); | prop, "Transform Space", "The transformation of the vector and geometry outputs"); | ||||
| 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_geo_points_to_volume(StructRNA *srna) | |||||
| { | |||||
| PropertyRNA *prop; | |||||
| static EnumPropertyItem resolution_mode_items[] = { | |||||
| {GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT, | |||||
| "VOXEL_AMOUNT", | |||||
| 0, | |||||
| "Amount", | |||||
| "Specify the approximate number of voxels along the diagonal"}, | |||||
| {GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_SIZE, | |||||
| "VOXEL_SIZE", | |||||
| 0, | |||||
| "Size", | |||||
| "Specify the voxel side length"}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| RNA_def_struct_sdna_from(srna, "NodeGeometryPointsToVolume", "storage"); | |||||
| prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, resolution_mode_items); | |||||
| RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified"); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| prop = RNA_def_property(srna, "input_type_radius", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); | |||||
| RNA_def_property_ui_text(prop, "Radius Input Type", ""); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| } | |||||
| static void def_geo_collection_info(StructRNA *srna) | |||||
| { | |||||
| PropertyRNA *prop; | |||||
| static const EnumPropertyItem rna_node_geometry_collection_info_transform_space_items[] = { | |||||
| {GEO_NODE_TRANSFORM_SPACE_ORIGINAL, | |||||
| "ORIGINAL", | |||||
| 0, | |||||
| "Original", | |||||
| "Output the geometry relative to the collection offset"}, | |||||
| {GEO_NODE_TRANSFORM_SPACE_RELATIVE, | |||||
| "RELATIVE", | |||||
| 0, | |||||
| "Relative", | |||||
| "Bring the input collection geometry into the modified object, maintaining the relative " | |||||
| "position between the objects in the scene."}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| RNA_def_struct_sdna_from(srna, "NodeGeometryCollectionInfo", "storage"); | |||||
| prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, rna_node_geometry_collection_info_transform_space_items); | |||||
| RNA_def_property_ui_text(prop, "Transform Space", "The transformation of the geometry output"); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | |||||
| } | |||||
| /* -------------------------------------------------------------------------- */ | /* -------------------------------------------------------------------------- */ | ||||
| static void rna_def_shader_node(BlenderRNA *brna) | static void rna_def_shader_node(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal"); | srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal"); | ||||
| RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node"); | RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node"); | ||||
| ▲ Show 20 Lines • Show All 1,912 Lines • Show Last 20 Lines | |||||