[Bf-blender-cvs] [b9256d122f1] greasepencil-object: Move simplify options to Scene->RenderData struct

Antonio Vazquez noreply at git.blender.org
Tue May 22 19:18:58 CEST 2018


Commit: b9256d122f1099a6158c3d8c27489bc3e5753b62
Author: Antonio Vazquez
Date:   Tue May 22 19:18:37 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb9256d122f1099a6158c3d8c27489bc3e5753b62

Move simplify options to Scene->RenderData struct

Before these change, the settings were defined in ToolSettings struct, but must be in the same struct that other scene simplify options.

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

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index cc9677cbb75..fe328e2646e 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -437,28 +437,25 @@ class SCENE_PT_gp_simplify(SceneButtonsPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
 
     def draw_header(self, context):
-        ts = context.tool_settings
-        self.layout.prop(ts, "gpencil_simplify", text="")
+        rd = context.scene.render
+        self.layout.prop(rd, "simplify_gpencil", text="")
 
     def draw(self, context):
         layout = self.layout
 
-        ts = context.tool_settings
+        rd = context.scene.render
 
-        layout.active = ts.gpencil_simplify
+        layout.active = rd.simplify_gpencil
 
         row = layout.row()
-        row.prop(ts, "gpencil_simplify_onplay", text="Only on Play")
+        row.prop(rd, "simplify_gpencil_onplay", text="Only on Play")
 
         split = layout.split()
 
         col = split.column()
-        col.prop(ts, "gpencil_simplify_view_fill", text="Fill")
-        col.prop(ts, "gpencil_simplify_remove_lines", text="Remove Fill Lines")
-        col.prop(ts, "gpencil_simplify_view_modifier", text="Modifiers")
-
-        row = layout.row()
-        row.prop(ts, "gpencil_disable_fast_drawing")
+        col.prop(rd, "simplify_gpencil_view_fill", text="Fill")
+        col.prop(rd, "simplify_gpencil_remove_lines", text="Remove Fill Lines")
+        col.prop(rd, "simplify_gpencil_view_modifier", text="Modifiers")
 
 
 class SCENE_PT_viewport_display(SceneButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 9e2b60d0619..6a559503da9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1,3 +1,4 @@
+/*
 /*
  * Copyright 2017, Blender Foundation.
  *
@@ -676,6 +677,8 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 {
 	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
 	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
+	const DRWContextState *draw_ctx = DRW_context_state_get();
+	Scene *scene = draw_ctx->scene;
 	bGPDstroke *gps, *src_gps;
 	DRWShadingGroup *fillgrp;
 	DRWShadingGroup *strokegrp;
@@ -729,7 +732,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 		}
 
 		/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is enabled */
-		if ((stl->storage->simplify_fill) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE)) {
+		if ((stl->storage->simplify_fill) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE)) {
 			if ((gp_style->fill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || 
 			    (gp_style->fill_style > GP_STYLE_FILL_STYLE_SOLID))
 			{
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index b7870694070..ec5c7ddf7bd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -282,8 +282,8 @@ void GPENCIL_cache_init(void *vedata)
 		stl->storage->is_render = DRW_state_is_image_render();
 
 		/* save simplify flags (can change while drawing, so it's better to save) */
-		stl->storage->simplify_fill = GP_SIMPLIFY_FILL(ts, stl->storage->playing);
-		stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(ts, stl->storage->playing);
+		stl->storage->simplify_fill = GP_SIMPLIFY_FILL(scene, stl->storage->playing);
+		stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(scene, stl->storage->playing);
 
 		/* save pixsize */
 		stl->storage->pixsize = DRW_viewport_pixelsize_get();
@@ -294,8 +294,7 @@ void GPENCIL_cache_init(void *vedata)
 		/* detect if painting session */
 		if ((obact_gpd) &&
 		    (obact_gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
-		    (stl->storage->playing == 0) &&
-		    ((ts->gpencil_simplify & GP_TOOL_FLAG_DISABLE_FAST_DRAWING) == 0))
+		    (stl->storage->playing == 0))
 		{
 			if (((obact_gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) && (obact_gpd->sbuffer_size > 1)) {
 				stl->g_data->session_flag = GP_DRW_PAINT_PAINTING;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 1485a38d29a..fb6166cd493 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -49,10 +49,10 @@ struct RenderLayer;
 #define GPENCIL_COLOR_TEXTURE 1
 #define GPENCIL_COLOR_PATTERN 2
 
-#define GP_SIMPLIFY(ts) ((ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY))
-#define GP_SIMPLIFY_ONPLAY(playing) (((playing == true) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY)) || ((ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_ON_PLAY) == 0))
-#define GP_SIMPLIFY_FILL(ts, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(ts)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL))) 
-#define GP_SIMPLIFY_MODIF(ts, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(ts)) && (ts->gpencil_simplify & GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF))) 
+#define GP_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
+#define GP_SIMPLIFY_ONPLAY(playing) (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0))
+#define GP_SIMPLIFY_FILL(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL))) 
+#define GP_SIMPLIFY_MODIF(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER))) 
 
 #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera))
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 14055a6cc7a..a1b62691f26 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -685,7 +685,8 @@ typedef struct RenderData {
 	/* render simplify */
 	short simplify_subsurf;
 	short simplify_subsurf_render;
-	short pad9, pad10;
+	short simplify_gpencil;
+	short pad10;
 	float simplify_particles;
 	float simplify_particles_render;
 
@@ -1262,9 +1263,7 @@ typedef struct ToolSettings {
 	char gpencil_seq_align; /*                          : Sequencer Preview */
 	char gpencil_ima_align; /*                          : Image Editor */
 
-	short gpencil_simplify; /* simplify flags for grease pencil */
-	char pad6[2];
-
+	char pad6[4];
 	/* Grease Pencil Sculpt */
 	struct GP_BrushEdit_Settings gp_sculpt;
 
@@ -2034,20 +2033,18 @@ typedef enum eGPencil_Flags {
 	GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2),
 } eGPencil_Flags;
 
-/* toolsettings->gpencil_simplify */
+/* scene->simplify_gpencil */
 typedef enum eGPencil_SimplifyFlags {
 	/* Simplify */
-	GP_TOOL_FLAG_SIMPLIFY = (1 << 0),
+	SIMPLIFY_GPENCIL_ENABLE = (1 << 0),
 	/* Simplify on play */
-	GP_TOOL_FLAG_SIMPLIFY_ON_PLAY = (1 << 1),
+	SIMPLIFY_GPENCIL_ON_PLAY = (1 << 1),
 	/* Simplify fill on viewport */
-	GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL = (1 << 2),
+	SIMPLIFY_GPENCIL_FILL = (1 << 2),
 	/* Simplify modifier on viewport */
-	GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF = (1 << 3),
+	SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
 	/* Remove fill external line */
-	GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE = (1 << 8),
-	/* Disable fast drawing */
-	GP_TOOL_FLAG_DISABLE_FAST_DRAWING = (1 << 9),
+	SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 8),
 } eGPencil_SimplifyFlags;
 
 /* ToolSettings.gpencil_*_align - Stroke Placement mode flags */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 96487a1e051..0c2cd5fbf2c 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2459,37 +2459,6 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 	RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
-	/* Grease Pencil - Simplify Options */
-	prop = RNA_def_property(srna, "gpencil_simplify", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY);
-	RNA_def_property_ui_text(prop, "Simplify", "Simplify Grease Pencil Drawing");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-	prop = RNA_def_property(srna, "gpencil_simplify_onplay", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_ON_PLAY);
-	RNA_def_property_ui_text(prop, "On Play", "Simplify Grease Pencil only when play animation");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-	prop = RNA_def_property(srna, "gpencil_simplify_view_fill", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_VIEW_FILL);
-	RNA_def_property_ui_text(prop, "Fill", "Do not fill strokes on viewport");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-	prop = RNA_def_property(srna, "gpencil_simplify_remove_lines", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_REMOVE_LINE);
-	RNA_def_property_ui_text(prop, "Remove Lines", "Remove External Lines of Filling Strokes");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-	prop = RNA_def_property(srna, "gpencil_simplify_view_modifier", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_SIMPLIFY_VIEW_MODIF);
-	RNA_def_property_ui_text(prop, "Fill", "Do not apply modifiers on viewport");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-	prop = RNA_def_property(srna, "gpencil_disable_fast_drawing", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_simplify", GP_TOOL_FLAG_DISABLE_FAST_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list