diff options
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_collection_types.h | 16 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_defaults.h | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_types.h | 73 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_lineart_types.h | 70 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 11 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_defaults.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 31 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_defaults.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 2 |
11 files changed, 222 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index 0a80e00d456..f5fcb0b190e 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -46,6 +46,14 @@ typedef struct CollectionChild { struct Collection *collection; } CollectionChild; +enum CollectionFeatureLine_Usage { + COLLECTION_LRT_INCLUDE = 0, + COLLECTION_LRT_OCCLUSION_ONLY = (1 << 0), + COLLECTION_LRT_EXCLUDE = (1 << 1), + COLLECTION_LRT_INTERSECTION_ONLY = (1 << 2), + COLLECTION_LRT_NO_INTERSECTION = (1 << 3), +}; + typedef struct Collection { ID id; @@ -63,8 +71,10 @@ typedef struct Collection { /* Runtime-only, always cleared on file load. */ short tag; + /** Line Art engine specific */ + short lineart_usage; + int16_t color_tag; - char _pad[2]; /* Runtime. Cache of objects in this collection and all its * children. This is created on demand when e.g. some physics @@ -72,6 +82,9 @@ typedef struct Collection { * collections due to memory usage reasons. */ ListBase object_cache; + /* Need this for line art sub-collection selections. */ + ListBase object_cache_instanced; + /* Runtime. List of collections that are a parent of this * datablock. */ ListBase parents; @@ -89,6 +102,7 @@ enum { COLLECTION_RESTRICT_RENDER = (1 << 3), /* Disable in renders. */ COLLECTION_HAS_OBJECT_CACHE = (1 << 4), /* Runtime: object_cache is populated. */ COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */ + COLLECTION_HAS_OBJECT_CACHE_INSTANCED = (1 << 6), /* for object_cache_instanced. */ }; /* Collection->tag */ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h index 11d4ee1b2cd..baf2b2414fa 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h @@ -283,4 +283,17 @@ .colorband = NULL, \ } +#define _DNA_DEFAULT_LineartGpencilModifierData \ + { \ + .line_types = LRT_EDGE_FLAG_ALL_TYPE, \ + .thickness = 25, \ + .opacity = 1.0f, \ + .flags = LRT_GPENCIL_MATCH_OUTPUT_VGROUP | LRT_GPENCIL_SOFT_SELECTION, \ + .crease_threshold = DEG2RAD(140.0f), \ + .calculation_flags = LRT_ALLOW_DUPLI_OBJECTS | LRT_REMOVE_DOUBLES | LRT_ALLOW_OVERLAPPING_EDGES | LRT_ALLOW_CLIPPING_BOUNDARIES, \ + .angle_splitting_threshold = DEG2RAD(60.0f), \ + .chaining_geometry_threshold = 0.001f, \ + .chaining_image_threshold = 0.001f, \ + } + /* clang-format off */ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index b2d62e0a5f6..a9262bf7ca4 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -53,6 +53,7 @@ typedef enum GpencilModifierType { eGpencilModifierType_Time = 16, eGpencilModifierType_Multiply = 17, eGpencilModifierType_Texture = 18, + eGpencilModifierType_Lineart = 19, /* Keep last. */ NUM_GREASEPENCIL_MODIFIER_TYPES, } GpencilModifierType; @@ -809,6 +810,78 @@ typedef enum eTextureGpencil_Mode { STROKE_AND_FILL = 2, } eTextureGpencil_Mode; +typedef enum eLineartGpencilModifierSource { + LRT_SOURCE_COLLECTION = 0, + LRT_SOURCE_OBJECT = 1, + LRT_SOURCE_SCENE = 2, +} eLineartGpencilModifierSource; + +typedef enum eLineArtGPencilModifierFlags { + LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 0), + LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 1), + LRT_GPENCIL_SOFT_SELECTION = (1 << 2), + LRT_GPENCIL_IS_BAKED = (1 << 3), +} eLineArtGPencilModifierFlags; + +typedef enum eLineartGpencilTransparencyFlags { + LRT_GPENCIL_TRANSPARENCY_ENABLE = (1 << 0), + /** Set to true means using "and" instead of "or" logic on mask bits. */ + LRT_GPENCIL_TRANSPARENCY_MATCH = (1 << 1), +} eLineartGpencilTransparencyFlags; + +typedef struct LineartGpencilModifierData { + GpencilModifierData modifier; + + short line_types; /* line type enable flags, bits in eLineartEdgeFlag */ + + char source_type; /* Object or Collection, from eLineartGpencilModifierSource */ + + char use_multiple_levels; + short level_start; + short level_end; + + struct Object *source_object; + struct Collection *source_collection; + + struct Material *target_material; + char target_layer[64]; + + /** These two variables are to pass on vertex group information from mesh to strokes. + * vgname specifies which vertex groups our strokes from source_vertex_group will go to. */ + char source_vertex_group[64]; + char vgname[64]; + + float opacity; + short thickness; + + unsigned char transparency_flags; /* eLineartGpencilTransparencyFlags */ + unsigned char transparency_mask; + + /** 0-1 range for cosine angle */ + float crease_threshold; + + /** 0-PI angle, for splitting strokes at sharp points */ + float angle_splitting_threshold; + + /* CPU mode */ + float chaining_geometry_threshold; + float chaining_image_threshold; + + float pre_sample_length; + + /* Ported from SceneLineArt flags. */ + int calculation_flags; + + /* Additional Switches. */ + int flags; + + int _pad; + + /* Runtime only. */ + void *render_buffer; + +} LineartGpencilModifierData; + #ifdef __cplusplus } #endif diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 9d969a29add..8facdca2f9c 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -34,6 +34,7 @@ extern "C" { struct AnimData; struct Curve; struct MDeformVert; +struct Curve; #define GP_DEFAULT_PIX_FACTOR 1.0f #define GP_DEFAULT_GRID_LINES 4 @@ -412,6 +413,8 @@ typedef enum eGPDframe_Flag { GP_FRAME_PAINT = (1 << 0), /* for editing in Action Editor */ GP_FRAME_SELECT = (1 << 1), + /* Line Art generation */ + GP_FRAME_LRT_CLEARED = (1 << 2), } eGPDframe_Flag; /* ***************************************** */ diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h new file mode 100644 index 00000000000..2eb36cfb9d3 --- /dev/null +++ b/source/blender/makesdna/DNA_lineart_types.h @@ -0,0 +1,70 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2010 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __DNA_LRT_TYPES_H__ +#define __DNA_LRT_TYPES_H__ + +/** \file DNA_lineart_types.h + * \ingroup DNA + */ + +#include "DNA_ID.h" +#include "DNA_listBase.h" + +struct Object; +struct Material; + +/* Notice that we need to have this file although no struct defines. + * Edge flags and usage flags are used by with scene/object/gpencil modifier bits, and those values + * needs to stay consistent throughout. */ + +typedef enum eLineartMainFlags { + LRT_INTERSECTION_AS_CONTOUR = (1 << 0), + LRT_EVERYTHING_AS_CONTOUR = (1 << 1), + LRT_ALLOW_DUPLI_OBJECTS = (1 << 2), + LRT_ALLOW_OVERLAPPING_EDGES = (1 << 3), + LRT_ALLOW_CLIPPING_BOUNDARIES = (1 << 4), + LRT_REMOVE_DOUBLES = (1 << 5), +} eLineartMainFlags; + +typedef enum eLineartEdgeFlag { + LRT_EDGE_FLAG_EDGE_MARK = (1 << 0), + LRT_EDGE_FLAG_CONTOUR = (1 << 1), + LRT_EDGE_FLAG_CREASE = (1 << 2), + LRT_EDGE_FLAG_MATERIAL = (1 << 3), + LRT_EDGE_FLAG_INTERSECTION = (1 << 4), + /** floating edge, unimplemented yet */ + LRT_EDGE_FLAG_FLOATING = (1 << 5), + /** also used as discarded line mark */ + LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6), + LRT_EDGE_FLAG_CLIPPED = (1 << 7), + /* Maxed out for 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */ +} eLineartEdgeFlag; + +#define LRT_EDGE_FLAG_ALL_TYPE 0x3f + +#endif diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 884c2df6480..55d5ea202f7 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -145,6 +145,16 @@ typedef enum eMaterialGPencilStyle_Mode { GP_MATERIAL_MODE_SQUARE = 2, } eMaterialGPencilStyle_Mode; +typedef struct MaterialLineArt { + int flags; /* eMaterialLineArtFlags */ + unsigned char transparency_mask; + unsigned char _pad[3]; +} MaterialLineArt; + +typedef enum eMaterialLineArtFlags { + LRT_MATERIAL_TRANSPARENCY_ENABLED = (1 << 0), +} eMaterialLineArtFlags; + typedef struct Material { ID id; /** Animation data (must be immediately after id for utilities to use it). */ @@ -210,6 +220,7 @@ typedef struct Material { /** Grease pencil color. */ struct MaterialGPencilStyle *gp_style; + struct MaterialLineArt lineart; } Material; /* **************** MATERIAL ********************* */ diff --git a/source/blender/makesdna/DNA_object_defaults.h b/source/blender/makesdna/DNA_object_defaults.h index 1bca572b963..d545b7912c0 100644 --- a/source/blender/makesdna/DNA_object_defaults.h +++ b/source/blender/makesdna/DNA_object_defaults.h @@ -66,6 +66,7 @@ .preview = NULL, \ .duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT | OB_DUPLI_FLAG_RENDER, \ .pc_ids = {NULL, NULL}, \ + .lineart = { .crease_threshold = DEG2RAD(140.0f) }, \ } /** \} */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f6372a0c240..fa4e3953f5b 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -26,6 +26,11 @@ #include "DNA_object_enums.h" +#include "DNA_customdata_types.h" +#include "DNA_defs.h" +#include "DNA_lineart_types.h" +#include "DNA_listBase.h" + #include "DNA_ID.h" #include "DNA_action_types.h" /* bAnimVizSettings */ #include "DNA_customdata_types.h" @@ -200,6 +205,27 @@ typedef struct Object_Runtime { short _pad2[3]; } Object_Runtime; +typedef struct ObjectLineArt { + short usage; + short flags; + + /** if OBJECT_LRT_OWN_CREASE is set */ + float crease_threshold; +} ObjectLineArt; + +enum ObjectFeatureLine_Usage { + OBJECT_LRT_INHERENT = 0, + OBJECT_LRT_INCLUDE = (1 << 0), + OBJECT_LRT_OCCLUSION_ONLY = (1 << 1), + OBJECT_LRT_EXCLUDE = (1 << 2), + OBJECT_LRT_INTERSECTION_ONLY = (1 << 3), + OBJECT_LRT_NO_INTERSECTION = (1 << 4), +}; + +enum ObjectFeatureLine_Flags { + OBJECT_LRT_OWN_CREASE = (1 << 0), +}; + typedef struct Object { ID id; /** Animation data (must be immediately after id for utilities to use it). */ @@ -405,6 +431,8 @@ typedef struct Object { struct PreviewImage *preview; + ObjectLineArt lineart; + /** Runtime evaluation data (keep last). */ Object_Runtime runtime; } Object; @@ -595,6 +623,9 @@ enum { GP_EMPTY = 0, GP_STROKE = 1, GP_MONKEY = 2, + GP_LRT_SCENE = 3, + GP_LRT_OBJECT = 4, + GP_LRT_COLLECTION = 5, }; /* boundtype */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index de9b842312c..755010cd8a5 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -228,6 +228,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_TOOL = 14, BCONTEXT_SHADERFX = 15, BCONTEXT_OUTPUT = 16, + BCONTEXT_COLLECTION = 17, /* Keep last. */ BCONTEXT_TOT, diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 7aca742a8e6..95272fb7804 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -315,6 +315,7 @@ SDNA_DEFAULT_DECL_STRUCT(TextureGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(ThickGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(TimeGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(TintGpencilModifierData); +SDNA_DEFAULT_DECL_STRUCT(LineartGpencilModifierData); #undef SDNA_DEFAULT_DECL_STRUCT @@ -539,6 +540,7 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { SDNA_DEFAULT_DECL(ThickGpencilModifierData), SDNA_DEFAULT_DECL(TimeGpencilModifierData), SDNA_DEFAULT_DECL(TintGpencilModifierData), + SDNA_DEFAULT_DECL(LineartGpencilModifierData), }; #undef SDNA_DEFAULT_DECL #undef SDNA_DEFAULT_DECL_EX diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 7624649bf78..26fc56cfa1d 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -84,6 +84,7 @@ static const char *includefiles[] = { "DNA_mesh_types.h", "DNA_meshdata_types.h", "DNA_modifier_types.h", + "DNA_lineart_types.h", "DNA_lattice_types.h", "DNA_object_types.h", "DNA_object_force_types.h", @@ -1558,6 +1559,7 @@ int main(int argc, char **argv) #include "DNA_layer_types.h" #include "DNA_light_types.h" #include "DNA_lightprobe_types.h" +#include "DNA_lineart_types.h" #include "DNA_linestyle_types.h" #include "DNA_listBase.h" #include "DNA_mask_types.h" |