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:
-rw-r--r--source/blender/include/BIF_editmesh.h2
-rw-r--r--source/blender/include/BIF_interface.h5
-rw-r--r--source/blender/src/edit.c5
-rw-r--r--source/blender/src/editmesh_mods.c19
-rw-r--r--source/blender/src/interface.c81
-rw-r--r--source/blender/src/poseobject.c4
-rw-r--r--source/blender/src/toets.c29
7 files changed, 111 insertions, 34 deletions
diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h
index 78e50ef0479..26e0a12b394 100644
--- a/source/blender/include/BIF_editmesh.h
+++ b/source/blender/include/BIF_editmesh.h
@@ -98,6 +98,8 @@ extern int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin,
extern int EM_check_backbuf_border(int index);
extern void EM_free_backbuf_border(void);
+extern void EM_selectmode_menu(void);
+
extern void vertexnoise(void);
extern void vertexsmooth(void);
extern void righthandfaces(int select);
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index 30b79c09136..a006c1ef44f 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -273,8 +273,9 @@ void uiBlockSetFunc (uiBlock *block, void (*func)(void *arg1, void *arg2), void
void uiButSetFunc (uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2);
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)());
-short pupmenu(char *instr);
-short pupmenu_col(char *instr, int maxrow);
+extern void pupmenu_set_active(int val);
+extern short pupmenu(char *instr);
+extern short pupmenu_col(char *instr, int maxrow);
extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index a198a880781..fa110bdca70 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -149,7 +149,8 @@ int get_border(rcti *rect, short col)
/* draws the selection initial cross */
sdrawXORline4(0, 0, mvalo[1], curarea->winx, mvalo[1]);
sdrawXORline4(1, mvalo[0], 0, mvalo[0], curarea->winy);
-
+ glFlush();
+
while(TRUE) {
/* selection loop while mouse pressed */
@@ -187,6 +188,8 @@ int get_border(rcti *rect, short col)
else if(event==MIDDLEMOUSE) break;
else if(event==RIGHTMOUSE) break;
}
+ else PIL_sleep_ms(10);
+
} /* end while (TRUE) */
/* erase XORed lines */
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
index b2acd58d8a2..2d68fd3e503 100644
--- a/source/blender/src/editmesh_mods.c
+++ b/source/blender/src/editmesh_mods.c
@@ -1572,6 +1572,25 @@ void editmesh_deselect_by_material(int index)
EM_selectmode_flush();
}
+void EM_selectmode_menu(void)
+{
+ int val;
+
+ if(G.scene->selectmode & SCE_SELECT_VERTEX) pupmenu_set_active(1);
+ else if(G.scene->selectmode & SCE_SELECT_EDGE) pupmenu_set_active(2);
+ else pupmenu_set_active(3);
+
+ val= pupmenu("Select Mode%t|Vertices|Edges|Faces");
+ if(val>0) {
+ if(val==1) G.scene->selectmode= SCE_SELECT_VERTEX;
+ else if(val==2) G.scene->selectmode= SCE_SELECT_EDGE;
+ else G.scene->selectmode= SCE_SELECT_FACE;
+
+ EM_selectmode_set(); // when mode changes
+ allqueue(REDRAWVIEW3D, 0);
+ }
+}
+
/* ************************* SEAMS AND EDGES **************** */
void editmesh_mark_seam(int clear)
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 8926ba20185..635df026e11 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -4557,15 +4557,42 @@ void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1,
/* ******************** PUPmenu ****************** */
+static int pupmenu_set= 0;
+
+void pupmenu_set_active(int val)
+{
+ pupmenu_set= val;
+}
+
+/* value== -1 read, otherwise set */
+static int pupmenu_memory(char *str, int value)
+{
+ static char mem[256], first=1;
+ int val=0, nr=0;
+
+ if(first) {
+ memset(mem, 0, 256);
+ first= 0;
+ }
+ while(str[nr]) {
+ val+= str[nr];
+ nr++;
+ }
+
+ if(value >= 0) mem[ val & 255 ]= value;
+ else return mem[ val & 255 ];
+
+ return 0;
+}
+
+#define PUP_LABELH 6
short pupmenu(char *instr)
{
uiBlock *block;
ListBase listb= {NULL, NULL};
int event;
- static int lastselected= 0;
- short width, height=0, mousexmove = 0, mouseymove, xmax, ymax, mval[2], val= -1;
+ short lastselected, width, height=0, mousexmove = 0, mouseymove, xmax, ymax, mval[2], val= -1;
short a, startx, starty, endx, endy, boxh=TBOXH, x1, y1;
- static char laststring[UI_MAX_NAME_STR];
MenuData *md;
/* block stuff first, need to know the font */
@@ -4584,7 +4611,7 @@ short pupmenu(char *instr)
xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts && USER_TR_BUTTONS));
if(xmax>width) width= xmax;
- if( strcmp(name, "%l")==0) height+= 6;
+ if( strcmp(name, "%l")==0) height+= PUP_LABELH;
else height+= boxh;
}
@@ -4595,14 +4622,27 @@ short pupmenu(char *instr)
getmouseco_sc(mval);
- if(strncmp(laststring, instr, UI_MAX_NAME_STR-1)!=0) lastselected= 0;
- BLI_strncpy(laststring, instr, UI_MAX_NAME_STR);
-
+ /* set first item */
+ lastselected= 0;
+ if(pupmenu_set) {
+ lastselected= pupmenu_set-1;
+ pupmenu_set= 0;
+ }
+ else if(md->nitems>1) {
+ lastselected= pupmenu_memory(instr, -1);
+ }
+
startx= mval[0]-(0.8*(width));
+ starty= mval[1]-height+boxh/2;
if(lastselected>=0 && lastselected<md->nitems) {
- starty= mval[1]-height+boxh/2+lastselected*boxh;
+ for(a=0; a<md->nitems; a++) {
+ if(a==lastselected) break;
+ if( strcmp(md->items[a].str, "%l")==0) starty+= PUP_LABELH;
+ else starty+=boxh;
+ }
+
+ //starty= mval[1]-height+boxh/2+lastselected*boxh;
}
- else starty= mval[1]-height/2;
mouseymove= 0;
@@ -4635,20 +4675,20 @@ short pupmenu(char *instr)
if(md->title) {
uiBut *bt;
uiSetCurFont(block, UI_HELVB);
- bt= uiDefBut(block, LABEL, 0, md->title, startx, (short)(starty+md->nitems*boxh), width, boxh, NULL, 0.0, 0.0, 0, 0, "");
+ bt= uiDefBut(block, LABEL, 0, md->title, startx, (short)(starty+height), width, boxh, NULL, 0.0, 0.0, 0, 0, "");
bt->flag= UI_TEXT_LEFT;
uiSetCurFont(block, UI_HELV);
}
- y1= starty + boxh*(md->nitems-1);
+ y1= starty + height - boxh;
x1= startx;
for(a=0; a<md->nitems; a++) {
char *name= md->items[a].str;
if( strcmp(name, "%l")==0) {
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, 6, NULL, 0, 0.0, 0, 0, "");
- y1 -= 6;
+ uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
+ y1 -= PUP_LABELH;
}
else {
uiDefButS(block, BUTM, B_NOP, name, x1, y1, width, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
@@ -4661,11 +4701,14 @@ short pupmenu(char *instr)
event= uiDoBlocks(&listb, 0);
/* calculate last selected */
- lastselected= 0;
- for(a=0; a<md->nitems; a++) {
- if(val==md->items[a].retval) lastselected= a;
+ if(event & UI_RETURN_OK) {
+ lastselected= 0;
+ for(a=0; a<md->nitems; a++) {
+ if(val==md->items[a].retval) lastselected= a;
+ }
+
+ pupmenu_memory(instr, lastselected);
}
-
menudata_free(md);
if(mouseymove && (event & UI_RETURN_OUT)==0) ui_warp_pointer(mousexmove, mouseymove);
@@ -4786,8 +4829,8 @@ short pupmenu_col(char *instr, int maxrow)
y1= starty - boxh*(a%rows) + (rows-1)*boxh;
if( strcmp(name, "%l")==0){
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, 6, NULL, 0, 0.0, 0, 0, "");
- y1 -= 6;
+ uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
+ y1 -= PUP_LABELH;
}
else {
uiDefButI(block, BUTM, B_NOP, name, x1, y1, width, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
index 7fae4f26022..3c3d4ded6c8 100644
--- a/source/blender/src/poseobject.c
+++ b/source/blender/src/poseobject.c
@@ -123,6 +123,8 @@ void enter_posemode(void)
if( arm==0 ) return;
G.obpose= ob;
/* make_poseMesh(); */
+ allqueue(REDRAWHEADERS, 0);
+ allqueue(REDRAWBUTSALL, 0);
allqueue(REDRAWVIEW3D, 0);
break;
default:
@@ -217,6 +219,8 @@ void exit_posemode (int freedata)
countall();
allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWHEADERS, 0);
+ allqueue(REDRAWBUTSALL, 0);
}
else {
G.obpose= ob;
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index 41991d44792..4d1af7ba5af 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -72,16 +72,17 @@
#include "BKE_scene.h"
#include "BKE_utildefines.h"
-#include "BIF_interface.h"
-#include "BIF_screen.h"
-#include "BIF_space.h"
#include "BIF_butspace.h"
-#include "BIF_renderwin.h"
-#include "BIF_toolbox.h"
-#include "BIF_toets.h"
#include "BIF_editseq.h"
#include "BIF_editsound.h"
+#include "BIF_editmesh.h"
+#include "BIF_interface.h"
#include "BIF_poseobject.h"
+#include "BIF_renderwin.h"
+#include "BIF_screen.h"
+#include "BIF_space.h"
+#include "BIF_toets.h"
+#include "BIF_toolbox.h"
#include "BIF_usiblender.h"
#include "BDR_vpaint.h"
@@ -751,12 +752,16 @@ int blenderqread(unsigned short event, short val)
}
}
else if(G.qual==LR_CTRLKEY){
- if(G.obpose)
- exit_posemode(1);
- else
- enter_posemode();
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSALL, 0);
+ Object *ob= OBACT;
+ if(ob) {
+ if(ob->type==OB_ARMATURE) {
+ if(G.obpose) exit_posemode(1);
+ else enter_posemode();
+ }
+ else if(ob->type==OB_MESH) {
+ EM_selectmode_menu();
+ }
+ }
}
else if(G.qual==LR_SHIFTKEY) {
if(G.obedit)