== Align ==

Use pupmenu menu to select align orientation. Faster workflow than always having to change the current transform orientation beforehand.
This commit is contained in:
2008-03-16 16:00:00 +00:00
parent 26daad49a3
commit 6a2e538d98
7 changed files with 26 additions and 12 deletions

View File

@@ -105,7 +105,7 @@ int BIF_menuselectTransformOrientation(void);
void BIF_selectTransformOrientation(struct TransformOrientation *ts);
void BIF_selectTransformOrientationFromIndex(int index);
char * BIF_menustringTransformOrientation(); /* the returned value was allocated and needs to be freed after use */
char * BIF_menustringTransformOrientation(char *title); /* the returned value was allocated and needs to be freed after use */
int BIF_countTransformOrientation();
/* Drawing callbacks */

View File

@@ -40,6 +40,7 @@ int get_border(struct rcti *rect, short col);
void countall(void);
void snapmenu(void);
void mergemenu(void);
void alignmenu(void);
void delete_context_selected(void);
void duplicate_context_selected(void);
void toggle_shading(void);

View File

@@ -1856,6 +1856,22 @@ void snapmenu()
}
}
void alignmenu()
{
short val;
char *str_menu = BIF_menustringTransformOrientation("Align");
val= pupmenu(str_menu);
MEM_freeN(str_menu);
if (val >= 0)
{
short old_val = G.vd->twmode;
G.vd->twmode = val;
initTransform(TFM_ALIGN, CTX_NO_PET|CTX_AUTOCONFIRM);
Transform();
G.vd->twmode = old_val;
}
}
#define MERGELIMIT 0.001
void mergemenu(void)

View File

@@ -1787,8 +1787,7 @@ static void do_view3d_transformmenu(void *arg, int event)
G.scene->snap_target = SCE_SNAP_TARGET_ACTIVE;
break;
case 21:
initTransform(TFM_ALIGN, CTX_NO_PET|CTX_AUTOCONFIRM);
Transform();
alignmenu();
break;
}
allqueue(REDRAWVIEW3D, 0);
@@ -5603,7 +5602,7 @@ void view3d_buttons(void)
xco+= XIC;
}
str_menu = BIF_menustringTransformOrientation();
str_menu = BIF_menustringTransformOrientation("Orientation");
uiDefButS(block, MENU, B_MAN_MODE, str_menu,xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (ALT+Space)");
MEM_freeN(str_menu);

View File

@@ -1744,10 +1744,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case AKEY:
if (G.obedit == 0 && G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
if(okee("Align to Transform Orientation")) {
initTransform(TFM_ALIGN, CTX_NO_PET|CTX_AUTOCONFIRM);
Transform();
}
alignmenu();
}
else if(G.qual & LR_CTRLKEY) { /* also with shift! */
apply_object();

View File

@@ -467,7 +467,7 @@ static void viewRedrawPost(TransInfo *t)
void BIF_selectOrientation() {
short val;
char *str_menu = BIF_menustringTransformOrientation();
char *str_menu = BIF_menustringTransformOrientation("Orientation");
val= pupmenu(str_menu);
MEM_freeN(str_menu);

View File

@@ -313,8 +313,8 @@ void BIF_selectTransformOrientationFromIndex(int index) {
G.vd->twmode = V3D_MANIP_CUSTOM + index;
}
char * BIF_menustringTransformOrientation() {
char menu[] = "Orientation%t|Global%x0|Local%x1|Normal%x2|View%x3";
char * BIF_menustringTransformOrientation(char *title) {
char menu[] = "%t|Global%x0|Local%x1|Normal%x2|View%x3";
ListBase *transform_spaces = &G.scene->transform_spaces;
TransformOrientation *ts;
int i = V3D_MANIP_CUSTOM;
@@ -324,7 +324,8 @@ char * BIF_menustringTransformOrientation() {
str_menu = MEM_callocN(strlen(menu) + 40 * BIF_countTransformOrientation(), "UserTransSpace from matrix");
p = str_menu;
p += sprintf(str_menu, "%s", menu);
p += sprintf(str_menu, "%s", title);
p += sprintf(p, "%s", menu);
for (ts = transform_spaces->first; ts; ts = ts->next) {
p += sprintf(p, "|%s%%x%d", ts->name, i++);