[Bf-blender-cvs] [0b7cc1198b5] greasepencil-object: Remove VFX (more cleanup)

Antonio Vazquez noreply at git.blender.org
Tue May 8 18:10:04 CEST 2018


Commit: 0b7cc1198b523f731e97971f350d29f1440b57ac
Author: Antonio Vazquez
Date:   Tue May 8 17:55:14 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0b7cc1198b523f731e97971f350d29f1440b57ac

Remove VFX (more cleanup)

More changes to remove VFX modifiers and DOF.

Removed some unused code not removed in previous commit.

The temp texture A reused by general drawing has been enabled again (removed by error in previous commit) and renamed.

Fixed some lines removed by error in previous commit.

The modifer number in DNA_modifiers_types.h has been realigned to avoid any gap. This could produce some problems importing Hero files. Need check.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_util.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 993f440bc89..10a61368456 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1874,82 +1874,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.separator()
         layout.prop(md, "strength", slider=True)
 
-    def GP_BLUR(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Factor:")
-        col.prop(md, "factor", text="")
-        col.separator()
-        col.prop(md, "samples", text="Samples")
-
-        col.separator()
-        col.prop(md, "use_dof_mode")
-        if md.use_dof_mode:
-            col.prop(md, "coc")
-
-
-    def GP_WAVE(self, layout, ob, md):
-        row = layout.row(align=True)
-        row.prop(md, "orientation", expand=True)
-
-        split = layout.split()
-        col = split.column()
-        col.separator()
-        col.label(text="Wave:")
-        col.prop(md, "amplitude")
-        col.prop(md, "period")
-        col.prop(md, "phase")
-
-    def GP_PIXEL(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Size:")
-        col.prop(md, "size", text="")
-
-        col.separator()
-        col.prop(md, "use_lines")
-
-        row = col.row()
-        col = row.column()
-        col.enabled = md.use_lines
-        col.prop(md, "color")
-
-    def GP_SWIRL(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Object:")
-        col.prop(md, "object", text="")
-
-        col.separator()
-        col.prop(md, "radius")
-        col.prop(md, "angle")
-
-        col.separator()
-        col.prop(md, "transparent")
-
-    def GP_FLIP(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.prop(md, "flip_horizontal")
-        col.prop(md, "flip_vertical")
-
-    def GP_LIGHT(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Object:")
-        col.prop(md, "object", text="")
-
-        col = split.column(align=True)
-        col.label("Settings:")
-        col.prop(md, "energy")
-        col.prop(md, "ambient")
-
-
     def GP_HOOK(self, layout, ob, md):
         gpd = ob.data
         split = layout.split()
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index e82b82fe6a0..28a09515654 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -115,7 +115,6 @@ set(SRC
 	engines/gpencil/gpencil_cache_utils.c
 	engines/gpencil/gpencil_draw_cache_impl.c
 	engines/gpencil/gpencil_geom.c
-	engines/gpencil/gpencil_depth_of_field.c
 
 	DRW_engine.h
 	intern/DRW_render.h
@@ -297,8 +296,6 @@ data_to_c_simple(engines/gpencil/shaders/gpencil_paper_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_edit_point_vert.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_edit_point_geom.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_edit_point_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_dof_vert.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_dof_frag.glsl SRC)
 
 list(APPEND INC
 )
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 909e5024232..b8414236d7c 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -89,6 +89,16 @@ static void GPENCIL_create_framebuffers(void *vedata)
 	if (DRW_state_is_fbo()) {
 		const float *viewport_size = DRW_viewport_size_get();
 		const int size[2] = { (int)viewport_size[0], (int)viewport_size[1] };
+		
+		/* temp textures */
+		e_data.temp_depth_tx_a = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH24_STENCIL8,
+			&draw_engine_object_type);
+		e_data.temp_color_tx_a = DRW_texture_pool_query_2D(size[0], size[1], fb_format,
+			&draw_engine_object_type);
+		GPU_framebuffer_ensure_config(&fbl->temp_fb_a, {
+			GPU_ATTACHMENT_TEXTURE(e_data.temp_depth_tx_a),
+			GPU_ATTACHMENT_TEXTURE(e_data.temp_color_tx_a)
+			});
 
 		/* painting framebuffer to speed up drawing process (always 16 bits) */
 		e_data.painting_depth_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH24_STENCIL8,
@@ -163,30 +173,6 @@ static void GPENCIL_create_shaders(void)
 	}
 }
 
-static void GPENCIL_init_dof(void *vedata)
-{
-	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
-
-	const DRWContextState *draw_ctx = DRW_context_state_get();
-	View3D *v3d = draw_ctx->v3d;
-	RegionView3D *rv3d = draw_ctx->rv3d;
-	ViewLayer *view_layer = draw_ctx->view_layer;
-	IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE);
-
-	if ((DRW_state_is_opengl_render()) || (!DRW_state_is_image_render())) {
-		/* viewport and opengl render */
-		stl->storage->enable_dof = GP_IS_CAMERAVIEW && BKE_collection_engine_property_value_get_bool(props, "dof_enable");
-		if (stl->storage->enable_dof == true) {
-			Object *camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL;
-			GPENCIL_depth_of_field_init(&draw_engine_gpencil_type, &e_data, vedata, camera);
-		}
-	}
-	else {
-		/* render F12 */
-		stl->storage->enable_dof = BKE_collection_engine_property_value_get_bool(props, "dof_enable");
-	}
-}
-
 static void GPENCIL_engine_init(void *vedata)
 {
 	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
@@ -209,9 +195,6 @@ static void GPENCIL_engine_init(void *vedata)
 	if (!e_data.gpencil_blank_texture) {
 		e_data.gpencil_blank_texture = DRW_gpencil_create_blank_texture(16, 16);
 	}
-
-	/* init depth of field */ 
-	GPENCIL_init_dof(vedata);
 }
 
 static void GPENCIL_engine_free(void)
@@ -226,10 +209,6 @@ static void GPENCIL_engine_free(void)
 	DRW_SHADER_FREE_SAFE(e_data.gpencil_painting_sh);
 	DRW_SHADER_FREE_SAFE(e_data.gpencil_paper_sh);
 
-	DRW_SHADER_FREE_SAFE(e_data.gpencil_dof_downsample_sh);
-	DRW_SHADER_FREE_SAFE(e_data.gpencil_dof_scatter_sh);
-	DRW_SHADER_FREE_SAFE(e_data.gpencil_dof_resolve_sh);
-
 	DRW_TEXTURE_FREE_SAFE(e_data.gpencil_blank_texture);
 }
 
@@ -282,10 +261,6 @@ static void GPENCIL_cache_init(void *vedata)
 		stl->shgroups = MEM_mallocN(sizeof(GPENCIL_shgroup) * GPENCIL_MAX_SHGROUPS, "GPENCIL_shgroup");
 	}
 
-	if (!stl->vfx) {
-		stl->vfx = MEM_mallocN(sizeof(GPENCIL_vfx) * GPENCIL_MAX_GP_OBJ, "GPENCIL_vfx");
-	}
-	
 	/* init gp objects cache */
 	stl->g_data->gp_cache_used = 0;
 	stl->g_data->gp_cache_size = 0;
@@ -384,19 +359,10 @@ static void GPENCIL_cache_init(void *vedata)
 		DRWShadingGroup *mix_shgrp_noblend = DRW_shgroup_create(e_data.gpencil_fullscreen_sh, psl->mix_pass_noblend);
 		stl->g_data->tot_sh++;
 		DRW_shgroup_call_add(mix_shgrp_noblend, quad_noblend, NULL);
-		DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeColor", &e_data.vfx_color_tx_a);
-		DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeDepth", &e_data.vfx_depth_tx_a);
+		DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeColor", &e_data.temp_color_tx_a);
+		DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeDepth", &e_data.temp_depth_tx_a);
 		DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", &stl->storage->tonemapping, 1);
 
-		/* vfx copy pass from txtb to txta */
-		struct Gwn_Batch *vfxquad = DRW_cache_fullscreen_quad_get();
-		psl->vfx_copy_pass = DRW_pass_create("GPencil VFX Copy b to a Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
-		DRWShadingGroup *vfx_copy_shgrp = DRW_shgroup_create(e_data.gpencil_simple_fullscreen_sh, psl->vfx_copy_pass);
-		stl->g_data->tot_sh++;
-		DRW_shgroup_call_add(vfx_copy_shgrp, vfxquad, NULL);
-		DRW_shgroup_uniform_texture_ref(vfx_copy_shgrp, "strokeColor", &e_data.vfx_color_tx_b);
-		DRW_shgroup_uniform_texture_ref(vfx_copy_shgrp, "strokeDepth", &e_data.vfx_depth_tx_b);
-
 		/* Painting session pass (used only to speedup while the user is drawing ) */
 		struct Gwn_Batch *paintquad = DRW_cache_fullscreen_quad_get();
 		psl->painting_pass = DRW_pass_create("GPencil Painting Session Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
@@ -430,9 +396,6 @@ static void GPENCIL_cache_init(void *vedata)
 			}
 			DRW_shgroup_uniform_int(paper_shgrp, "uselines", &stl->storage->uselines, 1);
 		}
-
-		/* depth of field */
-		GPENCIL_depth_of_field_cache_init(&e_data, vedata);
 	}
 }
 
@@ -486,9 +449,7 @@ static void GPENCIL_cache_finish(void *vedata)
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	Scene *scene = draw_ctx->scene;
 	ToolSettings *ts = scene->toolsettings;
-	tGPencilObjectCache *cache;
 	bool is_multiedit = false; 
-	// bool playing = (bool)stl->storage->playing;
 
 	/* if painting session, don't need to do more */
 	if (stl->g_data->session_flag & GP_DRW_PAINT_PAINTING) {
@@ -622,11 +583,8 @@ static void GPENCIL_draw_scene(void *vedata)
 
 	if (DRW_state_is_fbo()) {
 		/* attach temp textures */
-		GPU_framebuffer_texture_attach(fbl->vfx_fb_a, e_data.vfx_depth_tx_a, 0, 0);
-		GPU_framebuffer_texture_attach(fbl->vfx_fb_a, e_data.vfx_color_tx_a, 0, 0);
-
-		GPU_framebuffer_texture_attach(fbl->vfx_fb_b, e_data.vfx_depth_tx_b, 0, 0);
-		GPU_framebuffer_texture_attach(fbl->vfx_fb_b, e_data.vfx_color_tx_b, 0, 0);
+		GPU_framebuffer_texture_attach(fbl->temp_fb_a, e_data.temp_depth_tx_a, 0, 0);
+		GPU_framebuffer_texture_attach(fbl->temp_fb_a, e_data.temp_color_tx_a, 0, 0);
 
 		GPU_framebuffer_texture_attach(fbl->painting_fb, e_data.painting_depth_tx, 0, 0);
 		GPU_framebuffer_texture_attach(fbl->painting_fb, e_data.painting_color_tx, 0, 0);
@@ -645,8 +603,8 @@ static void GPENCIL_draw_scene(void *vedata)
 				init_grp = cache->init_grp;
 				end_grp = cache->end_grp;
 				/* Render stroke in separated framebuffer */
-				GPU_framebuffer_bind(fbl->vfx_fb_a);
-				GPU_framebuffer_clear_color_depth(fbl->vfx_fb_a, clearcol, 1.0f);
+				GPU_framebuffer_bind(fbl->temp_fb_a);
+				GPU_framebuffer_clear_color_depth(fbl->temp_fb_a, clea

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list