[Bf-blender-cvs] [740f33d8a20] blender2.8: Remove "Modern Viewport"

Dalai Felinto noreply at git.blender.org
Thu May 18 18:47:10 CEST 2017


Commit: 740f33d8a20eac253696b20f9e6477dfd649ab43
Author: Dalai Felinto
Date:   Thu May 18 18:34:04 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB740f33d8a20eac253696b20f9e6477dfd649ab43

Remove "Modern Viewport"

The "Modern Viewport" was an option in the Viewport panel that would use
the new fancy wire frame code and some depth debugging functionality.

This was introduced as a quick and dirty way to get the new drawing
system showing in the viewport.

Overtime we built a complete Draw Manager system, leaving this original
approach deprecated which adds clutter to Blender code since it would be
removed sooner or later.

Note: The new fancy wireframes and related shaders (white out other
objects) are still in Blender code, though you can't use them anymore.

If we are to have any of those drawing options they should be integrated
in the new draw manager, instead of integrated in the old drawing
pipeline as it was originally coded.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_header.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 8a429690f10..cb963c773a8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3128,48 +3128,6 @@ class VIEW3D_MT_edit_gpencil_interpolate(Menu):
 
 # ********** Panel **********
 
-
-class VIEW3D_PT_viewport_debug(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Modern Viewport"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        view = context.space_data
-        return (view)
-
-    def draw_header(self, context):
-        view = context.space_data
-        self.layout.prop(view, "use_modern_viewport", text="")
-
-    def draw(self, context):
-        layout = self.layout
-        view = context.space_data
-
-        layout.active = view.use_modern_viewport
-
-        col = layout.column()
-        col.label(text="Placeholder for debugging options")
-        col.separator()
-
-        row = col.row()
-        row.active = not view.show_combined_depth
-        row.prop(view, "show_scene_depth")
-        row = col.row()
-        row.active = not view.show_scene_depth
-        row.prop(view, "show_combined_depth")
-
-        row = col.row(align=True)
-        row.active = view.show_scene_depth or view.show_combined_depth
-        row.prop(view, "debug_near")
-        row.prop(view, "debug_far")
-
-        col.label(text="Background:")
-        col.row(align=True).prop(view, "debug_background", expand=True)
-
-
 class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
@@ -3283,7 +3241,7 @@ class VIEW3D_PT_view3d_display(Panel):
     @classmethod
     def poll(cls, context):
         view = context.space_data
-        return (view) and not view.use_modern_viewport
+        return (view)
 
     def draw(self, context):
         layout = self.layout
@@ -3383,11 +3341,6 @@ class VIEW3D_PT_view3d_shading(Panel):
     bl_region_type = 'UI'
     bl_label = "Shading"
 
-    @classmethod
-    def poll(cls, context):
-        view = context.space_data
-        return (view) and not view.use_modern_viewport
-
     def draw(self, context):
         layout = self.layout
 
@@ -3944,7 +3897,6 @@ classes = (
     VIEW3D_MT_edit_armature_delete,
     VIEW3D_MT_edit_gpencil_transform,
     VIEW3D_MT_edit_gpencil_interpolate,
-    VIEW3D_PT_viewport_debug,
     VIEW3D_PT_grease_pencil,
     VIEW3D_PT_grease_pencil_palettecolor,
     VIEW3D_PT_view3d_properties,
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6f8e5efee2a..cbb30d87ca8 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4990,7 +4990,7 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3
 	dm->release(dm);
 }
 
-static bool draw_mesh_object_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, BaseLegacy *base,
+static bool UNUSED_FUNCTION(draw_mesh_object_new)(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, BaseLegacy *base,
                                  const char dt, const unsigned char ob_wire_col[4], const short dflag)
 {
 	Object *ob = base->object;
@@ -8706,22 +8706,15 @@ void draw_object(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, Base *b
 		}
 
 		/* TODO Viewport: draw only for selection */
-		if (!IS_VIEWPORT_LEGACY(v3d)) {
-			if ((dflag & DRAW_PICKING) == 0) {
-				if ((dt == OB_BOUNDBOX) || ELEM(ob->type, OB_EMPTY, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
-					goto afterdraw;
+		if ((dflag & DRAW_PICKING) == 0) {
+			if ((dt == OB_BOUNDBOX) || ELEM(ob->type, OB_EMPTY, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
+				goto afterdraw;
 				}
-			}
 		}
 
 		switch (ob->type) {
 			case OB_MESH:
-				if (IS_VIEWPORT_LEGACY(v3d)) {
-					empty_object = draw_mesh_object(scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
-				}
-				else {
-					empty_object = draw_mesh_object_new(scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
-				}
+				empty_object = draw_mesh_object(scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
 				if ((dflag & DRAW_CONSTCOLOR) == 0) {
 					/* mesh draws wire itself */
 					dtx &= ~OB_DRAWWIRE;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 9c18d5d90a0..13a06cbde8c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -97,30 +97,6 @@
 
 #include "view3d_intern.h"  /* own include */
 
-/* prototypes */
-static void draw_all_objects(const bContext *C, ARegion *ar, const bool only_depth, const bool use_depth);
-
-typedef struct DrawData {
-	rcti border_rect;
-	bool render_border;
-	bool clip_border;
-	bool is_render;
-	GPUViewport *viewport;
-} DrawData;
-
-static void view3d_draw_data_init(const bContext *C, ARegion *ar, RegionView3D *rv3d, DrawData *draw_data)
-{
-	Scene *scene = CTX_data_scene(C);
-	View3D *v3d = CTX_wm_view3d(C);
-
-	draw_data->is_render = (v3d->drawtype == OB_RENDER);
-
-	draw_data->render_border = ED_view3d_calc_render_border(scene, v3d, ar, &draw_data->border_rect);
-	draw_data->clip_border = (draw_data->render_border && !BLI_rcti_compare(&ar->drawrct, &draw_data->border_rect));
-
-	draw_data->viewport = rv3d->viewport;
-}
-
 /* ******************** general functions ***************** */
 
 static bool use_depth_doit(Scene *scene, View3D *v3d)
@@ -140,13 +116,6 @@ static bool use_depth_doit(Scene *scene, View3D *v3d)
 	return false;
 }
 
-static bool use_depth(const bContext *C)
-{
-	View3D *v3d = CTX_wm_view3d(C);
-	Scene *scene = CTX_data_scene(C);
-	return use_depth_doit(scene, v3d);
-}
-
 /**
  * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore
  */
@@ -331,77 +300,6 @@ void ED_view3d_draw_setup_view(
 	}
 }
 
-/* ******************** debug ***************** */
-
-#define VIEW3D_DRAW_DEBUG 1
-/* TODO: expand scope of this flag so UI reflects the underlying code */
-
-#if VIEW3D_DRAW_DEBUG
-
-static void view3d_draw_debug_store_depth(ARegion *UNUSED(ar), DrawData *draw_data)
-{
-	GPUViewport *viewport = draw_data->viewport;
-	GLint viewport_size[4];
-	glGetIntegerv(GL_VIEWPORT, viewport_size);
-
-	const int x = viewport_size[0];
-	const int y = viewport_size[1];
-	const int w = viewport_size[2];
-	const int h = viewport_size[3];
-
-	if (GPU_viewport_debug_depth_is_valid(viewport)) {
-		if ((GPU_viewport_debug_depth_width(viewport) != w) ||
-		    (GPU_viewport_debug_depth_height(viewport) != h))
-		{
-			GPU_viewport_debug_depth_free(viewport);
-		}
-	}
-
-	if (!GPU_viewport_debug_depth_is_valid(viewport)) {
-		char error[256];
-		if (!GPU_viewport_debug_depth_create(viewport, w, h, error)) {
-			fprintf(stderr, "Failed to create depth buffer for debug: %s\n", error);
-			return;
-		}
-	}
-
-	GPU_viewport_debug_depth_store(viewport, x, y);
-}
-
-static void view3d_draw_debug_post_solid(const bContext *C, ARegion *ar, DrawData *draw_data)
-{
-	View3D *v3d = CTX_wm_view3d(C);
-
-	if ((v3d->tmp_compat_flag & V3D_DEBUG_SHOW_SCENE_DEPTH) != 0) {
-		view3d_draw_debug_store_depth(ar, draw_data);
-	}
-}
-
-static void view3d_draw_debug(const bContext *C, ARegion *ar, DrawData *draw_data)
-{
-	View3D *v3d = CTX_wm_view3d(C);
-
-	if ((v3d->tmp_compat_flag & V3D_DEBUG_SHOW_COMBINED_DEPTH) != 0) {
-		/* store */
-		view3d_draw_debug_store_depth(ar, draw_data);
-	}
-
-	if (((v3d->tmp_compat_flag & V3D_DEBUG_SHOW_SCENE_DEPTH) != 0) ||
-	    ((v3d->tmp_compat_flag & V3D_DEBUG_SHOW_COMBINED_DEPTH) != 0))
-	{
-		/* draw */
-		if (GPU_viewport_debug_depth_is_valid(draw_data->viewport)) {
-			GPU_viewport_debug_depth_draw(draw_data->viewport, v3d->debug.znear, v3d->debug.zfar);
-		}
-	}
-	else {
-		/* cleanup */
-		GPU_viewport_debug_depth_free(draw_data->viewport);
-	}
-}
-
-#endif /* VIEW3D_DRAW_DEBUG */
-
 /* ******************** view border ***************** */
 
 static void view3d_camera_border(
@@ -847,72 +745,6 @@ void ED_view3d_draw_depth(
 	U.obcenter_dia = obcenter_dia;
 }
 
-/* ******************** offline engine ***************** */
-
-static bool view3d_draw_render_draw(const bContext *C, Scene *scene,
-    ARegion *ar, View3D *UNUSED(v3d),
-    bool clip_border, const rcti *border_rect)
-{
-	RegionView3D *rv3d = ar->regiondata;
-	RenderEngineType *type;
-	GLint scissor[4];
-
-	/* create render engine */
-	if (!rv3d->render_engine) {
-		RenderEngine *engine;
-
-		type = RE_engines_find(scene->r.engine);
-
-		if (!(type->view_update && type->render_to_view))
-			return false;
-
-		engine = RE_engine_create_ex(type, true);
-
-		engine->tile_x = scene->r.tilex;
-		engine->tile_y = scene->r.tiley;
-
-		type->view_update(engine, C);
-
-		rv3d->render_engine = engine;
-	}
-
-	/* rendered draw */
-	gpuPushMatrix();
-	float original_proj[4][4];
-	gpuGetProjectionMatrix(original_proj);
-	ED_region_pixelspace(ar);
-
-	if (clip_border) {
-		/* for border draw, we only need to clear a subset of the 3d view */
-		if (border_rect->xmax > border_rect->xmin && border_rect->ymax > border_rect->ymin) {
-			glGetIntegerv(GL_SCISSOR_BOX, scissor);
-			glScissor(border_rect->xmin, border_rect->ymin,
-				BLI_rcti_size_x(border_rect), BLI_rcti_size_y(border_rect));
-		}
-		else {
-			return false;
-		}
-	}
-
-	/* don't change depth buffer */
-	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-	glClear(GL_COLOR_BUFFER_BIT); /* is this necessary? -- merwin */
-
-	/* render result draw */
-	type = rv3d->render_engine->type;
-	type->render_to_view(rv3d->render_engine, C);
-
-	if (clip_border) {
-		/* restore scissor as it was before */
-		glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
-	}
-
-	gpuLoadProjectionMatrix(original_proj);
-	gpuPopMatrix();
-
-	return true;
-}
-
 /* ******************** background plates ***************** */
 
 static void view3d_draw_background_gradient(void)
@@ -977,77 +809,6 @@ static void view3d_draw_background_world(Scene *scene, View3D *v3d, RegionView3D
 	view3d_draw_background_none();
 }
 
-/* *******************

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list