Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c343
1 files changed, 331 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index b631e76c094..df1be412bc4 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2092,6 +2092,19 @@ static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_type_itemf(
return itemf_function_check(rna_enum_attribute_type_items, attribute_random_type_supported);
}
+static bool random_value_type_supported(const EnumPropertyItem *item)
+{
+ return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL, CD_PROP_INT32);
+}
+static const EnumPropertyItem *rna_FunctionNodeRandomValue_type_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ *r_free = true;
+ return itemf_function_check(rna_enum_attribute_type_items, random_value_type_supported);
+}
+
static const EnumPropertyItem *rna_GeometryNodeAttributeRandomize_operation_itemf(
bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
@@ -3729,7 +3742,7 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p
rna_Node_update(bmain, scene, ptr);
- if (scene->nodetree != NULL) {
+ if (scene != NULL && scene->nodetree != NULL) {
ntreeCompositUpdateRLayers(scene->nodetree);
}
}
@@ -3901,7 +3914,7 @@ static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext *UNUSED(C),
static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Node_update(bmain, scene, ptr);
- if (scene->nodetree != NULL) {
+ if (scene != NULL && scene->nodetree != NULL) {
ntreeCompositUpdateRLayers(scene->nodetree);
}
}
@@ -4336,7 +4349,7 @@ static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *p
{
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
bNode *node = (bNode *)ptr->data;
- RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
+ RenderEngineType *engine_type = (scene != NULL) ? RE_engines_find(scene->r.engine) : NULL;
if (engine_type && engine_type->update_script_node) {
/* auto update node */
@@ -4887,6 +4900,17 @@ static void def_vector_curve(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_float_curve(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
static void def_time(StructRNA *srna)
{
PropertyRNA *prop;
@@ -6532,11 +6556,11 @@ static void def_cmp_levels(StructRNA *srna)
PropertyRNA *prop;
static const EnumPropertyItem channel_items[] = {
- {1, "COMBINED_RGB", 0, "C", "Combined RGB"},
- {2, "RED", 0, "R", "Red Channel"},
- {3, "GREEN", 0, "G", "Green Channel"},
- {4, "BLUE", 0, "B", "Blue Channel"},
- {5, "LUMINANCE", 0, "L", "Luminance Channel"},
+ {1, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
+ {2, "RED", 0, "Red", "Red Channel"},
+ {3, "GREEN", 0, "Green", "Green Channel"},
+ {4, "BLUE", 0, "Blue", "Blue Channel"},
+ {5, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
{0, NULL, 0, NULL, NULL},
};
@@ -9168,6 +9192,21 @@ static void def_geo_subdivision_surface(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_fn_random_value(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeRandomValue", "storage");
+
+ prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "data_type");
+ RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeRandomValue_type_itemf");
+ RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
+ RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+}
+
static void def_geo_attribute_randomize(StructRNA *srna)
{
PropertyRNA *prop;
@@ -9479,6 +9518,33 @@ static void def_geo_point_distribute(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_geo_distribute_points_on_faces(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem rna_node_geometry_distribute_points_on_faces_mode_items[] = {
+ {GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_RANDOM,
+ "RANDOM",
+ 0,
+ "Random",
+ "Distribute points randomly on the surface"},
+ {GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_POISSON,
+ "POISSON",
+ 0,
+ "Poisson Disk",
+ "Distribute the points randomly on the surface while taking a minimum distance between "
+ "points into account"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_node_geometry_distribute_points_on_faces_mode_items);
+ RNA_def_property_enum_default(prop, GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_RANDOM);
+ RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+}
+
static void def_geo_attribute_color_ramp(StructRNA *srna)
{
PropertyRNA *prop;
@@ -9601,6 +9667,23 @@ static void def_geo_curve_set_handles(StructRNA *srna)
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_node_geometry_curve_handle_side_items);
RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+}
+
+static void def_geo_legacy_curve_set_handles(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSetHandles", "storage");
+
+ prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "handle_type");
+ RNA_def_property_enum_items(prop, rna_node_geometry_curve_handle_type_items);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_node_geometry_curve_handle_side_items);
+ RNA_def_property_ui_text(prop, "Mode", "Whether to update left and right handles");
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
@@ -9735,6 +9818,51 @@ static void def_geo_point_rotate(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_fn_rotate_euler(StructRNA *srna)
+{
+ static const EnumPropertyItem type_items[] = {
+ {FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE,
+ "AXIS_ANGLE",
+ ICON_NONE,
+ "Axis Angle",
+ "Rotate around an axis by an angle"},
+ {FN_NODE_ROTATE_EULER_TYPE_EULER,
+ "EULER",
+ ICON_NONE,
+ "Euler",
+ "Rotate around the X, Y, and Z axes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem space_items[] = {
+ {FN_NODE_ROTATE_EULER_SPACE_OBJECT,
+ "OBJECT",
+ ICON_NONE,
+ "Object",
+ "Rotate the input rotation in the local space of the object"},
+ {FN_NODE_ROTATE_EULER_SPACE_POINT,
+ "POINT",
+ ICON_NONE,
+ "Point",
+ "Rotate the input rotation in its local space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "Method used to describe the rotation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, space_items);
+ RNA_def_property_ui_text(prop, "Space", "Base orientation of the points");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
static void def_geo_align_rotation_to_vector(StructRNA *srna)
{
static const EnumPropertyItem axis_items[] = {
@@ -9917,7 +10045,7 @@ static void def_geo_collection_info(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
-static void def_geo_attribute_proximity(StructRNA *srna)
+static void def_geo_legacy_attribute_proximity(StructRNA *srna)
{
static const EnumPropertyItem target_geometry_element[] = {
{GEO_NODE_PROXIMITY_TARGET_POINTS,
@@ -9950,6 +10078,39 @@ static void def_geo_attribute_proximity(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_geo_proximity(StructRNA *srna)
+{
+ static const EnumPropertyItem target_element_items[] = {
+ {GEO_NODE_PROX_TARGET_POINTS,
+ "POINTS",
+ ICON_NONE,
+ "Points",
+ "Calculate the proximity to the target's points (faster than the other modes)"},
+ {GEO_NODE_PROX_TARGET_EDGES,
+ "EDGES",
+ ICON_NONE,
+ "Edges",
+ "Calculate the proximity to the target's edges"},
+ {GEO_NODE_PROX_TARGET_FACES,
+ "FACES",
+ ICON_NONE,
+ "Faces",
+ "Calculate the proximity to the target's faces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeGeometryProximity", "storage");
+
+ prop = RNA_def_property(srna, "target_element", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, target_element_items);
+ RNA_def_property_enum_default(prop, GEO_NODE_PROX_TARGET_FACES);
+ RNA_def_property_ui_text(
+ prop, "Target Geometry", "Element of the target geometry to calculate the distance from");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+}
+
static void def_geo_volume_to_mesh(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10036,7 +10197,7 @@ static void def_geo_mesh_cylinder(StructRNA *srna)
prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_node_geometry_mesh_circle_fill_type_items);
RNA_def_property_ui_text(prop, "Fill Type", "");
- 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");
}
static void def_geo_mesh_cone(StructRNA *srna)
@@ -10048,7 +10209,7 @@ static void def_geo_mesh_cone(StructRNA *srna)
prop = RNA_def_property(srna, "fill_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_node_geometry_mesh_circle_fill_type_items);
RNA_def_property_ui_text(prop, "Fill Type", "");
- 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");
}
static void def_geo_mesh_line(StructRNA *srna)
@@ -10181,7 +10342,7 @@ static void def_geo_curve_resample(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
-static void def_geo_curve_subdivide(StructRNA *srna)
+static void def_geo_legacy_curve_subdivide(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10251,6 +10412,42 @@ static void def_geo_curve_to_points(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_geo_mesh_to_points(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem mode_items[] = {
+ {GEO_NODE_MESH_TO_POINTS_VERTICES,
+ "VERTICES",
+ 0,
+ "Vertices",
+ "Create a point in the point cloud for each selected vertex"},
+ {GEO_NODE_MESH_TO_POINTS_EDGES,
+ "EDGES",
+ 0,
+ "Edges",
+ "Create a point in the point cloud for each selected edge"},
+ {GEO_NODE_MESH_TO_POINTS_FACES,
+ "FACES",
+ 0,
+ "Faces",
+ "Create a point in the point cloud for each selected face"},
+ {GEO_NODE_MESH_TO_POINTS_CORNERS,
+ "CORNERS",
+ 0,
+ "Corners",
+ "Create a point in the point cloud for each selected face corner"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeGeometryMeshToPoints", "storage");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
static void def_geo_curve_trim(StructRNA *srna)
{
PropertyRNA *prop;
@@ -10398,6 +10595,120 @@ static void def_geo_attribute_capture(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_geo_string_to_curves(StructRNA *srna)
+{
+ static const EnumPropertyItem rna_node_geometry_string_to_curves_overflow_items[] = {
+ {GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW,
+ "OVERFLOW",
+ ICON_NONE,
+ "Overflow",
+ "Let the text use more space than the specified height"},
+ {GEO_NODE_STRING_TO_CURVES_MODE_SCALE_TO_FIT,
+ "SCALE_TO_FIT",
+ ICON_NONE,
+ "Scale To Fit",
+ "Scale the text size to fit inside the width and height"},
+ {GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE,
+ "TRUNCATE",
+ ICON_NONE,
+ "Truncate",
+ "Only output curves that fit within the width and height. Output the remainder to the "
+ "\"Remainder\" output"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem rna_node_geometry_string_to_curves_align_x_items[] = {
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_X_LEFT,
+ "LEFT",
+ ICON_ALIGN_LEFT,
+ "Left",
+ "Align text to the left"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_X_CENTER,
+ "CENTER",
+ ICON_ALIGN_CENTER,
+ "Center",
+ "Align text to the center"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_X_RIGHT,
+ "RIGHT",
+ ICON_ALIGN_RIGHT,
+ "Right",
+ "Align text to the right"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_X_JUSTIFY,
+ "JUSTIFY",
+ ICON_ALIGN_JUSTIFY,
+ "Justify",
+ "Align text to the left and the right"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_X_FLUSH,
+ "FLUSH",
+ ICON_ALIGN_FLUSH,
+ "Flush",
+ "Align text to the left and the right, with equal character spacing"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem rna_node_geometry_string_to_curves_align_y_items[] = {
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE,
+ "TOP_BASELINE",
+ ICON_ALIGN_TOP,
+ "Top Baseline",
+ "Align text to the top baseline"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP,
+ "TOP",
+ ICON_ALIGN_TOP,
+ "Top",
+ "Align text to the top"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_Y_MIDDLE,
+ "MIDDLE",
+ ICON_ALIGN_MIDDLE,
+ "Middle",
+ "Align text to the middle"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM_BASELINE,
+ "BOTTOM_BASELINE",
+ ICON_ALIGN_BOTTOM,
+ "Bottom Baseline",
+ "Align text to the bottom baseline"},
+ {GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM,
+ "BOTTOM",
+ ICON_ALIGN_BOTTOM,
+ "Bottom",
+ "Align text to the bottom"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "VectorFont");
+ RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeGeometryStringToCurves", "storage");
+
+ prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "overflow");
+ RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_overflow_items);
+ RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW);
+ RNA_def_property_ui_text(prop, "Overflow", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+ prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align_x");
+ RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_x_items);
+ RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_ALIGN_X_LEFT);
+ RNA_def_property_ui_text(prop, "Align X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align_y");
+ RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_align_y_items);
+ RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE);
+ RNA_def_property_ui_text(prop, "Align Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
/* -------------------------------------------------------------------------- */
static void rna_def_shader_node(BlenderRNA *brna)
@@ -10664,6 +10975,14 @@ static void rna_def_node_socket_interface(BlenderRNA *brna)
prop, "Hide Value", "Hide the socket input value even when the socket is not connected");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Attribute Domain",
+ "Attribute domain used by the geometry nodes modifier to create an attribute output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
/* registration */
prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");