mirror of
https://projects.blender.org/blender/blender.git
synced 2025-01-22 15:32:15 -05:00
Fix #133034: Grease Pencil: Reset ob->actcol
when converting from mesh
When converting object to grease pencil from mesh, the material counters need to be set to the the value that matches `GreasePencil::material_array_num` to avoid index issues in adding grease pencil materials downstream. Pull Request: https://projects.blender.org/blender/blender/pulls/133038
This commit is contained in:
parent
6cb8cdaa45
commit
e18011fddc
1 changed files with 4 additions and 2 deletions
|
@ -3209,11 +3209,13 @@ static Object *convert_mesh_to_grease_pencil(Base &base,
|
|||
newob->data = grease_pencil;
|
||||
newob->type = OB_GREASE_PENCIL;
|
||||
|
||||
/* Reset `ob->totcol` since currently the generic / grease pencil material functions still
|
||||
* depend on this value being coherent (The same value as `GreasePencil::material_array_num`).
|
||||
/* Reset `ob->totcol` and `ob->actcol` since currently the generic / grease pencil material
|
||||
* functions still depend on this value being coherent (The same value as
|
||||
* `GreasePencil::material_array_num`).
|
||||
*/
|
||||
short *totcol = BKE_object_material_len_p(newob);
|
||||
newob->totcol = *totcol;
|
||||
newob->actcol = *totcol;
|
||||
|
||||
mesh_to_grease_pencil_add_material(
|
||||
*info.bmain, *newob, DATA_("Stroke"), float4(0.0f, 0.0f, 0.0f, 1.0f), {});
|
||||
|
|
Loading…
Reference in a new issue