From 5f9ea0d7eb675dceb5ef981d0bbe221237a3c6fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Jan 2013 19:01:26 +0000 Subject: [PATCH] move draw all edges into the object settings (object panel), makes more sense here since its next to draw extra wire --- .../startup/bl_ui/properties_object.py | 1 + release/scripts/startup/bl_ui/space_view3d.py | 3 -- .../blender/editors/space_view3d/drawobject.c | 32 ++++++++++--------- .../editors/space_view3d/view3d_draw.c | 3 +- .../editors/space_view3d/view3d_intern.h | 4 +-- .../editors/space_view3d/view3d_view.c | 3 +- source/blender/makesdna/DNA_mesh_types.h | 2 +- source/blender/makesdna/DNA_object_types.h | 27 ++++++++-------- source/blender/makesrna/intern/rna_mesh.c | 5 --- source/blender/makesrna/intern/rna_object.c | 9 ++++-- 10 files changed, 46 insertions(+), 43 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 951807488e7..b9dcdc19162 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -230,6 +230,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): col.prop(ob, "show_x_ray", text="X-Ray") if ob.type == 'MESH': col.prop(ob, "show_transparent", text="Transparency") + col.prop(ob, "show_all_edges") class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 46c574d6138..a3f387dfa41 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2382,9 +2382,6 @@ class VIEW3D_PT_view3d_display(Panel): col.prop(view, "show_outline_selected") col.prop(view, "show_all_objects_origin") col.prop(view, "show_relationship_lines") - if ob and ob.type == 'MESH': - mesh = ob.data - col.prop(mesh, "show_all_edges") col = layout.column() col.active = display_all diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index cd4c4d6b491..bf9cd4f6334 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -206,7 +206,7 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) /* check for glsl drawing */ -int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const short dt) +int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt) { if (!GPU_glsl_support()) return 0; @@ -1077,7 +1077,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z) } static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; const float pixsize = ED_view3d_pixel_size(rv3d, ob->obmat[3]); @@ -2820,7 +2820,7 @@ static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index) } static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, - Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const short dt) + Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const char dt) { Mesh *me = ob->data; @@ -3026,7 +3026,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) } static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const unsigned char ob_wire_col[4], const short dflag) + const char dt, const unsigned char ob_wire_col[4], const short dflag) { Object *ob = base->object; Mesh *me = ob->data; @@ -3235,7 +3235,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ } - dm->drawEdges(dm, (dt == OB_WIRE || totface == 0), me->drawflag & ME_ALLEDGES); + dm->drawEdges(dm, (dt == OB_WIRE || totface == 0), (ob->dtx & OB_DRAW_ALL_EDGES)); if (dt != OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) { glDepthMask(1); @@ -3261,7 +3261,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* returns 1 if nothing was drawn, for detecting to draw an object center */ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const unsigned char ob_wire_col[4], const short dflag) + const char dt, const unsigned char ob_wire_col[4], const short dflag) { Object *ob = base->object; Object *obedit = scene->obedit; @@ -3583,7 +3583,7 @@ static void drawCurveDMWired(Object *ob) } /* return 1 when nothing was drawn */ -static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const short dt) +static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) { Object *ob = base->object; DerivedMesh *dm = ob->derivedFinal; @@ -3619,7 +3619,7 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B * \return 1 when nothing was drawn */ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; ListBase *lb = NULL; @@ -3745,7 +3745,7 @@ static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d return FALSE; } static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { int retval; @@ -5262,7 +5262,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) } static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { ToolSettings *ts = scene->toolsettings; Object *ob = base->object; @@ -5591,7 +5591,7 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[ } /* return TRUE if nothing was drawn */ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) + const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; MetaBall *mb; @@ -6240,7 +6240,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short unsigned char _ob_wire_col[4]; /* dont initialize this */ unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */ int i, selstart, selend, empty_object = 0; - short dt, dtx, zbufoff = 0; + short dtx; + char dt; + short zbufoff = 0; const short is_obact = (ob == OBACT); /* only once set now, will be removed too, should become a global standard */ @@ -6754,7 +6756,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short } if (ob->gameflag & OB_BOUNDS) { - if (ob->boundtype != ob->collision_boundtype || (dtx & OB_BOUNDBOX) == 0) { + if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) { setlinestyle(2); draw_bounding_volume(scene, ob, ob->collision_boundtype); @@ -6768,7 +6770,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short if (dtx & OB_AXIS) { drawaxes(1.0f, OB_ARROWS); } - if (dtx & OB_BOUNDBOX) { + if (dtx & OB_DRAWBOUNDOX) { draw_bounding_volume(scene, ob, ob->boundtype); } if (dtx & OB_TEXSPACE) { @@ -7251,7 +7253,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r if (dm) dm->release(dm); } -void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, const short dt, int outline) +void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline) { if (ob == NULL) return; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 67344a9804b..a80b36999d4 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1927,7 +1927,8 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas BoundBox bb, *bb_tmp; /* use a copy because draw_object, calls clear_mesh_caches */ GLuint displist = 0; short transflag, use_displist = -1; /* -1 is initialize */ - char dt, dtx; + char dt; + short dtx; if (base->object->restrictflag & OB_RESTRICT_VIEW) return; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index a6daf610052..c8f0fe44433 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -119,8 +119,8 @@ void draw_motion_paths_cleanup(View3D *v3d); /* drawobject.c */ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, const short dflag); -int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const short dt); -void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const short dt, int outline); +int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, const char dt); +void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); void drawaxes(float size, char drawtype); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 087ca960bd3..fba1ce328ba 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -879,7 +879,8 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b ARegion *ar = vc->ar; rctf rect; short code, hits; - char dt, dtx; + char dt; + short dtx; G.f |= G_PICKSEL; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 0c708ddcbef..f2ee73392c7 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -186,7 +186,7 @@ typedef struct TFace { #define ME_DRAWNORMALS (1 << 2) #define ME_DRAW_VNORMALS (1 << 3) -#define ME_ALLEDGES (1 << 4) +// #define ME_ALLEDGES (1 << 4) #define ME_HIDDENEDGES (1 << 5) #define ME_DRAWCREASES (1 << 6) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 559ba446740..9fa35cd667c 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -218,10 +218,8 @@ typedef struct Object { char boundtype; /* bounding box use for drawing */ char collision_boundtype; /* bounding box type used for collision */ - char restrictflag; /* for restricting view, select, render etc. accessible in outliner */ - + short dtx; /* viewport draw extra settings */ char dt; /* viewport draw type */ - char dtx; /* viewport draw extra settings */ char empty_drawtype; float empty_drawsize; float dupfacesca; /* dupliface scale */ @@ -241,8 +239,9 @@ typedef struct Object { struct BulletSoftBody *bsoft; /* settings for game engine bullet soft body */ + char restrictflag; /* for restricting view, select, render etc. accessible in outliner */ + char recalc; /* dependency flag */ short softflag; /* softbody settings */ - short recalc; /* dependency flag */ float anisotropicFriction[3]; ListBase constraints; /* object constraints */ @@ -406,17 +405,19 @@ typedef struct DupliObject { #define OB_PAINT 100 /* temporary used in draw code */ -/* dtx: flags, char! */ -#define OB_AXIS 2 -#define OB_TEXSPACE 4 -#define OB_DRAWNAME 8 -#define OB_DRAWIMAGE 16 +/* dtx: flags (short) */ +#define OB_DRAWBOUNDOX (1 << 0) +#define OB_AXIS (1 << 1) +#define OB_TEXSPACE (1 << 2) +#define OB_DRAWNAME (1 << 3) +#define OB_DRAWIMAGE (1 << 4) /* for solid+wire display */ -#define OB_DRAWWIRE 32 - /* for overdraw */ -#define OB_DRAWXRAY 64 +#define OB_DRAWWIRE (1 << 5) + /* for overdraw s*/ +#define OB_DRAWXRAY (1 << 6) /* enable transparent draw */ -#define OB_DRAWTRANSP 128 +#define OB_DRAWTRANSP (1 << 7) +#define OB_DRAW_ALL_EDGES (1 << 8) /* only for meshes currently */ /* empty_drawtype: no flags */ #define OB_ARROWS 1 diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d5b8e4cddeb..025279b3836 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2900,11 +2900,6 @@ static void rna_def_mesh(BlenderRNA *brna) "Display selected edges using highlights in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES); - RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES); RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a617c78019f..3a4224e7849 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2557,7 +2557,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX); + RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX); RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); @@ -2586,7 +2586,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE); RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - + + prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES); + RNA_def_property_ui_text(prop, "Draw All Edges", "Display all edges for mesh objects"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP); RNA_def_property_ui_text(prop, "Draw Transparent",