Barebones for viewport code apart from 2.7x drawing code

A new option (set in the properties region) allows the user to pick the
"new viewport" for the rendering  (in the UI: Modern Viewport).

For now we have a semi-blank file (view3d_draw.c) that can starts to take
over the drawing pipeline.

I can't guarantee we will be able to keep both drawing systems working
through the entire 2.8 development, but it should do for now.

also, we can use branches for some of the viewport development, but it's
better to keep things in 2.8 whenever we can, so people can test it.
This commit is contained in:
Dalai Felinto
2016-10-04 20:00:46 +00:00
parent 3a4c1db14b
commit 5e8c4ae75b
8 changed files with 4418 additions and 4320 deletions

View File

@@ -3090,7 +3090,7 @@ class VIEW3D_PT_view3d_display(Panel):
@classmethod
def poll(cls, context):
view = context.space_data
return (view)
return (view) and not view.use_modern_viewport
def draw(self, context):
layout = self.layout
@@ -3188,6 +3188,11 @@ 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
@@ -3629,6 +3634,31 @@ class VIEW3D_PT_context_properties(Panel):
rna_prop_ui.draw(self.layout, context, member, object, False)
class VIEW3D_PT_viewport_debug(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_label = "..."
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")
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")
def register():
bpy.utils.register_module(__name__)

View File

@@ -52,6 +52,7 @@ set(SRC
view3d_buttons.c
view3d_camera_control.c
view3d_draw.c
view3d_draw_legacy.c
view3d_edit.c
view3d_fly.c
view3d_walk.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -334,8 +334,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemMenuEnumO(row, C, "OBJECT_OT_mode_set", "mode", name, icon);
}
/* Draw type */
uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (IS_VIEWPORT_LEGACY(v3d)) {
/* Draw type */
uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
if (obedit == NULL && is_paint) {
if (ob->mode & OB_MODE_ALL_PAINT) {

View File

@@ -193,6 +193,9 @@ void draw_sim_debug_data(Scene *scene, View3D *v3d, ARegion *ar);
/* view3d_draw.c */
void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar);
/* view3d_draw_legacy.c */
void view3d_main_region_draw_legacy(const struct bContext *C, struct ARegion *ar);
void ED_view3d_draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, bool alphaoverride);
void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag);
@@ -314,5 +317,8 @@ extern unsigned char view3d_camera_border_hack_col[3];
extern bool view3d_camera_border_hack_test;
#endif
/* temporary test for blender 2.8 viewport */
#define IS_VIEWPORT_LEGACY(v3d) (v3d->flag3 & V3D_NEW_VIEWPORT) == 0
#endif /* __VIEW3D_INTERN_H__ */

View File

@@ -319,6 +319,7 @@ typedef struct View3D {
/* View3d->flag3 (short) */
#define V3D_SHOW_WORLD (1 << 0)
#define V3D_NEW_VIEWPORT (1 << 1)
/* View3D->around */
enum {

View File

@@ -2736,6 +2736,12 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
/* *** Blender 2.8 Viewport temporary *** */
prop = RNA_def_property(srna, "use_modern_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_NEW_VIEWPORT);
RNA_def_property_ui_text(prop, "Modern Viewport", "Use modern viewport");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
/* *** Animated *** */
RNA_define_animate_sdna(true);
/* region */