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/blenloader/intern/readfile.c17
-rw-r--r--source/blender/include/BIF_drawimage.h1
-rw-r--r--source/blender/include/BIF_editsima.h2
-rw-r--r--source/blender/include/BIF_space.h4
-rw-r--r--source/blender/makesdna/DNA_action_types.h3
-rw-r--r--source/blender/makesdna/DNA_sound_types.h3
-rw-r--r--source/blender/makesdna/DNA_space_types.h3
-rw-r--r--source/blender/src/drawimage.c216
-rw-r--r--source/blender/src/editsima.c11
-rw-r--r--source/blender/src/space.c55
-rw-r--r--source/blender/src/toets.c1
-rw-r--r--source/blender/src/toolbox.c2
-rw-r--r--source/blender/src/vpaint.c1
13 files changed, 264 insertions, 55 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index cb241af6c4c..1d7668af5d1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4117,7 +4117,8 @@ static void do_versions(Main *main)
if(main->versionfile <= 232) {
Tex *tex= main->tex.first;
World *wrld= main->world.first;
-
+ bScreen *sc;
+
while(tex) {
/* copied from kernel texture.c */
if(tex->ns_outscale==0.0) {
@@ -4143,7 +4144,19 @@ static void do_versions(Main *main)
if(wrld->aoenergy==0.0) wrld->aoenergy= 1.0;
wrld= wrld->id.next;
}
-
+
+
+ // new variable blockscale, for panels in any area, do again because new
+ // areas didnt initialize it to 0.7 yet
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if(sl->blockscale==0.0) sl->blockscale= 0.7;
+ }
+ }
+ }
}
diff --git a/source/blender/include/BIF_drawimage.h b/source/blender/include/BIF_drawimage.h
index fdf4afd029a..bc4b88f4b5d 100644
--- a/source/blender/include/BIF_drawimage.h
+++ b/source/blender/include/BIF_drawimage.h
@@ -36,6 +36,7 @@
struct ScrArea;
struct SpaceImage;
+void do_imagebuts(unsigned short event);
void calc_image_view(struct SpaceImage *sima, char mode);
void drawimagespace(struct ScrArea *sa, void *spacedata);
void draw_tfaces(void);
diff --git a/source/blender/include/BIF_editsima.h b/source/blender/include/BIF_editsima.h
index a86409ddb0e..86715b4947f 100644
--- a/source/blender/include/BIF_editsima.h
+++ b/source/blender/include/BIF_editsima.h
@@ -30,7 +30,7 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-void clever_numbuts_sima(void);
+int is_uv_tface_editing_allowed(void);
void borderselect_sima(void);
void mouseco_to_curtile(void);
void mouse_select_sima(void);
diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h
index 2a175721677..54984003904 100644
--- a/source/blender/include/BIF_space.h
+++ b/source/blender/include/BIF_space.h
@@ -57,6 +57,10 @@ struct BWinEvent;
/* ipo handler codes */
#define IPO_HANDLER_PROPERTIES 20
+/* image handler codes */
+#define IMAGE_HANDLER_PROPERTIES 30
+
+
void scrarea_do_windraw (struct ScrArea *sa);
void scrarea_do_winchange (struct ScrArea *sa);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 6be0096f0fb..db49b45f61c 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -81,7 +81,8 @@ typedef struct bAction {
typedef struct SpaceAction {
struct SpaceLink *next, *prev;
- int spacetype, pad;
+ int spacetype;
+ float blockscale;
struct ScrArea *area;
View2D v2d;
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index aa6a6576758..82b457ac003 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -137,7 +137,8 @@ typedef struct bSoundListener {
typedef struct SpaceSound {
struct SpaceLink *next, *prev;
- int spacetype, pad;
+ int spacetype;
+ float blockscale;
struct ScrArea *area;
View2D v2d;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 46fb2e4123b..3f81e9a211e 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -256,7 +256,8 @@ typedef struct SpaceText {
typedef struct SpaceScript {
SpaceLink *next, *prev;
- int spacetype, pad1;
+ int spacetype;
+ float blockscale;
struct ScrArea *area;
struct Script *script;
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index a2702d40a72..3cb47750d6d 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -71,10 +71,14 @@
#include "BIF_mywindow.h"
#include "BIF_drawimage.h"
#include "BIF_resources.h"
+#include "BIF_interface.h"
+#include "BIF_editsima.h"
/* Modules used */
#include "mydevice.h"
+#include "blendef.h"
#include "render.h"
+#include "butspace.h" // event codes
void rectwrite_part(int winxmin, int winymin, int winxmax, int winymax, int x1, int y1, int xim, int yim, float zoomx, float zoomy, unsigned int *rect)
@@ -316,7 +320,8 @@ void draw_tfaces(void)
if(me && me->tface) {
calc_image_view(G.sima, 'f'); /* float */
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
-
+ glLoadIdentity();
+
/* draw shadow mesh */
if(G.sima->flag & SI_DRAWSHADOW){
tface= me->tface;
@@ -452,7 +457,28 @@ void draw_tfaces(void)
}
/* to make sure vertices markers are visible, draw them last */
+ /* we draw selected over unselected, so two loops */
BIF_GetThemeColor3ubv(TH_VERTEX, col1);
+ glColor4ubv(col1);
+ tface= me->tface;
+ mface= me->mface;
+ a= me->totface;
+ while(a--) {
+ if(mface->v3 && (tface->flag & TF_SELECT) ) {
+ glBegin(GL_POINTS);
+
+ if(tface->flag & TF_SEL1); else glVertex2fv(tface->uv[0]);
+ if(tface->flag & TF_SEL2); else glVertex2fv(tface->uv[1]);
+ if(tface->flag & TF_SEL3); else glVertex2fv(tface->uv[2]);
+ if(mface->v4) {
+ if(tface->flag & TF_SEL4); else glVertex2fv(tface->uv[3]);
+ }
+ glEnd();
+ }
+ tface++;
+ mface++;
+ }
+ /* selected */
BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, col2);
glColor4ubv(col2);
tface= me->tface;
@@ -462,22 +488,11 @@ void draw_tfaces(void)
if(mface->v3 && (tface->flag & TF_SELECT) ) {
glBegin(GL_POINTS);
- if(tface->flag & TF_SEL1) glColor3ubv(col2);
- else glColor3ubv(col1);
- glVertex2fv(tface->uv[0]);
-
- if(tface->flag & TF_SEL2) glColor3ubv(col2);
- else glColor3ubv(col1);
- glVertex2fv(tface->uv[1]);
-
- if(tface->flag & TF_SEL3) glColor3ubv(col2);
- else glColor3ubv(col1);
- glVertex2fv(tface->uv[2]);
-
+ if(tface->flag & TF_SEL1) glVertex2fv(tface->uv[0]);
+ if(tface->flag & TF_SEL2) glVertex2fv(tface->uv[1]);
+ if(tface->flag & TF_SEL3) glVertex2fv(tface->uv[2]);
if(mface->v4) {
- if(tface->flag & TF_SEL4) glColor3ubv(col2);
- else glColor3ubv(col1);
- glVertex2fv(tface->uv[3]);
+ if(tface->flag & TF_SEL4) glVertex2fv(tface->uv[3]);
}
glEnd();
}
@@ -560,6 +575,164 @@ static void draw_image_view_icon(void)
glDisable(GL_BLEND);
}
+/* ************ panel stuff ************* */
+
+// button define is local, only events defined here possible
+#define B_TRANS_IMAGE 1
+
+/* is used for both read and write... */
+static void image_editvertex_buts(uiBlock *block)
+{
+ static float ocent[2];
+ float cent[2]= {0.0, 0.0};
+ int imx, imy;
+ int i, nactive= 0;
+ Mesh *me;
+
+ if( is_uv_tface_editing_allowed()==0 ) return;
+ me= get_mesh(OBACT);
+
+ if (G.sima->image && G.sima->image->ibuf) {
+ imx= G.sima->image->ibuf->x;
+ imy= G.sima->image->ibuf->y;
+ } else
+ imx= imy= 256;
+
+ for (i=0; i<me->totface; i++) {
+ MFace *mf= &((MFace*) me->mface)[i];
+ TFace *tf= &((TFace*) me->tface)[i];
+
+ if (!mf->v3 || !(tf->flag & TF_SELECT))
+ continue;
+
+ if (tf->flag & TF_SEL1) {
+ cent[0]+= tf->uv[0][0];
+ cent[1]+= tf->uv[0][1];
+ nactive++;
+ }
+ if (tf->flag & TF_SEL2) {
+ cent[0]+= tf->uv[1][0];
+ cent[1]+= tf->uv[1][1];
+ nactive++;
+ }
+ if (tf->flag & TF_SEL3) {
+ cent[0]+= tf->uv[2][0];
+ cent[1]+= tf->uv[2][1];
+ nactive++;
+ }
+ if (mf->v4 && (tf->flag & TF_SEL4)) {
+ cent[0]+= tf->uv[3][0];
+ cent[1]+= tf->uv[3][1];
+ nactive++;
+ }
+ }
+
+ if(block) { // do the buttons
+ if (nactive) {
+ ocent[0]= (cent[0]*imx)/nactive;
+ ocent[1]= (cent[1]*imy)/nactive;
+
+ if(nactive==1) {
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex X:", 10, 100, 300, 19, &ocent[0], -10*imx, 10.0*imx, 100, 0, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex Y:", 10, 80, 300, 19, &ocent[1], -10*imy, 10.0*imy, 100, 0, "");
+ }
+ else {
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Median X:", 10, 100, 300, 19, &ocent[0], -10*imx, 10.0*imx, 100, 0, "");
+ uiDefButF(block, NUM, B_TRANS_IMAGE, "Median Y:", 10, 80, 300, 19, &ocent[1], -10*imy, 10.0*imy, 100, 0, "");
+ }
+ }
+ }
+ else { // apply event
+ float delta[2];
+
+ cent[0]= (cent[0]*imx)/nactive;
+ cent[1]= (cent[1]*imy)/nactive;
+
+ delta[0]= (ocent[0]-cent[0])/imx;
+ delta[1]= (ocent[1]-cent[1])/imy;
+
+ for (i=0; i<me->totface; i++) {
+ MFace *mf= &((MFace*) me->mface)[i];
+ TFace *tf= &((TFace*) me->tface)[i];
+
+ if (!mf->v3 || !(tf->flag & TF_SELECT))
+ continue;
+
+ if (tf->flag & TF_SEL1) {
+ tf->uv[0][0]+= delta[0];
+ tf->uv[0][1]+= delta[1];
+ }
+ if (tf->flag & TF_SEL2) {
+ tf->uv[1][0]+= delta[0];
+ tf->uv[1][1]+= delta[1];
+ }
+ if (tf->flag & TF_SEL3) {
+ tf->uv[2][0]+= delta[0];
+ tf->uv[2][1]+= delta[1];
+ }
+ if (mf->v4 && (tf->flag & TF_SEL4)) {
+ tf->uv[3][0]+= delta[0];
+ tf->uv[3][1]+= delta[1];
+ }
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIMAGE, 0);
+ }
+}
+
+
+void do_imagebuts(unsigned short event)
+{
+ switch(event) {
+ case B_TRANS_IMAGE:
+ image_editvertex_buts(NULL);
+ break;
+ }
+}
+
+static void image_panel_properties(short cntrl) // IMAGE_HANDLER_PROPERTIES
+{
+ uiBlock *block;
+
+ 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, "Transform Properties", "Image", 10, 230, 318, 204)==0) return;
+
+ if (G.sima->image && G.sima->image->ibuf) {
+ char str[32];
+ sprintf(str, "Image size %d x %d", G.sima->image->ibuf->x, G.sima->image->ibuf->y);
+ uiDefBut(block, LABEL, 0, str, 10,180,300,19, 0, 0, 0, 0, 0, "");
+ }
+
+ image_editvertex_buts(block);
+}
+
+static void image_blockhandlers(ScrArea *sa)
+{
+ SpaceImage *sima= sa->spacedata.first;
+ short a;
+
+ /* warning; blocks need to be freed each time, handlers dont remove */
+ uiFreeBlocksWin(&sa->uiblocks, sa->win);
+
+ for(a=0; a<SPACE_MAXHANDLER; a+=2) {
+ switch(sima->blockhandler[a]) {
+
+ case IMAGE_HANDLER_PROPERTIES:
+ image_panel_properties(sima->blockhandler[a+1]);
+ break;
+
+ }
+ /* clear action value for event */
+ sima->blockhandler[a+1]= 0;
+ }
+ uiDrawBlocksPanels(sa, 0);
+}
+
+
+
void drawimagespace(ScrArea *sa, void *spacedata)
{
ImBuf *ibuf= NULL;
@@ -572,8 +745,8 @@ void drawimagespace(ScrArea *sa, void *spacedata)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
-
- curarea->win_swap= WIN_BACK_OK;
+ bwin_clear_viewmat(sa->win); /* clear buttons view */
+ glLoadIdentity();
xmin= curarea->winrct.xmin; xmax= curarea->winrct.xmax;
ymin= curarea->winrct.ymin; ymax= curarea->winrct.ymax;
@@ -670,7 +843,12 @@ void drawimagespace(ScrArea *sa, void *spacedata)
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
draw_image_view_icon();
draw_area_emboss(sa);
- myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
+
+ /* it is important to end a view in a transform compatible with buttons */
+ bwin_scalematrix(sa->win, G.sima->blockscale, G.sima->blockscale, G.sima->blockscale);
+ image_blockhandlers(sa);
+
+ curarea->win_swap= WIN_BACK_OK;
}
void image_viewmove(void)
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 54dccca6512..d8d31c307f1 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -98,7 +98,7 @@ static int compuvvert(const void *u1, const void *u2)
return 0;
}
-static int is_uv_tface_editing_allowed(void)
+int is_uv_tface_editing_allowed(void)
{
Mesh *me;
@@ -1132,14 +1132,7 @@ void mouse_select_sima(void)
*flagpoin |= val;
}
- if(redraw || G.f & G_DRAWFACES) force_draw();
- else {
- glDrawBuffer(GL_FRONT);
- draw_tfaces();
- /*at OSX, a flush pops up the "frontbuffer" (it does a swap, doh!)*/
- glFlush();
- glDrawBuffer(GL_BACK);
- }
+ force_draw();
std_rmouse_transform(transform_tface_uv);
}
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 57d1d8b222e..a3f24557d3a 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -85,6 +85,7 @@
#include "BIF_drawimage.h"
#include "BIF_drawseq.h"
#include "BIF_drawtext.h"
+#include "BIF_drawscript.h"
#include "BIF_editarmature.h"
#include "BIF_editfont.h"
#include "BIF_editika.h"
@@ -3016,6 +3017,7 @@ void init_seqspace(ScrArea *sa)
sseq->spacetype= SPACE_SEQ;
sseq->zoom= 1;
+ sseq->blockscale= 0.7;
/* seq space goes from (0,8) to (250, 0) */
@@ -3065,6 +3067,7 @@ void init_actionspace(ScrArea *sa)
BLI_addhead(&sa->spacedata, saction);
saction->spacetype= SPACE_ACTION;
+ saction->blockscale= 0.7;
saction->v2d.tot.xmin= 1.0;
saction->v2d.tot.ymin= 0.0;
@@ -3116,7 +3119,7 @@ void init_filespace(ScrArea *sa)
sfile->dir[0]= '/';
sfile->type= FILE_UNIX;
-
+ sfile->blockscale= 0.7;
sfile->spacetype= SPACE_FILE;
}
@@ -3128,7 +3131,7 @@ void init_textspace(ScrArea *sa)
BLI_addhead(&sa->spacedata, st);
st->spacetype= SPACE_TEXT;
-
+ st->blockscale= 0.7;
st->text= NULL;
st->flags= 0;
@@ -3147,7 +3150,7 @@ void init_scriptspace(ScrArea *sa)
BLI_addhead(&sa->spacedata, sc);
sc->spacetype = SPACE_SCRIPT;
-
+ sc->blockscale= 0.7;
sc->script = NULL;
sc->flags = 0;
}
@@ -3160,7 +3163,7 @@ void init_imaselspace(ScrArea *sa)
BLI_addhead(&sa->spacedata, simasel);
simasel->spacetype= SPACE_IMASEL;
-
+ simasel->blockscale= 0.7;
simasel->mode = 7;
strcpy (simasel->dir, U.textudir); /* TON */
strcpy (simasel->file, "");
@@ -3199,7 +3202,7 @@ void init_soundspace(ScrArea *sa)
BLI_addhead(&sa->spacedata, ssound);
ssound->spacetype= SPACE_SOUND;
-
+ ssound->blockscale= 0.7;
/* sound space goes from (0,8) to (250, 0) */
ssound->v2d.tot.xmin= -4.0;
@@ -3255,7 +3258,7 @@ void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
#endif /* NAN_TPT */
if(val==0) return;
- if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
+ if(uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
if (sima->flag & SI_DRAWTOOL) {
#ifdef NAN_TPT
@@ -3319,6 +3322,7 @@ void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
else {
/* Draw tool is inactive */
+
switch(event) {
case LEFTMOUSE:
if(G.qual & LR_SHIFTKEY) mouseco_to_curtile();
@@ -3407,24 +3411,33 @@ void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
transform_tface_uv('w');
break;
}
- }
+ }
/* Events handled always (whether the draw tool is active or not) */
switch (event) {
- case MIDDLEMOUSE:
- image_viewmove();
- break;
- case WHEELUPMOUSE:
- case WHEELDOWNMOUSE:
- case PADPLUSKEY:
- case PADMINUS:
- image_viewzoom(event);
+ case UI_BUT_EVENT:
+ do_imagebuts(val); // drawimage.c
+ break;
+ case MIDDLEMOUSE:
+ image_viewmove();
+ break;
+ case WHEELUPMOUSE:
+ case WHEELDOWNMOUSE:
+ case PADPLUSKEY:
+ case PADMINUS:
+ image_viewzoom(event);
+ scrarea_queue_winredraw(curarea);
+ break;
+ case HOMEKEY:
+ if((G.qual==0))
+ image_home();
+ break;
+ case NKEY:
+ if(G.qual==0) {
+ add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
scrarea_queue_winredraw(curarea);
- break;
- case HOMEKEY:
- if((G.qual==0))
- image_home();
- break;
+ }
+ break;
}
}
@@ -3438,6 +3451,7 @@ void init_imagespace(ScrArea *sa)
sima->spacetype= SPACE_IMAGE;
sima->zoom= 1;
+ sima->blockscale= 0.7;
}
@@ -3607,6 +3621,7 @@ void init_oopsspace(ScrArea *sa)
soops->visiflag= OOPS_OB+OOPS_MA+OOPS_ME+OOPS_TE+OOPS_CU+OOPS_IP;
soops->spacetype= SPACE_OOPS;
+ soops->blockscale= 0.7;
init_v2d_oops(&soops->v2d);
}
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index 91597e8a91c..c9094670859 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -810,6 +810,7 @@ int blenderqread(unsigned short event, short val)
else if(G.qual==0 || (G.qual & LR_SHIFTKEY)) {
if(curarea->spacetype==SPACE_VIEW3D); // is new panel, in view3d queue
else if(curarea->spacetype==SPACE_IPO); // is new panel, in ipo queue
+ else if(curarea->spacetype==SPACE_IMAGE); // is new panel, in ipo queue
else {
clever_numbuts();
return 0;
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 1bccd979d3d..cffcf1ed8ba 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -1451,7 +1451,7 @@ void clever_numbuts(void)
clever_numbuts_seq();
}
else if(curarea->spacetype==SPACE_IMAGE) {
- clever_numbuts_sima();
+ //clever_numbuts_sima();
}
else if(curarea->spacetype==SPACE_IMASEL) {
clever_numbuts_imasel();
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
index a4b33cb1f09..bd9cf884970 100644
--- a/source/blender/src/vpaint.c
+++ b/source/blender/src/vpaint.c
@@ -239,6 +239,7 @@ void make_vertexcol() /* single ob */
me= get_mesh(ob);
if(me==0) return;
+ /* to be able to copy lighting info, we only use it from single side (ton) */
if(me->flag & ME_TWOSIDED) {
me->flag &= ~ME_TWOSIDED;
}