[Bf-blender-cvs] [88972d16985] greasepencil-object: Cleanup - Various cleanups for GP modifier files

Joshua Leung noreply at git.blender.org
Sat Nov 4 05:48:11 CET 2017


Commit: 88972d16985fe36c7a62cfd28cf59e069f0e2468
Author: Joshua Leung
Date:   Tue Oct 31 16:38:59 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB88972d16985fe36c7a62cfd28cf59e069f0e2468

Cleanup - Various cleanups for GP modifier files

* Remove redundant checks
* Use M_PI_2 instead of hardcoding a magic number
* Fix license text year info
* Properly handle new palette creation in Tint modifier

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

M	source/blender/editors/object/object_modifier.c
M	source/blender/modifiers/intern/MOD_gpencilarray.c
M	source/blender/modifiers/intern/MOD_gpencilblur.c
M	source/blender/modifiers/intern/MOD_gpencilcolor.c
M	source/blender/modifiers/intern/MOD_gpencildupli.c
M	source/blender/modifiers/intern/MOD_gpencillattice.c
M	source/blender/modifiers/intern/MOD_gpencilnoise.c
M	source/blender/modifiers/intern/MOD_gpencilopacity.c
M	source/blender/modifiers/intern/MOD_gpencilpixel.c
M	source/blender/modifiers/intern/MOD_gpencilsimplify.c
M	source/blender/modifiers/intern/MOD_gpencilsubdiv.c
M	source/blender/modifiers/intern/MOD_gpencilswirl.c
M	source/blender/modifiers/intern/MOD_gpencilthick.c
M	source/blender/modifiers/intern/MOD_gpenciltint.c
M	source/blender/modifiers/intern/MOD_gpencilwave.c

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

diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index e439550245e..dd4b5e0eda0 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -668,7 +668,7 @@ static int modifier_apply_obdata(ReportList *reports, const bContext *C, Scene *
 		DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 	else if (ob->type == OB_GPENCIL) {
-		if (mti->bakeModifierGP == NULL)
+		if (ELEM(NULL, mti->bakeModifierGP, ob, ob->data))
 			return 0;
 		
 		mti->bakeModifierGP(C, &eval_ctx, md, ob);
diff --git a/source/blender/modifiers/intern/MOD_gpencilarray.c b/source/blender/modifiers/intern/MOD_gpencilarray.c
index 9aa01a0ca15..3ba65d263b9 100644
--- a/source/blender/modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/modifiers/intern/MOD_gpencilarray.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -113,15 +113,11 @@ static void bakeModifierGP(const bContext *C, const EvaluationContext *UNUSED(ev
 	float mat[4][4], finalmat[4][4];
 	float rot[3];
 
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-
 	/* reset random */
 	mmd->rnd[0] = 1;
-	for (int x = 0; x < mmd->count[0]; ++x) {
-		for (int y = 0; y < mmd->count[1]; ++y) {
-			for (int z = 0; z < mmd->count[2]; ++z) {
+	for (int x = 0; x < mmd->count[0]; x++) {
+		for (int y = 0; y < mmd->count[1]; y++) {
+			for (int z = 0; z < mmd->count[2]; z++) {
 				ARRAY_SET_ITEMS(xyz, x, y, z);
 				if ((x == 0) && (y == 0) && (z == 0)) {
 					continue;
diff --git a/source/blender/modifiers/intern/MOD_gpencilblur.c b/source/blender/modifiers/intern/MOD_gpencilblur.c
index 25cb5bfeb2c..ffb4055d5cf 100644
--- a/source/blender/modifiers/intern/MOD_gpencilblur.c
+++ b/source/blender/modifiers/intern/MOD_gpencilblur.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
diff --git a/source/blender/modifiers/intern/MOD_gpencilcolor.c b/source/blender/modifiers/intern/MOD_gpencilcolor.c
index 53e87af019e..69a5e65e0aa 100644
--- a/source/blender/modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/modifiers/intern/MOD_gpencilcolor.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -64,12 +64,9 @@ static void bakeModifierGP(const bContext *C, const EvaluationContext *UNUSED(ev
                            ModifierData *md, Object *ob)
 {
 	GpencilColorModifierData *mmd = (GpencilColorModifierData *)md;
-	bGPdata *gpd;
+	bGPdata *gpd = ob->data;
 	Palette *newpalette = NULL;
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-	gpd = ob->data;
+	
 	GHash *gh_layer = BLI_ghash_str_new("GP_Color Layer modifier");
 	GHash *gh_color;
 
diff --git a/source/blender/modifiers/intern/MOD_gpencildupli.c b/source/blender/modifiers/intern/MOD_gpencildupli.c
index 32b289def6e..2c0104f2717 100644
--- a/source/blender/modifiers/intern/MOD_gpencildupli.c
+++ b/source/blender/modifiers/intern/MOD_gpencildupli.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -69,11 +69,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 static void bakeModifierGP(const bContext *C, const EvaluationContext *UNUSED(eval_ctx),
                            ModifierData *md, Object *ob)
 {
-	bGPdata *gpd;
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-	gpd = ob->data;
+	bGPdata *gpd = ob->data;
 
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
diff --git a/source/blender/modifiers/intern/MOD_gpencillattice.c b/source/blender/modifiers/intern/MOD_gpencillattice.c
index 7f29b836e5d..f68aeec973b 100644
--- a/source/blender/modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/modifiers/intern/MOD_gpencillattice.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -73,15 +73,10 @@ static void bakeModifierGP(const bContext *C, const EvaluationContext *eval_ctx,
 	LatticeDeformData *ldata = NULL;
 	Scene *scene = md->scene;
 	Main *bmain = CTX_data_main(mmd->C);
-	bGPdata *gpd;
-	Object *latob = NULL;
+	bGPdata *gpd = ob->data;
+	Object *latob = mmd->object;
 	int oldframe = CFRA;
 
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-	gpd = ob->data;
-	latob = mmd->object;
 	if ((!latob) || (latob->type != OB_LATTICE)) {
 		return;
 	}
diff --git a/source/blender/modifiers/intern/MOD_gpencilnoise.c b/source/blender/modifiers/intern/MOD_gpencilnoise.c
index 396f8a8848e..93c7abe8072 100644
--- a/source/blender/modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/modifiers/intern/MOD_gpencilnoise.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
diff --git a/source/blender/modifiers/intern/MOD_gpencilopacity.c b/source/blender/modifiers/intern/MOD_gpencilopacity.c
index 9600df0c9cf..ee9f3505952 100644
--- a/source/blender/modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/modifiers/intern/MOD_gpencilopacity.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -62,12 +62,8 @@ static void copyData(ModifierData *md, ModifierData *target)
 static void bakeModifierGP(const bContext *C, const EvaluationContext *UNUSED(eval_ctx),
                            ModifierData *md, Object *ob)
 {
-	bGPdata *gpd;
-
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-	gpd = ob->data;
+	bGPdata *gpd = ob->data;
+	
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 			for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
diff --git a/source/blender/modifiers/intern/MOD_gpencilpixel.c b/source/blender/modifiers/intern/MOD_gpencilpixel.c
index df61e21fe2f..f5329d4e8e0 100644
--- a/source/blender/modifiers/intern/MOD_gpencilpixel.c
+++ b/source/blender/modifiers/intern/MOD_gpencilpixel.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
diff --git a/source/blender/modifiers/intern/MOD_gpencilsimplify.c b/source/blender/modifiers/intern/MOD_gpencilsimplify.c
index f9c59000bb8..ae80978ff91 100644
--- a/source/blender/modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/modifiers/intern/MOD_gpencilsimplify.c
@@ -15,8 +15,8 @@
  * 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) 2005 by the Blender Foundation.
- * All rights reserved.
+ * The Original Code is Copyright (C) 2017, Blender Foundation
+ * This is a new part of Blender
  *
  * Contributor(s): Antonio Vazquez
  *
@@ -59,11 +59,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 static void bakeModifierGP(const bContext *C, const EvaluationContext *UNUSED(eval_ctx),
                            ModifierData *md, Object *ob)
 {
-	bGPdata *gpd;
-	if ((!ob) || (!ob->data)) {
-		return;
-	}
-	gpd = ob->data;
+	bGPdata *gpd = ob->data;
 
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
diff --git a/source/blender/modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/modifiers/intern/MOD_gpencilsubdiv.c
index 46ff97c3c2c..fe33ef28239 100644
--- a/source/blender/modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/modifiers/intern/MOD_gpencilsubdiv.c
@@ -15,8 +15,8 @@
  * 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) 2005 b

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list