diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-10-15 19:56:00 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-10-15 19:56:00 +0400 |
commit | f7a38811750237a05baeac58246482d409f0ab83 (patch) | |
tree | b35a31eb151639d2641c908be750dae40d927704 | |
parent | 70efa7f1aa43d3f35b614a94c493e89d51272d42 (diff) |
3D view: textured draw mode now has a Shadeless option in the Shading panel,
to draw textures without shading. For Cycles this was not possible yet, and
for Blender Internal you had to move away all lights which was also not ideal.
(Caminandes feature request)
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 5 |
4 files changed, 18 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 2ede23325a6..cf6b2523787 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2633,10 +2633,14 @@ class VIEW3D_PT_view3d_shading(Panel): if not scene.render.use_shading_nodes: col.prop(gs, "material_mode", text="") col.prop(view, "show_textured_solid") + if view.viewport_shade == 'SOLID': col.prop(view, "use_matcap") if view.use_matcap: col.template_icon_view(view, "matcap_icon") + elif view.viewport_shade == 'TEXTURED': + col.prop(view, "show_textured_shadeless") + col.prop(view, "show_backface_culling") if obj and obj.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}: col.prop(view, "show_occlude_wire") diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 269b9247c81..dc62005f760 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -345,7 +345,10 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O else { /* draw with lights in the scene otherwise */ solidtex = false; - Gtexdraw.is_lit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp); + if(v3d->flag2 & V3D_SHADELESS_TEX) + Gtexdraw.is_lit = 0; + else + Gtexdraw.is_lit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp); } rgba_float_to_uchar(obcol, ob->col); @@ -955,7 +958,10 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW); else glFrontFace(GL_CCW); - glEnable(GL_LIGHTING); + if ((v3d->drawtype == OB_TEXTURE) && (v3d->flag2 & V3D_SHADELESS_TEX)) + glColor3f(1.0f, 1.0f, 1.0f); + else + glEnable(GL_LIGHTING); { Mesh *me = ob->data; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 5436b9debfa..c724340f5ea 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -280,6 +280,7 @@ typedef struct View3D { #define V3D_SOLID_MATCAP 4096 /* user flag */ #define V3D_SHOW_SOLID_MATCAP 8192 /* runtime flag */ #define V3D_OCCLUDE_WIRE 16384 +#define V3D_SHADELESS_TEX 32768 /* View3D->around */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 77f5957641e..167590d4c2e 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1949,6 +1949,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "show_textured_shadeless", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHADELESS_TEX); + RNA_def_property_ui_text(prop, "Shadeless", "Show shadeless texture without lighting in textured draw mode"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE); RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display"); |