Fix: GPv3: Compiler error
58041799 introduced a compiler error. This fixes the issue by
making sure to use `editable_material_indices` in the functions
correctly.
This commit is contained in:
@@ -304,7 +304,7 @@ Array<DrawingInfo> retrieve_visible_drawings(const Scene &scene, const GreasePen
|
||||
static VectorSet<int> get_editable_material_indices(Object &object)
|
||||
{
|
||||
BLI_assert(object.type == OB_GREASE_PENCIL);
|
||||
VectorSet<int> locked_material_indices;
|
||||
VectorSet<int> editable_material_indices;
|
||||
for (const int mat_i : IndexRange(object.totcol)) {
|
||||
Material *material = BKE_object_material_get(&object, mat_i + 1);
|
||||
/* The editable materials are unlocked and not hidden. */
|
||||
@@ -312,10 +312,10 @@ static VectorSet<int> get_editable_material_indices(Object &object)
|
||||
(material->gp_style->flag & GP_MATERIAL_LOCKED) == 0 &&
|
||||
(material->gp_style->flag & GP_MATERIAL_HIDE) == 0)
|
||||
{
|
||||
locked_material_indices.add_new(mat_i);
|
||||
editable_material_indices.add_new(mat_i);
|
||||
}
|
||||
}
|
||||
return locked_material_indices;
|
||||
return editable_material_indices;
|
||||
}
|
||||
|
||||
static VectorSet<int> get_hidden_material_indices(Object &object)
|
||||
@@ -342,10 +342,6 @@ IndexMask retrieve_editable_strokes(Object &object,
|
||||
/* Get all the editable material indices */
|
||||
VectorSet<int> editable_material_indices = get_editable_material_indices(object);
|
||||
|
||||
if (locked_material_indices.is_empty()) {
|
||||
return drawing.strokes().curves_range();
|
||||
}
|
||||
|
||||
const bke::CurvesGeometry &curves = drawing.strokes();
|
||||
const IndexRange curves_range = drawing.strokes().curves_range();
|
||||
const bke::AttributeAccessor attributes = curves.attributes();
|
||||
@@ -353,10 +349,10 @@ IndexMask retrieve_editable_strokes(Object &object,
|
||||
const VArray<int> materials = *attributes.lookup<int>("material_index", ATTR_DOMAIN_CURVE);
|
||||
if (!materials) {
|
||||
/* if the attribute does not exist then the default is the first material. */
|
||||
if (locked_material_indices.contains(0)) {
|
||||
if (editable_material_indices.contains(0)) {
|
||||
return curves_range;
|
||||
}
|
||||
return IndexMask();
|
||||
return {};
|
||||
}
|
||||
/* Get all the strokes that have their material unlocked. */
|
||||
return IndexMask::from_predicate(
|
||||
@@ -373,10 +369,6 @@ IndexMask retrieve_editable_points(Object &object,
|
||||
/* Get all the editable material indices */
|
||||
VectorSet<int> editable_material_indices = get_editable_material_indices(object);
|
||||
|
||||
if (locked_material_indices.is_empty()) {
|
||||
return drawing.strokes().points_range();
|
||||
}
|
||||
|
||||
const bke::CurvesGeometry &curves = drawing.strokes();
|
||||
const IndexRange points_range = drawing.strokes().points_range();
|
||||
const bke::AttributeAccessor attributes = curves.attributes();
|
||||
@@ -385,10 +377,10 @@ IndexMask retrieve_editable_points(Object &object,
|
||||
const VArray<int> materials = *attributes.lookup<int>("material_index", ATTR_DOMAIN_POINT);
|
||||
if (!materials) {
|
||||
/* if the attribute does not exist then the default is the first material. */
|
||||
if (locked_material_indices.contains(0)) {
|
||||
if (editable_material_indices.contains(0)) {
|
||||
return points_range;
|
||||
}
|
||||
return IndexMask();
|
||||
return {};
|
||||
}
|
||||
/* Get all the points that are part of a stroke with an unlocked material. */
|
||||
return IndexMask::from_predicate(
|
||||
|
||||
Reference in New Issue
Block a user