[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12041] trunk/blender/source/blender: added a transform panel to the UV/ Image window - at the moment it sets UV and teh cursor location.
Campbell Barton
cbarton at metavr.com
Sat Sep 15 12:43:13 CEST 2007
Revision: 12041
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12041
Author: campbellbarton
Date: 2007-09-15 12:43:13 +0200 (Sat, 15 Sep 2007)
Log Message:
-----------
added a transform panel to the UV/Image window - at the moment it sets UV and teh cursor location.
added a stap menu to the UV/Image window for snapping the selection and cursor.
reverted to drawing face dots in editmode when Limit Selection is enabled. even though its not needed for selection its consistent and dosnt look like modes are being changed.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_utildefines.h
trunk/blender/source/blender/include/BIF_drawimage.h
trunk/blender/source/blender/include/BIF_editsima.h
trunk/blender/source/blender/include/BIF_space.h
trunk/blender/source/blender/include/blendef.h
trunk/blender/source/blender/src/drawimage.c
trunk/blender/source/blender/src/drawobject.c
trunk/blender/source/blender/src/editsima.c
trunk/blender/source/blender/src/header_image.c
trunk/blender/source/blender/src/header_view3d.c
trunk/blender/source/blender/src/space.c
Modified: trunk/blender/source/blender/blenkernel/BKE_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_utildefines.h 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/blenkernel/BKE_utildefines.h 2007-09-15 10:43:13 UTC (rev 12041)
@@ -97,6 +97,7 @@
#define ABS(a) ( (a)<0 ? (-(a)) : (a) )
#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);}
+#define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);}
#define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);}
#define LONGCOPY(a, b, c) {int lcpc=c, *lcpa=(int *)a, *lcpb=(int *)b; while(lcpc-->0) *(lcpa++)= *(lcpb++);}
Modified: trunk/blender/source/blender/include/BIF_drawimage.h
===================================================================
--- trunk/blender/source/blender/include/BIF_drawimage.h 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/include/BIF_drawimage.h 2007-09-15 10:43:13 UTC (rev 12041)
@@ -64,6 +64,7 @@
struct ImBuf *imagewindow_get_ibuf(struct SpaceImage *sima);
void image_editvertex_buts(struct uiBlock *block);
+void image_editcursor_buts(struct uiBlock *block);
#endif
Modified: trunk/blender/source/blender/include/BIF_editsima.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editsima.h 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/include/BIF_editsima.h 2007-09-15 10:43:13 UTC (rev 12041)
@@ -45,6 +45,7 @@
void get_connected_limit_tface_uv(float *limit);
int minmax_tface_uv(float *min, float *max);
+int cent_tface_uv(float *cent, int mode);
void transform_width_height_tface_uv(int *width, int *height);
void transform_aspect_ratio_tface_uv(float *aspx, float *aspy);
@@ -53,6 +54,8 @@
void borderselect_sima(short whichuvs);
void mouseco_to_curtile(void);
void mouse_select_sima(void);
+void snap_menu_sima(void);
+
void select_invert_tface_uv(void);
void select_swap_tface_uv(void);
void mirrormenu_tface_uv(void);
Modified: trunk/blender/source/blender/include/BIF_space.h
===================================================================
--- trunk/blender/source/blender/include/BIF_space.h 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/include/BIF_space.h 2007-09-15 10:43:13 UTC (rev 12041)
@@ -65,6 +65,7 @@
#define IMAGE_HANDLER_CURVES 32
#define IMAGE_HANDLER_PREVIEW 33
#define IMAGE_HANDLER_GAME_PROPERTIES 34
+#define IMAGE_HANDLER_TRANSFORM_PROPERTIES 35
/* action handler codes */
#define ACTION_HANDLER_PROPERTIES 40
Modified: trunk/blender/source/blender/include/blendef.h
===================================================================
--- trunk/blender/source/blender/include/blendef.h 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/include/blendef.h 2007-09-15 10:43:13 UTC (rev 12041)
@@ -332,9 +332,10 @@
#define B_SIMANAME 381
#define B_SIMAMULTI 382
#define B_TRANS_IMAGE 383
-#define B_SIMA_REPACK 384
-#define B_SIMA_PLAY 385
-#define B_SIMA_RECORD 386
+#define B_CURSOR_IMAGE 384
+#define B_SIMA_REPACK 385
+#define B_SIMA_PLAY 386
+#define B_SIMA_RECORD 387
/* BUTS: 400 */
#define B_BUTSHOME 401
Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/src/drawimage.c 2007-09-15 10:43:13 UTC (rev 12041)
@@ -732,6 +732,26 @@
/* ************ panel stuff ************* */
+/* this function gets the values for cursor and vertex number buttons */
+static void image_transform_but_attr(int *imx, int *imy, int *step, int *digits) /*, float *xcoord, float *ycoord)*/
+{
+ ImBuf *ibuf= imagewindow_get_ibuf(G.sima);
+ if(ibuf) {
+ *imx= ibuf->x;
+ *imy= ibuf->y;
+ }
+
+ if (G.sima->flag & SI_COORDFLOATS) {
+ *step= 1;
+ *digits= 3;
+ }
+ else {
+ *step= 100;
+ *digits= 2;
+ }
+}
+
+
/* is used for both read and write... */
void image_editvertex_buts(uiBlock *block)
{
@@ -745,13 +765,7 @@
if( is_uv_tface_editing_allowed_silent()==0 ) return;
- if (G.sima->image) {
- ImBuf *ibuf= imagewindow_get_ibuf(G.sima);
- if(ibuf) {
- imx= ibuf->x;
- imy= ibuf->y;
- }
- }
+ image_transform_but_attr(&imx, &imy, &step, &digits);
for (efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT)) continue;
@@ -784,24 +798,19 @@
ocent[0]= cent[0]/nactive;
ocent[1]= cent[1]/nactive;
if (G.sima->flag & SI_COORDFLOATS) {
- step= 1;
- digits= 3;
- }
- else {
+ } else {
ocent[0] *= imx;
ocent[1] *= imy;
- step= 100;
- digits= 2;
}
uiBlockBeginAlign(block);
if(nactive==1) {
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex X:", 10, 10, 150, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex Y:", 160, 10, 150, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex X:", 10, 40, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex Y:", 10, 20, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
}
else {
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Median X:", 10, 10, 150, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
- uiDefButF(block, NUM, B_TRANS_IMAGE, "Median Y:", 160, 10, 150, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Median X:", 10, 40, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Median Y:", 10, 20, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
}
uiBlockEndAlign(block);
}
@@ -821,9 +830,6 @@
delta[1]= ocent[1]/imy - cent[1];
}
- /*for (i=0; i<me->totface; i++) {
- MFace *mf= &((MFace*) me->mface)[i];
- MTFace *tf= &((MTFace*) me->mtface)[i];*/
for (efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT)) continue;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -851,6 +857,48 @@
}
}
+
+/* is used for both read and write... */
+void image_editcursor_buts(uiBlock *block)
+{
+ static float ocent[2];
+ /*float cent[2]= {0.0, 0.0};*/
+ int imx= 256, imy= 256;
+ int step, digits;
+
+ if( is_uv_tface_editing_allowed_silent()==0 ) return;
+
+ image_transform_but_attr(&imx, &imy, &step, &digits);
+
+ if(block) { // do the buttons
+ ocent[0]= G.v2d->cursor[0];
+ ocent[1]= G.v2d->cursor[1];
+ if (G.sima->flag & SI_COORDFLOATS) {
+ } else {
+ ocent[0] *= imx;
+ ocent[1] *= imy;
+ }
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor X:", 165, 40, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
+ uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor Y:", 165, 20, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
+ uiBlockEndAlign(block);
+
+ }
+ else { // apply event
+ if (G.sima->flag & SI_COORDFLOATS) {
+ G.v2d->cursor[0]= ocent[0];
+ G.v2d->cursor[1]= ocent[1];
+ }
+ else {
+ G.v2d->cursor[0]= ocent[0]/imx;
+ G.v2d->cursor[1]= ocent[1]/imy;
+ }
+ allqueue(REDRAWIMAGE, 0);
+ }
+}
+
+
void image_info(Image *ima, ImBuf *ibuf, char *str)
{
int ofs= 0;
@@ -900,13 +948,11 @@
block= uiNewBlock(&curarea->uiblocks, "image_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
uiSetPanelHandler(IMAGE_HANDLER_PROPERTIES); // for close and esc
- if(uiNewPanel(curarea, block, "Properties", "Image", 10, 10, 318, 204)==0)
+ if(uiNewPanel(curarea, block, "Image Properties", "Image", 10, 10, 318, 204)==0)
return;
/* note, it draws no bottom half in facemode, for vertex buttons */
uiblock_image_panel(block, &G.sima->image, &G.sima->iuser, B_REDR, B_REDR);
-
- image_editvertex_buts(block);
}
static void image_panel_game_properties(short cntrl) // IMAGE_HANDLER_GAME_PROPERTIES
@@ -946,6 +992,22 @@
}
}
+static void image_panel_transform_properties(short cntrl) // IMAGE_HANDLER_TRANSFORM_PROPERTIES
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "image_transform_properties", UI_EMBOSS, UI_HELV, curarea->win);
+ uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
+ uiSetPanelHandler(IMAGE_HANDLER_TRANSFORM_PROPERTIES); // for close and esc
+ if(uiNewPanel(curarea, block, "Transform Properties", "Image", 10, 10, 318, 204)==0)
+ return;
+
+ uiDefButBitI(block, TOG, SI_COORDFLOATS, B_SIMAGEDRAW1, "Normalized Coords", 10,80,140,19, &G.sima->flag, 0, 0, 0, 0, "Display coords from 0.0 to 1.0 rather then in pixels");
+
+ image_editvertex_buts(block);
+ image_editcursor_buts(block);
+}
+
static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
{
/* B_SIMABRUSHCHANGE only redraws and eats the mouse messages */
@@ -1259,6 +1321,10 @@
case IMAGE_HANDLER_GAME_PROPERTIES:
image_panel_game_properties(sima->blockhandler[a+1]);
break;
+ case IMAGE_HANDLER_TRANSFORM_PROPERTIES:
+ if (EM_texFaceCheck())
+ image_panel_transform_properties(sima->blockhandler[a+1]);
+ break;
case IMAGE_HANDLER_PAINT:
image_panel_paint(sima->blockhandler[a+1]);
break;
Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c 2007-09-14 18:41:00 UTC (rev 12040)
+++ trunk/blender/source/blender/src/drawobject.c 2007-09-15 10:43:13 UTC (rev 12041)
@@ -1633,8 +1633,7 @@
}
if( (G.scene->selectmode & SCE_SELECT_FACE) &&
- (G.vd->drawtype<=OB_SOLID) &&
- ( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) )
+ (G.vd->drawtype<=OB_SOLID)
) {
glPointSize(fsize);
glColor4ubv((GLubyte *)fcol);
@@ -4453,8 +4452,7 @@
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0);
if( (G.scene->selectmode & SCE_SELECT_FACE) &&
- (G.vd->drawtype<=OB_SOLID) &&
- ( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) )
+ (G.vd->drawtype<=OB_SOLID)
) {
glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
Modified: trunk/blender/source/blender/src/editsima.c
===================================================================
--- trunk/blender/source/blender/src/editsima.c 2007-09-14 18:41:00 UTC (rev 12040)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list