[Bf-blender-cvs] [b31ce484b99] temp-greasepencil-object-stacksplit: WIP: More changes

Antonio Vazquez noreply at git.blender.org
Fri Jun 15 16:03:32 CEST 2018


Commit: b31ce484b991d856ff7924f7319e83fe8ff4273e
Author: Antonio Vazquez
Date:   Fri Jun 15 16:03:21 2018 +0200
Branches: temp-greasepencil-object-stacksplit
https://developer.blender.org/rBb31ce484b991d856ff7924f7319e83fe8ff4273e

WIP: More changes

Still not ready to compile

===================================================================

M	source/blender/CMakeLists.txt
R071	source/blender/blenkernel/BKE_greapencil_modifier.h	source/blender/blenkernel/BKE_gpencil_modifier.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/editors/space_outliner/outliner_draw.c
A	source/blender/gpencil_modifiers/CMakeLists.txt
A	source/blender/gpencil_modifiers/MOD_modifiertypes.h
R100	source/blender/modifiers/intern/MOD_gpencil_util.c	source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
R100	source/blender/modifiers/intern/MOD_gpencil_util.h	source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
R099	source/blender/modifiers/intern/MOD_gpencilbuild.c	source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
R099	source/blender/modifiers/intern/MOD_gpencilcolor.c	source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
R099	source/blender/modifiers/intern/MOD_gpencilhook.c	source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
R099	source/blender/modifiers/intern/MOD_gpencilinstance.c	source/blender/gpencil_modifiers/intern/MOD_gpencilinstance.c
R099	source/blender/modifiers/intern/MOD_gpencillattice.c	source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
R099	source/blender/modifiers/intern/MOD_gpencilnoise.c	source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
R099	source/blender/modifiers/intern/MOD_gpenciloffset.c	source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
R099	source/blender/modifiers/intern/MOD_gpencilopacity.c	source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
R099	source/blender/modifiers/intern/MOD_gpencilsimplify.c	source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
R099	source/blender/modifiers/intern/MOD_gpencilsmooth.c	source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
R099	source/blender/modifiers/intern/MOD_gpencilsubdiv.c	source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
R099	source/blender/modifiers/intern/MOD_gpencilthick.c	source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
R099	source/blender/modifiers/intern/MOD_gpenciltint.c	source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
A	source/blender/gpencil_modifiers/intern/MOD_util.c
A	source/blender/gpencil_modifiers/intern/MOD_util.h
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/intern/MOD_util.c

===================================================================

diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 5709ac723f4..57eecd1c71e 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -44,6 +44,7 @@ set(SRC_DNA_INC
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_fileglobal_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_freestyle_types.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_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_group_types.h
@@ -112,6 +113,7 @@ add_subdirectory(gpu)
 add_subdirectory(imbuf)
 add_subdirectory(nodes)
 add_subdirectory(modifiers)
+add_subdirectory(gpencil_modifiers)
 add_subdirectory(makesdna)
 add_subdirectory(makesrna)
 
diff --git a/source/blender/blenkernel/BKE_greapencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
similarity index 71%
rename from source/blender/blenkernel/BKE_greapencil_modifier.h
rename to source/blender/blenkernel/BKE_gpencil_modifier.h
index b93eb1e4abd..a29ad3f4ffc 100644
--- a/source/blender/blenkernel/BKE_greapencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -41,14 +41,49 @@ struct ViewLayer;
 struct ListBase;
 struct bArmature;
 struct Main;
-struct ModifierData;
+struct GreasePencilModifierData;
 struct BMEditMesh;
 struct DepsNodeHandle;
 struct bGPDlayer;
 struct bGPDframe;
 struct bGPDstroke;
 
-#ifdef TODO_GPENCIL_MODS
+typedef enum {
+	eModifierTypeFlag_AcceptsMesh = (1 << 0),
+	eModifierTypeFlag_AcceptsCVs = (1 << 1),
+	eModifierTypeFlag_SupportsMapping = (1 << 2),
+	eModifierTypeFlag_SupportsEditmode = (1 << 3),
+
+	/* For modifiers that support editmode this determines if the
+	* modifier should be enabled by default in editmode. This should
+	* only be used by modifiers that are relatively speedy and
+	* also generally used in editmode, otherwise let the user enable
+	* it by hand.
+	*/
+	eModifierTypeFlag_EnableInEditmode = (1 << 4),
+
+	/* For modifiers that require original data and so cannot
+	* be placed after any non-deformative modifier.
+	*/
+	eModifierTypeFlag_RequiresOriginalData = (1 << 5),
+
+	/* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
+	*/
+	eModifierTypeFlag_UsesPointCache = (1 << 6),
+
+	/* For physics modifiers, max one per type */
+	eModifierTypeFlag_Single = (1 << 7),
+
+	/* Some modifier can't be added manually by user */
+	eModifierTypeFlag_NoUserAdd = (1 << 8),
+
+	/* For modifiers that use CD_PREVIEW_MCOL for preview. */
+	eModifierTypeFlag_UsesPreview = (1 << 9),
+	eModifierTypeFlag_AcceptsLattice = (1 << 10),
+	/* Grease pencil modifiers (do not change mesh, only is placeholder) */
+	eModifierTypeFlag_GpencilMod = (1 << 11),
+} GreasePencilModifierTypeFlag;
+
 typedef struct GreasePencilModifierTypeInfo {
 	/* The user visible name for this modifier */
 	char name[32];
@@ -61,8 +96,8 @@ typedef struct GreasePencilModifierTypeInfo {
 	/* The size of the modifier data type, used by allocation. */
 	int structSize;
 
-	ModifierTypeType type;
-	ModifierTypeFlag flags;
+	GreasePencilModifierData type;
+	GreasePencilModifierTypeFlag flags;
 
 
 	/********************* Non-optional functions *********************/
@@ -70,7 +105,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	/* Copy instance data for this modifier type. Should copy all user
 	 * level settings to the target modifier.
 	 */
-	void (*copyData)(const struct ModifierData *md, struct ModifierData *target);
+	void (*copyData)(const struct GreasePencilModifierData *md, struct GreasePencilModifierData *target);
 
 
 	/******************* GP modifier functions *********************/
@@ -86,7 +121,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * The gps parameter contains the GP stroke to operate on. This is usually a copy
 	 * of the original (unmodified and saved to files) stroke data.
 	 */
-	void (*gp_deformStroke)(struct ModifierData *md, struct Depsgraph *depsgraph,
+	void (*gp_deformStroke)(struct GreasePencilModifierData *md, struct Depsgraph *depsgraph,
 	                     struct Object *ob, struct bGPDlayer *gpl, struct bGPDstroke *gps);
 
 	/* Callback for GP "geometry" modifiers that create extra geometry
@@ -100,7 +135,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * The modifier_index parameter indicates where the modifier is
 	 * in the modifier stack in relation to other modifiers.
 	 */
-	void (*gp_generateStrokes)(struct ModifierData *md, struct Depsgraph *depsgraph,
+	void (*gp_generateStrokes)(struct GreasePencilModifierData *md, struct Depsgraph *depsgraph,
 	                        struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf);
 
 	/* Bake-down GP modifier's effects into the GP datablock.
@@ -110,7 +145,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * datablock, mutating the geometry and/or creating new datablocks/objects
 	 */
 	void (*gp_bakeModifier)(struct Main *bmain, struct Depsgraph *depsgraph,
-                           struct ModifierData *md, struct Object *ob);
+                           struct GreasePencilModifierData *md, struct Object *ob);
 
 	/********************* Optional functions *********************/
 
@@ -119,7 +154,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * 
 	 * This function is optional.
 	 */
-	void (*initData)(struct ModifierData *md);
+	void (*initData)(struct GreasePencilModifierData *md);
 
 	/* Should return a CustomDataMask indicating what data this
 	 * modifier needs. If (mask & (1 << (layer type))) != 0, this modifier
@@ -137,14 +172,14 @@ typedef struct GreasePencilModifierTypeInfo {
 	 *
 	 * This function is optional.
 	 */
-	CustomDataMask (*requiredDataMask)(struct Object *ob, struct ModifierData *md);
+	CustomDataMask (*requiredDataMask)(struct Object *ob, struct GreasePencilModifierData *md);
 
 	/* Free internal modifier data variables, this function should
 	 * not free the md variable itself.
 	 *
 	 * This function is optional.
 	 */
-	void (*freeData)(struct ModifierData *md);
+	void (*freeData)(struct GreasePencilModifierData *md);
 
 	/* Return a boolean value indicating if this modifier is able to be
 	 * calculated based on the modifier data. This is *not* regarding the
@@ -154,13 +189,13 @@ typedef struct GreasePencilModifierTypeInfo {
 	 *
 	 * This function is optional (assumes never disabled if not present).
 	 */
-	bool (*isDisabled)(struct ModifierData *md, int userRenderParams);
+	bool (*isDisabled)(struct GreasePencilModifierData *md, int userRenderParams);
 
 	/* Add the appropriate relations to the dependency graph.
 	 *
 	 * This function is optional.
 	 */
-	void (*updateDepsgraph)(struct ModifierData *md,
+	void (*updateDepsgraph)(struct GreasePencilModifierData *md,
 	                        const ModifierUpdateDepsgraphContext *ctx);
  
 	/* Should return true if the modifier needs to be recalculated on time
@@ -168,7 +203,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 *
 	 * This function is optional (assumes false if not present).
 	 */
-	bool (*dependsOnTime)(struct ModifierData *md);
+	bool (*dependsOnTime)(struct GreasePencilModifierData *md);
 
 
 	/* True when a deform modifier uses normals, the requiredDataMask
@@ -178,7 +213,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * this is needed because applying 2 deform modifiers will give the
 	 * second modifier bogus normals.
 	 * */
-	bool (*dependsOnNormals)(struct ModifierData *md);
+	bool (*dependsOnNormals)(struct GreasePencilModifierData *md);
 
 
 	/* Should call the given walk function on with a pointer to each Object
@@ -187,7 +222,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 *
 	 * This function is optional.
 	 */
-	void (*foreachObjectLink)(struct ModifierData *md, struct Object *ob,
+	void (*foreachObjectLink)(struct GreasePencilModifierData *md, struct Object *ob,
 	                          ObjectWalkFunc walk, void *userData);
 
 	/* Should call the given walk function with a pointer to each ID
@@ -198,7 +233,7 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * This function is optional. If it is not present, foreachObjectLink
 	 * will be used.
 	 */
-	void (*foreachIDLink)(struct ModifierData *md, struct Object *ob,
+	void (*foreachIDLink)(struct GreasePencilModifierData *md, struct Object *ob,
 	                      IDWalkFunc walk, void *userData);
 
 	/* Should call the given walk function for each texture that the
@@ -208,21 +243,18 @@ typedef struct GreasePencilModifierTypeInfo {
 	 * This function is optional. If it is not present, it will be
 	 * assumed the modifier has no textures.
 	 */
-	void (*foreachTexLink)(struct ModifierData *md, struct Object *ob,
+	void (*foreachTexLink)(struct GreasePencilModifierData *md, struct Object *ob,
 	                       TexWalkFunc walk, void *userData);
-} ModifierTypeInfo;
+} GreasePencilModifierTypeInfo;
 
 /* Initialize modifier's global data (type info and some common global storages). */
 void BKE_modifier_init(void);
 
-const ModifierTypeInfo *modifierType_getInfo(ModifierType type);
+const GreasePencilModifierTypeInfo *modifierType_getInfo(GreasePencilModifierType type);
 
-struct ModifierData  *modifier_new(int type);
-void          modifier_free_ex(struct ModifierData *md, const int flag);
-void          modifier_free(struct ModifierData *md);
-#endif /* TODO_GPENCIL_MODS */
+struct GreasePencilModifierData  *modifier_new(int type);
+void          modifier_free_ex(struct GreasePencilModifierData *md, const int flag);
+void          modifier_free(struct GreasePencilModifierData *md);
 
 bool          greasepencil_modifier_unique_name(struct ListBase *modifiers, struct GreasePencilModifierData *gmd);
 
-#endif
-
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 867b5884114..356115397a5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -114,6 +114,7 @@ set(SRC
 	intern/font.c
 	intern/freestyle.c
 	intern/gpencil.c
+	intern/gpencil_modifier.c
 	intern/icons.c
 	intern/icons_rasterize.c
 	intern/idcode.c
@@ -25

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list