From 1dea2f1f72ebada491250eaf44dde82d034f7d80 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Feb 2008 22:01:23 +0000 Subject: [PATCH] inverted the uv header mesh-sync-selection button, added face/vert selection popdown when sync selection is enabled. --- source/blender/src/header_image.c | 38 +++++++++++++++++++++++++++---- source/blender/src/sequence.c | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 1ec54423ab6..7a8f2849881 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -83,6 +83,7 @@ #include "BSE_filesel.h" #include "BSE_headerbuttons.h" #include "BSE_trans_types.h" +#include "BSE_edit.h" #include "BPY_extern.h" #include "BPY_menus.h" @@ -361,6 +362,26 @@ static void do_image_buttons_set_uvlayer_callback(void *act, void *data) allqueue(REDRAWIMAGE, 0); } +static void do_image_buttons_set_selection_mode_callback(void *mode, void *dummy2) +{ + int selectmode = *((int *)mode); + if (selectmode==0) { + if (G.scene->selectmode == SCE_SELECT_VERTEX) return; + G.scene->selectmode = SCE_SELECT_VERTEX; + } else { + if (G.scene->selectmode == SCE_SELECT_FACE) return; + G.scene->selectmode = SCE_SELECT_FACE; + } + + EM_selectmode_set(); + countall(); + + BIF_undo_push("Set Selection Mode"); + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWBUTSEDIT, 0); + allqueue(REDRAWIMAGE, 0); +} + static void do_image_view_viewnavmenu(void *arg, int event) { switch(event) { @@ -1205,21 +1226,28 @@ void image_buttons(void) xco+= XIC + 18; uiBlockBeginAlign(block); - uiDefIconButBitI(block, TOGN, SI_SYNC_UVSEL, B_REDR, ICON_NO_GO_LEFT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Mesh independant selection"); + uiDefIconButBitI(block, TOG, SI_SYNC_UVSEL, B_REDR, ICON_EDIT, xco,0,XIC,YIC, &G.sima->flag, 0, 0, 0, 0, "Sync UV and Mesh Selection"); xco+= XIC; - if ((G.sima->flag & SI_SYNC_UVSEL)==0) { + if (G.sima->flag & SI_SYNC_UVSEL) { + static int selectmode; + /* would use these if const's could go in strings + * SCE_SELECT_VERTEX, SCE_SELECT_FACE */ + ubut = uiDefIconTextButI(block, ICONTEXTROW, B_REDR, ICON_VERTEXSEL, + "Selection Mode: %t|Vertex%x0|Face%x2", + xco,0,XIC+10,YIC, &selectmode, 0, 3.0, 0, 0, + "Change mesh selection mode"); + uiButSetFunc(ubut, do_image_buttons_set_selection_mode_callback, &selectmode, NULL); + } else { /* would use these if const's could go in strings * SI_STICKY_LOC SI_STICKY_DISABLE SI_STICKY_VERTEX */ ubut = uiDefIconTextButC(block, ICONTEXTROW, B_REDR, ICON_STICKY_UVS_LOC, "Sticky UV Selection: %t|Disable%x1|Shared Location%x0|Shared Vertex%x2", xco,0,XIC+10,YIC, &(G.sima->sticky), 0, 3.0, 0, 0, "Sticky UV Selection (Hotkeys: Shift C, Alt C, Ctrl C)"); - xco+= XIC + 16; - } else { - xco+= 6; } + xco+= XIC + 16; uiBlockEndAlign(block); /* Snap copied right out of view3d header */ diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index 5f78d266c3c..9282ab0b086 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -1,4 +1,4 @@ -/** + /** * $Id$ * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****