Initial Grease Pencil 3.0 stage #106848
|
@ -7,6 +7,7 @@
|
|||
#include "BKE_anim_data.h"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_grease_pencil.h"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_idtype.h"
|
||||
#include "BKE_lib_id.h"
|
||||
|
@ -52,6 +53,10 @@ static void grease_pencil_copy_data(Main * /*bmain*/,
|
|||
GreasePencil *grease_pencil_dst = (GreasePencil *)id_dst;
|
||||
const GreasePencil *grease_pencil_src = (GreasePencil *)id_src;
|
||||
|
||||
/* Duplicate material array. */
|
||||
grease_pencil_dst->material_array = static_cast<Material **>(
|
||||
MEM_dupallocN(grease_pencil_src->material_array));
|
||||
|
||||
/* Duplicate drawing array. */
|
||||
grease_pencil_dst->drawing_array_size = grease_pencil_src->drawing_array_size;
|
||||
grease_pencil_dst->drawing_array = MEM_cnew_array<GreasePencilDrawingOrReference *>(
|
||||
|
|
|
@ -384,7 +384,7 @@ short *BKE_object_material_len_p(Object *ob)
|
|||
}
|
||||
if (ob->type == OB_GREASE_PENCIL) {
|
||||
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
|
||||
return reinterpret_cast<short *>(&(grease_pencil->material_array_size));
|
||||
return &(grease_pencil->material_array_size);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -409,6 +409,8 @@ Material ***BKE_id_material_array_p(ID *id)
|
|||
return &(((PointCloud *)id)->mat);
|
||||
case ID_VO:
|
||||
return &(((Volume *)id)->mat);
|
||||
case ID_GP:
|
||||
return &(((GreasePencil *)id)->material_array);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -435,6 +437,8 @@ short *BKE_id_material_len_p(ID *id)
|
|||
return &(((PointCloud *)id)->totcol);
|
||||
case ID_VO:
|
||||
return &(((Volume *)id)->totcol);
|
||||
case ID_GP:
|
||||
return &(((GreasePencil *)id)->material_array_size);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3087,6 +3087,8 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
|||
|
||||
bke::gpencil::convert::legacy_gpencil_to_grease_pencil(*new_grease_pencil, *gpd);
|
||||
|
||||
BKE_id_materials_copy(bmain, &gpd->id, &new_grease_pencil->id);
|
||||
|
||||
BKE_object_free_derived_caches(newob);
|
||||
BKE_object_free_modifiers(newob, 0);
|
||||
}
|
||||
|
|
|
@ -181,7 +181,8 @@ typedef struct GreasePencil {
|
|||
* An array of materials.
|
||||
*/
|
||||
struct Material **material_array;
|
||||
int material_array_size;
|
||||
short material_array_size;
|
||||
char _pad2[2];
|
||||
|
||||
/**
|
||||
* Global flag on the data-block.
|
||||
|
|
Loading…
Reference in New Issue