Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-01-31 16:30:56 +0300
committerTon Roosendaal <ton@blender.org>2009-01-31 16:30:56 +0300
commit86a2a0f6947feab469a108eb7eb875fa5637d036 (patch)
treeff033132556d35991a488e6dc98807fa5b06b625 /source/blender/editors
parent607a56cb7a0e5a7fef2214d60a723dd67e8209ab (diff)
2.5
Edit Mesh: - Added back "Edge Shortest Path select" It now also does regular selection, more fun! It's mapped to CTRL+click now, and makes or clears selections between current and previously activated edge. Seam/Sharp/etc marking is a toolsetting mode still. These options cannot become properties easily, because the tool uses the properties of selected edge to clear... - Removed a whole bunch of G.f flags, related to mesh drawing. It's all now local in me->drawflags. Here's the list of removed old globals: G_DRAWEDGES G_DRAWFACES G_DRAWNORMALS G_DRAW_VNORMALS G_ALLEDGES G_HIDDENEDGES G_DRAWCREASES G_DRAWSEAMS G_DRAWSHARP G_DRAWBWEIGHTS G_DRAW_EDGELEN G_DRAW_FACEAREA G_DRAW_EDGEANG
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editface.c12
-rw-r--r--source/blender/editors/mesh/editmesh.c8
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c2
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c218
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c7
-rw-r--r--source/blender/editors/mesh/mesh_intern.h2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c7
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c18
-rw-r--r--source/blender/editors/space_view3d/drawobject.c38
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c7
10 files changed, 181 insertions, 138 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 4ca302ab06c..b62877bd76e 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -826,6 +826,8 @@ int minmax_tface(Scene *scene, float *min, float *max)
return ok;
}
+/* ******************** edge loop shortest path ********************* */
+
#define ME_SEAM_DONE 2 /* reuse this flag */
static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
@@ -871,7 +873,11 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn
void edgetag_context_set(Scene *scene, EditEdge *eed, int val)
{
+
switch (scene->toolsettings->edge_mode) {
+ case EDGE_MODE_SELECT:
+ EM_select_edge(eed, val);
+ break;
case EDGE_MODE_TAG_SEAM:
if (val) {eed->seam = 255;}
else {eed->seam = 0;}
@@ -894,6 +900,8 @@ void edgetag_context_set(Scene *scene, EditEdge *eed, int val)
int edgetag_context_check(Scene *scene, EditEdge *eed)
{
switch (scene->toolsettings->edge_mode) {
+ case EDGE_MODE_SELECT:
+ return (eed->f & SELECT) ? 1 : 0;
case EDGE_MODE_TAG_SEAM:
return eed->seam ? 1 : 0;
case EDGE_MODE_TAG_SHARP:
@@ -1029,6 +1037,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge
return 1;
}
+/* *************************************** */
+
static void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
{
BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
@@ -1094,7 +1104,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
// XXX if (G.rt == 8)
// unwrap_lscm(1);
- G.f |= G_DRAWSEAMS;
+ me->drawflag |= ME_DRAWSEAMS;
BIF_undo_push("Mark Seam");
// XXX notifier! object_tface_flags_changed(OBACT, 1);
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index 58041120a42..77371fdbd20 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -643,7 +643,7 @@ static int edgeDrawFlagInfo_cmp(const void *av, const void *bv)
}
#endif
-static void edge_drawflags(EditMesh *em)
+static void edge_drawflags(Mesh *me, EditMesh *em)
{
EditVert *eve;
EditEdge *eed, *e1, *e2, *e3, *e4;
@@ -692,7 +692,7 @@ static void edge_drawflags(EditMesh *em)
efa= efa->next;
}
- if(G.f & G_ALLEDGES) {
+ if(me->drawflag & ME_ALLEDGES) {
efa= em->faces.first;
while(efa) {
if(efa->e1->f2>=2) efa->e1->f2= 1;
@@ -1042,7 +1042,7 @@ void load_editMesh(Scene *scene, Object *ob)
/* eed->f1 : flag for dynaface (cylindertest, old engine) */
/* eve->f1 : flag for dynaface (sphere test, old engine) */
/* eve->f2 : being used in vertexnormals */
- edge_drawflags(em);
+ edge_drawflags(me, em);
EM_stats_update(em);
@@ -1146,9 +1146,9 @@ void load_editMesh(Scene *scene, Object *ob)
eve->tmp.l = a++; /* counter */
mvert->flag= 0;
- if(eve->f1==1) mvert->flag |= ME_SPHERETEST;
mvert->flag |= (eve->f & SELECT);
if (eve->h) mvert->flag |= ME_HIDE;
+
mvert->bweight= (char)(255.0*eve->bweight);
eve= eve->next;
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index a3b33e71cf4..40e2179ddbe 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -187,7 +187,7 @@ static int EM_check_selection(EditMesh *em, void *data)
for(ese = em->selected.first; ese; ese = ese->next){
if(ese->data == data) return 1;
- }
+ }
return 0;
}
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index fda9766b2fc..bcf40c16538 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -1924,15 +1924,6 @@ void loop_multiselect(EditMesh *em, int looptype)
/* ***************** loop select (non modal) ************** */
-static EnumPropertyItem prop_select_types[] = {
- {0, "LOOP_EXCLUSIVE", "Loop Exclusive", ""},
- {1, "LOOP_EXTEND", "Loop Extend", ""},
- {2, "RING_EXCLUSIVE", "Ring Exclusive", ""},
- {3, "RING_EXTEND", "Ring Extend", ""},
- {0, NULL, NULL, NULL}
-};
-
-
static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring)
{
ViewContext vc;
@@ -1948,97 +1939,138 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
eed= findnearestedge(&vc, &dist);
if(eed) {
- /* XXX: should toolsettings do this? */
- if (vc.scene->toolsettings->edge_mode == EDGE_MODE_SELECT) {
- if(extend==0) EM_clear_flag_all(em, SELECT);
-
- if((eed->f & SELECT)==0) select=1;
- else if(extend) select=0;
+ if(extend==0) EM_clear_flag_all(em, SELECT);
+
+ if((eed->f & SELECT)==0) select=1;
+ else if(extend) select=0;
- if(em->selectmode & SCE_SELECT_FACE) {
- faceloop_select(em, eed, select);
- }
- else if(em->selectmode & SCE_SELECT_EDGE) {
- if(ring)
- edgering_select(em, eed, select);
- else
- edgeloop_select(em, eed, select);
- }
- else if(em->selectmode & SCE_SELECT_VERTEX) {
- if(ring)
- edgering_select(em, eed, select);
- else
- edgeloop_select(em, eed, select);
- }
+ if(em->selectmode & SCE_SELECT_FACE) {
+ faceloop_select(em, eed, select);
+ }
+ else if(em->selectmode & SCE_SELECT_EDGE) {
+ if(ring)
+ edgering_select(em, eed, select);
+ else
+ edgeloop_select(em, eed, select);
+ }
+ else if(em->selectmode & SCE_SELECT_VERTEX) {
+ if(ring)
+ edgering_select(em, eed, select);
+ else
+ edgeloop_select(em, eed, select);
+ }
- EM_selectmode_flush(em);
+ EM_selectmode_flush(em);
// if (EM_texFaceCheck())
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ }
+}
+
+static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ ARegion *ar= CTX_wm_region(C);
+ short mval[2];
+
+ mval[0]= event->x - ar->winrct.xmin;
+ mval[1]= event->y - ar->winrct.ymin;
+
+ view3d_operator_needs_opengl(C);
+
+ mouse_mesh_loop(C, mval, RNA_boolean_get(op->ptr, "extend"),
+ RNA_boolean_get(op->ptr, "ring"));
+
+ /* cannot do tweaks for as long this keymap is after transform map */
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_loop_select(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Loop Select";
+ ot->idname= "MESH_OT_loop_select";
+
+ /* api callbacks */
+ ot->invoke= mesh_loop_select_invoke;
+ ot->poll= ED_operator_editmesh;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
+ RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "");
+}
+
+/* ******************* mesh shortest path select, uses prev-selected edge ****************** */
+
+/* since you want to create paths with multiple selects, it doesn't have extend option */
+static void mouse_mesh_shortest_path(bContext *C, short mval[2])
+{
+ ViewContext vc;
+ EditMesh *em;
+ EditEdge *eed;
+ int dist= 50;
+
+ em_setup_viewcontext(C, &vc);
+ vc.mval[0]= mval[0];
+ vc.mval[1]= mval[1];
+ em= vc.em;
+
+ eed= findnearestedge(&vc, &dist);
+ if(eed) {
+ Mesh *me= vc.obedit->data;
+ int path = 0;
+
+ if (em->selected.last) {
+ EditSelection *ese = em->selected.last;
- }
- else {
- int act = (edgetag_context_check(vc.scene, eed)==0);
- int path = 0;
-
- if (ring && em->selected.last) {
- EditSelection *ese = em->selected.last;
-
- if(ese && ese->type == EDITEDGE) {
- EditEdge *eed_act;
- eed_act = (EditEdge*)ese->data;
- if (eed_act != eed) {
- /* If extend, we need to use the last active edge, (if it exists) */
- if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) {
- EM_remove_selection(em, eed_act, EDITEDGE);
- EM_select_edge(eed_act, 0);
- path = 1;
- }
+ if(ese && ese->type == EDITEDGE) {
+ EditEdge *eed_act;
+ eed_act = (EditEdge*)ese->data;
+ if (eed_act != eed) {
+ if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) {
+ EM_remove_selection(em, eed_act, EDITEDGE);
+ path = 1;
}
}
}
- if (path==0) {
- edgetag_context_set(vc.scene, eed, act); /* switch the edge option */
- }
-
- if (act) {
- if ((eed->f & SELECT)==0) {
- EM_select_edge(eed, 1);
- EM_selectmode_flush(em);
- }
- /* even if this is selected it may not be in the selection list */
- EM_store_selection(em, eed, EDITEDGE);
- } else {
- if (eed->f & SELECT) {
- EM_select_edge(eed, 0);
- /* logic is differnt from above here since if this was selected we dont know if its in the selection list or not */
- EM_remove_selection(em, eed, EDITEDGE);
-
- EM_selectmode_flush(em);
- }
- }
+ }
+ if (path==0) {
+ int act = (edgetag_context_check(vc.scene, eed)==0);
+ edgetag_context_set(vc.scene, eed, act); /* switch the edge option */
+ }
+
+ EM_selectmode_flush(em);
+
+ /* even if this is selected it may not be in the selection list */
+ if(edgetag_context_check(vc.scene, eed)==0)
+ EM_remove_selection(em, eed, EDITEDGE);
+ else
+ EM_store_selection(em, eed, EDITEDGE);
+
+ /* force drawmode for mesh */
+ switch (vc.scene->toolsettings->edge_mode) {
- switch (vc.scene->toolsettings->edge_mode) {
case EDGE_MODE_TAG_SEAM:
- G.f |= G_DRAWSEAMS;
+ me->drawflag |= ME_DRAWSEAMS;
break;
case EDGE_MODE_TAG_SHARP:
- G.f |= G_DRAWSHARP;
+ me->drawflag |= ME_DRAWSHARP;
break;
case EDGE_MODE_TAG_CREASE:
- G.f |= G_DRAWCREASES;
+ me->drawflag |= ME_DRAWCREASES;
break;
case EDGE_MODE_TAG_BEVEL:
- G.f |= G_DRAWBWEIGHTS;
+ me->drawflag |= ME_DRAWBWEIGHTS;
break;
- }
-
- DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
}
+ DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
}
}
-static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
+
+static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
short mval[2];
@@ -2047,29 +2079,27 @@ static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
mval[1]= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
+
+ mouse_mesh_shortest_path(C, mval);
- mouse_mesh_loop(C, mval, RNA_boolean_get(op->ptr, "extend"),
- RNA_boolean_get(op->ptr, "ring"));
-
- /* cannot do tweaks for as long this keymap is after transform map */
return OPERATOR_FINISHED;
}
-
-void MESH_OT_loop_select(wmOperatorType *ot)
+
+void MESH_OT_shortest_path_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Loop Select";
- ot->idname= "MESH_OT_loop_select";
+ ot->name= "Shortest Path Select";
+ ot->idname= "MESH_OT_shortest_path_select";
/* api callbacks */
- ot->invoke= mesh_loop_select_invoke;
+ ot->invoke= mesh_shortest_path_select_invoke;
ot->poll= ED_operator_editmesh;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
- RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "");
}
+
/* ************************************************** */
@@ -3603,13 +3633,12 @@ void EM_selectmode_menu(EditMesh *em)
void editmesh_mark_seam(EditMesh *em, int clear)
{
+ Mesh *me= NULL; // XXX
EditEdge *eed;
/* auto-enable seams drawing */
if(clear==0) {
- if(!(G.f & G_DRAWSEAMS)) {
- G.f |= G_DRAWSEAMS;
- }
+ me->drawflag |= ME_DRAWSEAMS;
}
if(clear) {
@@ -3637,16 +3666,13 @@ void editmesh_mark_seam(EditMesh *em, int clear)
void editmesh_mark_sharp(EditMesh *em, int set)
{
+ Mesh *me= NULL;
EditEdge *eed;
-#if 0
/* auto-enable sharp edge drawing */
if(set) {
- if(!(G.f & G_DRAWSEAMS)) {
- G.f |= G_DRAWSEAMS;
- }
+ me->drawflag |= ME_DRAWSHARP;
}
-#endif
if(set) {
eed= em->edges.first;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 68d75f64065..23a810ba66b 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3901,7 +3901,8 @@ typedef struct SlideVert {
int EdgeSlide(EditMesh *em, short immediate, float imperc)
{
-// NumInput num;
+// NumInput num; XXX
+ Mesh *me= NULL; // XXX
EditFace *efa;
EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL;
EditVert *ev, *nearest;
@@ -4180,7 +4181,7 @@ int EdgeSlide(EditMesh *em, short immediate, float imperc)
return 0;
}
- if(G.f & G_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAW_EDGELEN) {
if(!(tempsv->up->f & SELECT)) {
tempsv->up->f |= SELECT;
tempsv->up->f2 |= 16;
@@ -4633,7 +4634,7 @@ int EdgeSlide(EditMesh *em, short immediate, float imperc)
}
- if(G.f & G_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAW_EDGELEN) {
look = vertlist;
while(look) {
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 45b2d1fc5f7..e665b7e70fc 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -185,7 +185,7 @@ void MESH_OT_reveal_mesh(struct wmOperatorType *ot);
void MESH_OT_righthandfaces(struct wmOperatorType *ot);
void MESH_OT_select_linked_flat_faces(struct wmOperatorType *ot);
void MESH_OT_select_sharp_edges(struct wmOperatorType *ot);
-
+void MESH_OT_shortest_path_select(struct wmOperatorType *ot);
extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
extern void EM_automerge(int update);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 1b86add2376..4df5b39ac47 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -146,6 +146,8 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
WM_operatortype_append(MESH_OT_loop_select);
WM_operatortype_append(MESH_OT_add_edge_face);
+ WM_operatortype_append(MESH_OT_shortest_path_select);
+
}
@@ -156,6 +158,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
wmKeymapItem *kmi;
/* selecting */
+ /* standard mouse selection goes via space_view3d */
WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", 1);
@@ -164,7 +167,9 @@ void ED_keymap_mesh(wmWindowManager *wm)
kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", 1);
RNA_boolean_set(kmi->ptr, "ring", 1);
-
+
+ WM_keymap_add_item(keymap, "MESH_OT_shortest_path_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+
WM_keymap_add_item(keymap, "MESH_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index f34f520e269..92c8b8f0b69 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -135,13 +135,14 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
- MEdge *med = &data->me->medge[index];
+ Mesh *me= data->me;
+ MEdge *med = &me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
- if((G.f & G_DRAWSEAMS) && (med->flag&ME_SEAM)) {
+ if((me->drawflag & ME_DRAWSEAMS) && (med->flag&ME_SEAM)) {
return 0;
- } else if(G.f & G_DRAWEDGES){
- if (G.f&G_HIDDENEDGES) {
+ } else if(me->drawflag & ME_DRAWEDGES){
+ if (me->drawflag & ME_HIDDENEDGES) {
return 1;
} else {
return (flags & eEdge_Visible);
@@ -154,11 +155,12 @@ static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
static int draw_tfaces3D__setSeamOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
+ Mesh *me= data->me;
MEdge *med = &data->me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
- if (med->flag&ME_SEAM) {
- if (G.f&G_HIDDENEDGES) {
+ if (med->flag & ME_SEAM) {
+ if (me->drawflag & ME_HIDDENEDGES) {
return 1;
} else {
return (flags & eEdge_Visible);
@@ -217,7 +219,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh
dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data);
/* Draw Seams */
- if(G.f & G_DRAWSEAMS) {
+ if(me->drawflag & ME_DRAWSEAMS) {
UI_ThemeColor(TH_EDGE_SEAM);
glLineWidth(2);
@@ -227,7 +229,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh
}
/* Draw Selected Faces */
- if(G.f & G_DRAWFACES) {
+ if(me->drawflag & ME_DRAWFACES) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
UI_ThemeColor4(TH_FACE_SELECT);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8430e4b874b..dd101231b49 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1712,7 +1712,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
glPointSize(1.0);
}
-static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
+static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
{
int pass;
unsigned char wireCol[4], selCol[4], actCol[4];
@@ -1746,7 +1746,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM,
if(scene->selectmode == SCE_SELECT_FACE) {
draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
}
- else if( (G.f & G_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {
+ else if( (me->drawflag & ME_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {
if(cageDM->drawMappedEdgesInterp && (scene->selectmode & SCE_SELECT_VERTEX)) {
glShadeModel(GL_SMOOTH);
draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
@@ -1771,6 +1771,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM,
static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, EditMesh *em)
{
+ Mesh *me= ob->data;
EditEdge *eed;
EditFace *efa;
float v1[3], v2[3], v3[3], v4[3];
@@ -1800,7 +1801,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0);
- if(G.f & G_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAW_EDGELEN) {
UI_GetThemeColor3fv(TH_TEXT, col);
/* make color a bit more red */
if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
@@ -1826,7 +1827,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
}
}
- if(G.f & G_DRAW_FACEAREA) {
+ if(me->drawflag & ME_DRAW_FACEAREA) {
// XXX extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
UI_GetThemeColor3fv(TH_TEXT, col);
@@ -1862,7 +1863,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
}
}
- if(G.f & G_DRAW_EDGEANG) {
+ if(me->drawflag & ME_DRAW_EDGEANG) {
EditEdge *e1, *e2, *e3, *e4;
UI_GetThemeColor3fv(TH_TEXT, col);
@@ -2018,7 +2019,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
}
}
- if((G.f & (G_DRAWFACES)) || FACESEL_PAINT_TEST) { /* transp faces */
+ if((me->drawflag & (ME_DRAWFACES)) || FACESEL_PAINT_TEST) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
UI_GetThemeColor4ubv(TH_FACE, (char *)col1);
@@ -2055,14 +2056,14 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
}
/* here starts all fancy draw-extra over */
- if((G.f & G_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
- /* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
+ if((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
+ /* we are drawing textures and 'ME_DRAWEDGES' is disabled, dont draw any edges */
/* only draw selected edges otherwise there is no way of telling if a face is selected */
- draw_em_fancy_edges(scene, v3d, cageDM, 1, eed_act);
+ draw_em_fancy_edges(scene, v3d, me, cageDM, 1, eed_act);
} else {
- if(G.f & G_DRAWSEAMS) {
+ if(me->drawflag & ME_DRAWSEAMS) {
UI_ThemeColor(TH_EDGE_SEAM);
glLineWidth(2);
@@ -2072,7 +2073,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
glLineWidth(1);
}
- if(G.f & G_DRAWSHARP) {
+ if(me->drawflag & ME_DRAWSHARP) {
UI_ThemeColor(TH_EDGE_SHARP);
glLineWidth(2);
@@ -2082,30 +2083,30 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
glLineWidth(1);
}
- if(G.f & G_DRAWCREASES) {
+ if(me->drawflag & ME_DRAWCREASES) {
draw_dm_creases(cageDM);
}
- if(G.f & G_DRAWBWEIGHTS) {
+ if(me->drawflag & ME_DRAWBWEIGHTS) {
draw_dm_bweights(scene, cageDM);
}
- draw_em_fancy_edges(scene, v3d, cageDM, 0, eed_act);
+ draw_em_fancy_edges(scene, v3d, me, cageDM, 0, eed_act);
}
if(em) {
// XXX retopo_matrix_update(v3d);
draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act);
- if(G.f & G_DRAWNORMALS) {
+ if(me->drawflag & ME_DRAWNORMALS) {
UI_ThemeColor(TH_NORMAL);
draw_dm_face_normals(scene, cageDM);
}
- if(G.f & G_DRAW_VNORMALS) {
+ if(me->drawflag & ME_DRAW_VNORMALS) {
UI_ThemeColor(TH_NORMAL);
draw_dm_vert_normals(scene, cageDM);
}
- if(G.f & (G_DRAW_EDGELEN|G_DRAW_FACEAREA|G_DRAW_EDGEANG))
+ if(me->drawflag & (ME_DRAW_EDGELEN|ME_DRAW_FACEAREA|ME_DRAW_EDGEANG))
draw_em_measure_stats(v3d, rv3d, ob, em);
}
@@ -4903,9 +4904,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
}
- if(G.f & G_DRAW_EXT) {
- if(ob->type==OB_EMPTY || ob->type==OB_CAMERA || ob->type==OB_LAMP) dt= OB_WIRE;
- }
}
/* draw outline for selected solid objects, mesh does itself */
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index ddb45bdd736..5bffe6b1124 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -413,6 +413,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
{
ToolSettings *settings;
+ Mesh *me= obedit->data;
EditMesh *em;
EditFace *efa, *efa_act;
MTFace *tf, *activetf = NULL;
@@ -422,7 +423,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
int drawfaces, interpedges, lastsel, sel;
Image *ima= sima->image;
- em= ((Mesh*)obedit->data)->edit_mesh;
+ em= me->edit_mesh;
activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */
settings= scene->toolsettings;
@@ -457,7 +458,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
if(sima->flag & SI_DRAW_STRETCH) {
draw_uvs_stretch(sima, scene, em, activetf);
}
- else if(G.f & G_DRAWFACES) {
+ else if(me->drawflag & ME_DRAWFACES) {
/* draw transparent faces */
UI_GetThemeColor4ubv(TH_FACE, col1);
UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
@@ -614,7 +615,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
col2[0] = col2[1] = col2[2] = 128; col2[3] = 255;
glColor4ubv((unsigned char *)col2);
- if(G.f & G_DRAWEDGES) {
+ if(me->drawflag & ME_DRAWEDGES) {
UI_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
lastsel = sel = 0;