Initial Grease Pencil 3.0 stage #106848

Merged
Falk David merged 224 commits from filedescriptor/blender:grease-pencil-v3 into main 2023-05-30 11:14:22 +02:00
2 changed files with 33 additions and 29 deletions
Showing only changes of commit b1c7503067 - Show all commits

View File

@ -31,6 +31,7 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_genfile.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_genfile.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_modifier_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_modifier_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_legacy_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_legacy_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_grease_pencil_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ipo_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ipo_types.h

View File

@ -39,11 +39,12 @@ typedef struct GreasePencilDrawingOrReference {
* One of `GreasePencilDrawingType`. * One of `GreasePencilDrawingType`.
* Indicates if this is an actual drawing or a drawing referenced from another object. * Indicates if this is an actual drawing or a drawing referenced from another object.
*/ */
char type; uint8_t type;
char _pad[3];
/** /**
* Flag. Used to set e.g. the selection status. * Flag. Used to set e.g. the selection status.
*/ */
int flag; uint32_t flag;
} GreasePencilDrawingOrReference; } GreasePencilDrawingOrReference;
/** /**
@ -68,6 +69,17 @@ typedef struct GreasePencilDrawingReference {
struct GreasePencil *id_reference; struct GreasePencil *id_reference;
} GreasePencilDrawingReference; } GreasePencilDrawingReference;
/* Only used for storage in the .blend file. */
typedef struct GreasePencilLayerFramesMapStorage {
/* Array of `frames` keys (sorted in ascending order). */
int *keys;
int keys_num;
/* Array of `frames` values (order matches the keys array). */
int *values;
int values_num;
} GreasePencilLayerFramesMapStorage;
/** /**
* A grease pencil layer is a collection of drawings mapped to a specific time on the timeline. * A grease pencil layer is a collection of drawings mapped to a specific time on the timeline.
*/ */
@ -99,17 +111,7 @@ typedef struct GreasePencilLayer {
*/ */
const blender::Map<int, int> &frames() const; const blender::Map<int, int> &frames() const;
#endif #endif
GreasePencilLayerFramesMapStorage frames_storage;
/* Only used for storage in the .blend file. */
struct {
/* Array of `frames` keys (sorted in ascending order). */
int *keys;
int keys_num;
/* Array of `frames` values (order matches the keys array). */
int *values;
int values_num;
} frames_storage;
/** /**
* Runtime struct pointer. * Runtime struct pointer.
@ -120,14 +122,19 @@ typedef struct GreasePencilLayer {
typedef enum GreasePencilLayerTreeNodeType { typedef enum GreasePencilLayerTreeNodeType {
GREASE_PENCIL_LAYER_TREE_LEAF = 0, GREASE_PENCIL_LAYER_TREE_LEAF = 0,
GREASE_PENCIL_LAYER_TREE_GROUP = 1, GREASE_PENCIL_LAYER_TREE_GROUP = 1,
} GreasePencilLayerTreeNode; } GreasePencilLayerTreeNodeType;
typedef struct GreasePencilLayerTreeNode { typedef struct GreasePencilLayerTreeNode {
/** /**
* One of `GreasePencilLayerTreeNodeType`. * One of `GreasePencilLayerTreeNodeType`.
* Indicates the type of struct this element is. * Indicates the type of struct this element is.
*/ */
char type; uint8_t type;
/**
* Color tag.
*/
uint8_t color[3];
/** /**
* Name of the layer/group. Dynamic length. * Name of the layer/group. Dynamic length.
@ -137,12 +144,7 @@ typedef struct GreasePencilLayerTreeNode {
/** /**
* Flag. Used to set e.g. the selection, visibility, ... status. * Flag. Used to set e.g. the selection, visibility, ... status.
*/ */
int flag; uint32_t flag;
/**
* Color tag.
*/
uchar color[3];
} GreasePencilLayerTreeNode; } GreasePencilLayerTreeNode;
typedef struct GreasePencilLayerTreeGroup { typedef struct GreasePencilLayerTreeGroup {
@ -155,6 +157,13 @@ typedef struct GreasePencilLayerTreeLeaf {
GreasePencilLayer layer; GreasePencilLayer layer;
} GreasePencilLayerTreeLeaf; } GreasePencilLayerTreeLeaf;
/* Only used for storage in the .blend file. */
typedef struct GreasePencilLayerTreeStorage {
/* Array of tree nodes. Pre-order serialization of the layer tree. */
GreasePencilLayerTreeNode **nodes;
int nodes_num;
} GreasePencilLayerTreeStorage;
/** /**
* The grease pencil data-block. * The grease pencil data-block.
* It holds a set of grease pencil drawings, a tree of layer groups, and a set of layers whithin * It holds a set of grease pencil drawings, a tree of layer groups, and a set of layers whithin
@ -180,13 +189,7 @@ typedef struct GreasePencil {
*/ */
// const bke::gpencil::LayerTree &layer_tree() const; // const bke::gpencil::LayerTree &layer_tree() const;
#endif #endif
GreasePencilLayerTreeStorage layer_tree_storage;
/* Only used for storage in the .blend file. */
struct {
/* Array of tree nodes. Pre-order serialization of the layer tree. */
GreasePencilLayerTreeNode **nodes;
int nodes_num;
} layer_tree_storage;
/** /**
* An array of materials. * An array of materials.
@ -197,7 +200,7 @@ typedef struct GreasePencil {
/** /**
* Global flag on the data-block. * Global flag on the data-block.
*/ */
int flag; uint32_t flag;
/** /**
* Runtime struct pointer. * Runtime struct pointer.