Merge branch 'blender-v4.1-release'

This commit is contained in:
Jacques Lucke
2024-03-11 19:35:26 +01:00
16 changed files with 72 additions and 18 deletions

View File

@@ -104,6 +104,14 @@ bool BKE_volume_grid_dense_floats(const Volume *volume,
if (bbox.empty()) {
return false;
}
const std::array<int64_t, 6> bbox_indices = {UNPACK3(openvdb::math::Abs(bbox.min())),
UNPACK3(openvdb::math::Abs(bbox.max()))};
const int64_t max_bbox_index = *std::max_element(bbox_indices.begin(), bbox_indices.end());
if (max_bbox_index > (1 << 30)) {
/* There is an integer overflow when trying to extract dense voxels when the indices are very
* large. */
return false;
}
const openvdb::Vec3i resolution = bbox.dim().asVec3i();
const int64_t num_voxels = int64_t(resolution[0]) * int64_t(resolution[1]) *

View File

@@ -8886,6 +8886,7 @@ static void def_geo_curve_sample(StructRNA *srna)
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", "Method for sampling input");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "use_all_curves", PROP_BOOLEAN, PROP_NONE);
@@ -8893,6 +8894,7 @@ static void def_geo_curve_sample(StructRNA *srna)
"All Curves",
"Sample lengths based on the total length of all curves, rather than "
"using a length inside each selected curve");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
@@ -8901,6 +8903,7 @@ static void def_geo_curve_sample(StructRNA *srna)
prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
RNA_def_property_ui_text(prop, "Data Type", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
@@ -8943,6 +8946,7 @@ static void def_geo_distribute_points_on_faces(StructRNA *srna)
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_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "use_legacy_normal", PROP_BOOLEAN, PROP_NONE);
@@ -8951,6 +8955,7 @@ static void def_geo_distribute_points_on_faces(StructRNA *srna)
"Legacy Normal",
"Output the normal and rotation values that have been output "
"before the node started taking smooth normals into account");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
@@ -8964,12 +8969,14 @@ static void def_geo_curve_set_handle_type(StructRNA *srna)
RNA_def_property_enum_sdna(prop, nullptr, "handle_type");
RNA_def_property_ui_text(prop, "Handle Type", "");
RNA_def_property_enum_items(prop, rna_node_geometry_curve_handle_type_items);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
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_enum_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_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
@@ -9312,6 +9319,7 @@ static void rna_def_geo_bake(StructRNA *srna)
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NO_DEG_UPDATE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Active Item Index", "Index of the active item");
RNA_def_property_update(prop, NC_NODE, nullptr);
}
@@ -9441,6 +9449,7 @@ static void def_geo_sample_index(StructRNA *srna)
prop, nullptr, nullptr, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
RNA_def_property_ui_text(prop, "Data Type", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);

View File

@@ -68,6 +68,7 @@ PropertyRNA *RNA_def_node_enum(StructRNA *srna,
const EnumPropertyItem *static_items,
const EnumRNAAccessors accessors,
std::optional<int> default_value = std::nullopt,
const EnumPropertyItemFunc item_func = nullptr);
const EnumPropertyItemFunc item_func = nullptr,
bool allow_animation = false);
} // namespace blender::nodes

View File

@@ -239,14 +239,20 @@ static void node_rna(StructRNA *srna)
"Axis",
"Axis to align to the vector",
axis_items,
NOD_inline_enum_accessors(custom1));
NOD_inline_enum_accessors(custom1),
std::nullopt,
nullptr,
true);
RNA_def_node_enum(srna,
"pivot_axis",
"Pivot Axis",
"Axis to rotate around",
pivot_axis_items,
NOD_inline_enum_accessors(custom2));
NOD_inline_enum_accessors(custom2),
std::nullopt,
nullptr,
true);
}
static void node_register()

View File

@@ -389,7 +389,8 @@ static void node_rna(StructRNA *srna)
rna_enum_attribute_domain_items,
NOD_storage_enum_accessors(domain),
int(AttrDomain::Point),
enums::domain_experimental_grease_pencil_version3_fn);
enums::domain_experimental_grease_pencil_version3_fn,
true);
}
static void node_register()

View File

@@ -182,7 +182,8 @@ static void node_rna(StructRNA *srna)
rna_enum_attribute_domain_items,
NOD_storage_enum_accessors(domain),
int8_t(AttrDomain::Point),
enums::domain_experimental_grease_pencil_version3_fn);
enums::domain_experimental_grease_pencil_version3_fn,
true);
}
static void node_register()

View File

@@ -355,7 +355,8 @@ static void node_rna(StructRNA *srna)
rna_enum_attribute_domain_items,
NOD_inline_enum_accessors(custom2),
int(AttrDomain::Point),
enums::domain_experimental_grease_pencil_version3_fn);
enums::domain_experimental_grease_pencil_version3_fn,
true);
}
static void node_register()

View File

@@ -84,7 +84,9 @@ static void node_rna(StructRNA *srna)
"The curve type to change the selected curves to",
rna_enum_curves_type_items,
NOD_storage_enum_accessors(spline_type),
CURVE_TYPE_POLY);
CURVE_TYPE_POLY,
nullptr,
true);
}
static void node_register()

View File

@@ -1061,7 +1061,9 @@ static void node_rna(StructRNA *srna)
"Which domain to duplicate",
domain_items,
NOD_storage_enum_accessors(domain),
int(AttrDomain::Point));
int(AttrDomain::Point),
nullptr,
true);
}
static void node_register()

View File

@@ -212,7 +212,9 @@ static void node_rna(StructRNA *srna)
"",
rna_enum_node_geometry_mesh_circle_fill_type_items,
NOD_storage_enum_accessors(fill_type),
GEO_NODE_MESH_CIRCLE_FILL_NONE);
GEO_NODE_MESH_CIRCLE_FILL_NONE,
nullptr,
true);
}
static void node_register()

View File

@@ -148,7 +148,9 @@ static void node_rna(StructRNA *srna)
"",
rna_enum_node_geometry_mesh_circle_fill_type_items,
NOD_storage_enum_accessors(fill_type),
GEO_NODE_MESH_CIRCLE_FILL_NGON);
GEO_NODE_MESH_CIRCLE_FILL_NGON,
nullptr,
true);
}
static void node_register()

View File

@@ -139,7 +139,9 @@ static void node_rna(StructRNA *srna)
"",
rna_enum_node_geometry_mesh_circle_fill_type_items,
NOD_storage_enum_accessors(fill_type),
GEO_NODE_MESH_CIRCLE_FILL_NGON);
GEO_NODE_MESH_CIRCLE_FILL_NGON,
nullptr,
true);
}
static void node_register()

View File

@@ -233,7 +233,9 @@ static void node_rna(StructRNA *srna)
"",
mode_items,
NOD_storage_enum_accessors(mode),
GEO_NODE_MESH_TO_POINTS_VERTICES);
GEO_NODE_MESH_TO_POINTS_VERTICES,
nullptr,
true);
}
static void node_register()

View File

@@ -205,7 +205,9 @@ static void node_rna(StructRNA *srna)
"Controls how smoothing is applied to UVs",
rna_enum_subdivision_uv_smooth_items,
NOD_storage_enum_accessors(uv_smooth),
SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES);
SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES,
nullptr,
true);
RNA_def_node_enum(srna,
"boundary_smooth",
@@ -213,7 +215,9 @@ static void node_rna(StructRNA *srna)
"Controls how open boundaries are smoothed",
rna_enum_subdivision_boundary_smooth_items,
NOD_storage_enum_accessors(boundary_smooth),
SUBSURF_BOUNDARY_SMOOTH_ALL);
SUBSURF_BOUNDARY_SMOOTH_ALL,
nullptr,
true);
}
static void node_register()

View File

@@ -156,7 +156,9 @@ static void node_rna(StructRNA *srna)
"Method for splitting the quads into triangles",
rna_node_geometry_triangulate_quad_method_items,
NOD_inline_enum_accessors(custom1),
GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT);
GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT,
nullptr,
true);
RNA_def_node_enum(srna,
"ngon_method",
@@ -164,7 +166,9 @@ static void node_rna(StructRNA *srna)
"Method for splitting the n-gons into triangles",
rna_node_geometry_triangulate_ngon_method_items,
NOD_inline_enum_accessors(custom2),
GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT);
GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_AMOUNT,
nullptr,
true);
}
static void node_register()

View File

@@ -29,7 +29,8 @@ PropertyRNA *RNA_def_node_enum(StructRNA *srna,
const EnumPropertyItem *static_items,
const EnumRNAAccessors accessors,
std::optional<int> default_value,
const EnumPropertyItemFunc item_func)
const EnumPropertyItemFunc item_func,
const bool allow_animation)
{
PropertyRNA *prop = RNA_def_property(srna, identifier, PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs_runtime(prop, accessors.getter, accessors.setter, item_func);
@@ -38,7 +39,13 @@ PropertyRNA *RNA_def_node_enum(StructRNA *srna,
RNA_def_property_enum_default(prop, *default_value);
}
RNA_def_property_ui_text(prop, ui_name, ui_description);
RNA_def_property_update_runtime(prop, rna_Node_socket_update);
if (allow_animation) {
RNA_def_property_update_runtime(prop, rna_Node_update);
}
else {
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update_runtime(prop, rna_Node_socket_update);
}
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
return prop;
}