Merge branch 'blender-v4.3-release'

This commit is contained in:
Falk David
2024-10-21 14:12:40 +02:00
4 changed files with 57 additions and 29 deletions

View File

@@ -123,8 +123,6 @@ def DefAttributeGetterSetters(attributes_list):
# Define the list of attributes that should be exposed as read/write properties on the class.
@DefAttributeGetterSetters([
# Property Name, Attribute Name, Type, Default Value, Doc-string.
("position", "position", 'FLOAT_VECTOR', (0.0, 0.0, 0.0),
"The position of the point (in local space)."),
("radius", "radius", 'FLOAT', 0.01, "The radius of the point."),
("opacity", "opacity", 'FLOAT', 0.0, "The opacity of the point."),
("vertex_color", "vertex_color", 'FLOAT_COLOR', (0.0, 0.0, 0.0, 0.0),
@@ -138,13 +136,32 @@ class GreasePencilStrokePoint(AttributeGetterSetter):
"""
A helper class to get access to stroke point data.
"""
__slots__ = ("_curve_index", "_point_index")
__slots__ = ("_drawing", "_curve_index", "_point_index")
def __init__(self, drawing, curve_index, point_index):
super().__init__(drawing.attributes, point_index, 'POINT')
self._drawing = drawing
self._curve_index = curve_index
self._point_index = point_index
@property
def position(self):
"""
The position of the point (in local space).
"""
if attribute := self._attributes.get("position"):
return attribute.data[self._point_index].vector
# Position attribute should always exist, but return default just in case.
return (0.0, 0.0, 0.0)
@position.setter
def position(self, value):
# Position attribute should always exist
if attribute := self._attributes.get("position"):
attribute.data[self._point_index].vector = value
# Tag the positions of the drawing.
self._drawing.tag_positions_changed()
@property
def select(self):
"""

View File

@@ -2482,11 +2482,12 @@ void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *r
}
greasepencil::Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
MutableAttributeAccessor attributes = drawing.strokes_for_write().attributes_for_write();
SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_span<int>(
"material_index", AttrDomain::Curve);
SpanAttributeWriter<int> material_indices = attributes.lookup_for_write_span<int>(
"material_index");
if (!material_indices) {
return;
continue;
}
BLI_assert(material_indices.domain == AttrDomain::Curve);
for (const int i : material_indices.span.index_range()) {
BLI_assert(blender::IndexRange(totcol).contains(remap[material_indices.span[i]]));
UNUSED_VARS_NDEBUG(totcol);
@@ -2496,7 +2497,7 @@ void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *r
}
}
void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int index)
void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, const int index)
{
using namespace blender;
using namespace blender::bke;
@@ -2505,21 +2506,19 @@ void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int in
if (base->type != GP_DRAWING) {
continue;
}
greasepencil::Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
MutableAttributeAccessor attributes = drawing.strokes_for_write().attributes_for_write();
AttributeWriter<int> material_indices = attributes.lookup_for_write<int>("material_index");
SpanAttributeWriter<int> material_indices = attributes.lookup_for_write_span<int>(
"material_index");
if (!material_indices) {
return;
continue;
}
MutableVArraySpan<int> indices_span(material_indices.varray);
for (const int i : indices_span.index_range()) {
if (indices_span[i] > 0 && indices_span[i] >= index) {
indices_span[i]--;
BLI_assert(material_indices.domain == AttrDomain::Curve);
for (const int i : material_indices.span.index_range()) {
if (material_indices.span[i] > 0 && material_indices.span[i] >= index) {
material_indices.span[i]--;
}
}
indices_span.save();
material_indices.finish();
}
}

View File

@@ -107,6 +107,11 @@ static void rna_GreasePencilDrawing_resize_curves(ID *grease_pencil_id,
}
}
static void rna_GreasePencilDrawing_tag_positions_changed(GreasePencilDrawing *drawing_ptr)
{
drawing_ptr->wrap().tag_positions_changed();
}
static GreasePencilFrame *rna_Frames_frame_new(ID *id,
GreasePencilLayer *layer_in,
ReportList *reports,
@@ -484,6 +489,11 @@ void RNA_api_grease_pencil_drawing(StructRNA *srna)
0,
10000);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, ParameterFlag(0));
func = RNA_def_function(
srna, "tag_positions_changed", "rna_GreasePencilDrawing_tag_positions_changed");
RNA_def_function_ui_description(
func, "Indicate that the positions of points in the drawing have changed");
}
void RNA_api_grease_pencil_frames(StructRNA *srna)
@@ -677,12 +687,12 @@ void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
parm = RNA_def_string(
func, "name", "GreasePencilLayerGroup", MAX_NAME, "Name", "Name of the layer group");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_pointer(
func,
"parent_group",
"GreasePencilLayerGroup",
"",
"The parent layer group the new group will be created in (use None for the main stack)");
parm = RNA_def_pointer(func,
"parent_group",
"GreasePencilLayerGroup",
"",
"The parent layer group the new group will be created in (use None "
"for the main stack)");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_RNAPTR);
parm = RNA_def_pointer(
func, "layer_group", "GreasePencilLayerGroup", "", "The newly created layer group");
@@ -735,12 +745,12 @@ void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to move");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
parm = RNA_def_pointer(
func,
"parent_group",
"GreasePencilLayerGroup",
"",
"The parent layer group the layer group will be moved into (use None for the main stack)");
parm = RNA_def_pointer(func,
"parent_group",
"GreasePencilLayerGroup",
"",
"The parent layer group the layer group will be moved into (use "
"None for the main stack)");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
}

View File

@@ -8248,7 +8248,9 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_volumetric_shadows", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_VOLUMETRIC_SHADOWS);
RNA_def_property_ui_text(
prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)");
prop,
"Volumetric Shadows",
"Cast shadows from volumetric materials onto volumetric materials (Very expensive)");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);