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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-10-28 17:20:03 +0300
committerTon Roosendaal <ton@blender.org>2003-10-28 17:20:03 +0300
commit4bec8ba7d53e4b90c683e183f1090a859a0e5a0e (patch)
tree13a008eb49af37fa42fedef7038adb87ae278871 /source
parentc6ec4cb984b43c762d8f55d5b24d9c4f617cb4ee (diff)
Fixing loose ends:
- nkey menu for buttonswindow (hex values) couldnt be restored yet, is for next release - replaced Nkey in IpoWindow with Panel, this now displays the buttons that were formerly in 'anim buttons' as well; to view the boundbox values of all visible curves, and adjust it. - the new panel also has the 'set speed' option, fixed stuff in it and added better errorwarning... still not a very well coded tool!
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_interface.h3
-rw-r--r--source/blender/include/BIF_space.h3
-rw-r--r--source/blender/include/butspace.h10
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/src/butspace.c104
-rw-r--r--source/blender/src/buttons_object.c49
-rw-r--r--source/blender/src/buttons_shading.c102
-rw-r--r--source/blender/src/drawipo.c331
-rw-r--r--source/blender/src/editipo.c12
-rw-r--r--source/blender/src/interface.c12
-rw-r--r--source/blender/src/space.c21
-rw-r--r--source/blender/src/toets.c7
-rw-r--r--source/blender/src/toolbox.c2
13 files changed, 460 insertions, 198 deletions
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index cd1d75dd13a..1d8efa83efe 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -98,7 +98,8 @@ struct ScrArea;
#define UI_MAKE_DOWN 256
#define UI_MAKE_LEFT 512
#define UI_MAKE_RIGHT 1024
-
+ /* dont draw hilite on mouse over */
+#define UI_NO_HILITE 2048
/* Button types */
#define CHA 32
diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h
index 431713f6043..924e1a0274b 100644
--- a/source/blender/include/BIF_space.h
+++ b/source/blender/include/BIF_space.h
@@ -55,8 +55,7 @@ struct BWinEvent;
#define VIEW3D_HANDLER_OBJECT 3
/* ipo handler codes */
-#define IPO_HANDLER_SETTINGS 20
-
+#define IPO_HANDLER_PROPERTIES 20
void scrarea_do_windraw (struct ScrArea *sa);
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index c3e7f4f2afb..6de56673515 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -94,6 +94,8 @@ extern void logic_buts(void);
extern void script_panels(void);
extern void do_scriptbuts(unsigned short event);
+/* ipowindow */
+extern void do_ipobuts(unsigned short event); // drawipo.c (bad! ton)
/* butspace.c */
void test_meshpoin_but(char *name, struct ID **idpp);
@@ -191,7 +193,7 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_ANIMBUTS 1500
#define B_RECALCPATH 1401
-#define B_MUL_IPO 1402
+
#define B_AUTOTIMEOFS 1403
#define B_FRAMEMAP 1404
#define B_NEWEFFECT 1405
@@ -201,7 +203,7 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_CALCEFFECT 1409
#define B_DELEFFECT 1410
#define B_RECALCAL 1411
-#define B_SETSPEED 1412
+
#define B_PRINTSPEED 1413
#define B_PRINTLEN 1414
#define B_RELKEY 1415
@@ -502,10 +504,6 @@ enum {
};
/* *********************** */
-#define B_INFOBUTS 3400
-/* defines local in space.c only */
-
-/* *********************** */
/* *********************** */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 5ec7892add8..8947c10b970 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -91,7 +91,7 @@ typedef struct SpaceIpo {
short showkey, blocktype;
short menunr, lock;
int flag;
- int reserved1;
+ float median[3];
rctf tot;
} SpaceIpo;
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index 839d27458b6..c5d87cc951e 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -463,108 +463,4 @@ void drawbutspace(ScrArea *sa, void *spacedata)
sa->win_swap= WIN_BACK_OK;
}
-void clever_numbuts_buts()
-{
-}
-
-#if 0
- bring back in buttons_shading.c!
-
-void clever_numbuts_buts()
-{
- Material *ma;
- Lamp *la;
- World *wo;
- static char hexrgb[8]; /* Uh... */
- static char hexspec[8]; /* Uh... */
- static char hexmir[8]; /* Uh... */
- static char hexho[8];
- static char hexze[8];
- int rgb[3];
-
- switch (G.buts->mainb){
- case BUTS_FPAINT:
-
- sprintf(hexrgb, "%02X%02X%02X", (int)(Gvp.r*255), (int)(Gvp.g*255), (int)(Gvp.b*255));
-
- add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the RGB color");
- do_clever_numbuts("Vertex Paint RGB Hex Value", 1, REDRAW);
-
- /* Assign the new hex value */
- sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- Gvp.r= (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- Gvp.g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- Gvp.b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
-
- break;
- case BUTS_LAMP:
- la= G.buts->lockpoin;
- if (la){
- sprintf(hexrgb, "%02X%02X%02X", (int)(la->r*255), (int)(la->g*255), (int)(la->b*255));
- add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the lamp color");
- do_clever_numbuts("Lamp RGB Hex Values", 1, REDRAW);
- sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- la->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- la->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- la->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
- BIF_preview_changed(G.buts);
- }
- break;
- case BUTS_WORLD:
- wo= G.buts->lockpoin;
- if (wo){
- sprintf(hexho, "%02X%02X%02X", (int)(wo->horr*255), (int)(wo->horg*255), (int)(wo->horb*255));
- sprintf(hexze, "%02X%02X%02X", (int)(wo->zenr*255), (int)(wo->zeng*255), (int)(wo->zenb*255));
- add_numbut(0, TEX, "Zen:", 0, 6, hexze, "HTML Hex value for the Zenith color");
- add_numbut(1, TEX, "Hor:", 0, 6, hexho, "HTML Hex value for the Horizon color");
- do_clever_numbuts("World RGB Hex Values", 2, REDRAW);
-
- sscanf(hexho, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- wo->horr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- wo->horg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- wo->horb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
- sscanf(hexze, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- wo->zenr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- wo->zeng = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- wo->zenb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
- BIF_preview_changed(G.buts);
-
- }
- break;
- case BUTS_MAT:
-
- ma= G.buts->lockpoin;
-
- /* Build a hex value */
- if (ma){
- sprintf(hexrgb, "%02X%02X%02X", (int)(ma->r*255), (int)(ma->g*255), (int)(ma->b*255));
- sprintf(hexspec, "%02X%02X%02X", (int)(ma->specr*255), (int)(ma->specg*255), (int)(ma->specb*255));
- sprintf(hexmir, "%02X%02X%02X", (int)(ma->mirr*255), (int)(ma->mirg*255), (int)(ma->mirb*255));
-
- add_numbut(0, TEX, "Col:", 0, 6, hexrgb, "HTML Hex value for the RGB color");
- add_numbut(1, TEX, "Spec:", 0, 6, hexspec, "HTML Hex value for the Spec color");
- add_numbut(2, TEX, "Mir:", 0, 6, hexmir, "HTML Hex value for the Mir color");
- do_clever_numbuts("Material RGB Hex Values", 3, REDRAW);
-
- /* Assign the new hex value */
- sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- ma->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- ma->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- ma->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
- sscanf(hexspec, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- ma->specr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- ma->specg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- ma->specb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
- sscanf(hexmir, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
- ma->mirr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
- ma->mirg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
- ma->mirb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
-
- BIF_preview_changed(G.buts);
- }
- break;
- }
-}
-
-#endif
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 493bca7e165..630d8a67d4b 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -1157,10 +1157,6 @@ void do_object_panels(unsigned short event)
calc_curvepath(OBACT);
allqueue(REDRAWVIEW3D, 0);
break;
- case B_MUL_IPO:
- scale_editipo();
- allqueue(REDRAWBUTSOBJECT, 0);
- break;
case B_AUTOTIMEOFS:
auto_timeoffs();
break;
@@ -1271,9 +1267,6 @@ void do_object_panels(unsigned short event)
}
allqueue(REDRAWVIEW3D, 0);
break;
- case B_SETSPEED:
- set_speed_editipo(hspeed);
- break;
case B_PRINTSPEED:
ob= OBACT;
if(ob) {
@@ -1501,48 +1494,6 @@ static void object_panel_anim(Object *ob)
uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 23,17,114,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames");
uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,17,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
-#if 0
- /* IPO BUTTONS AS LAST */
- ScrArea *sa;
-
- ok= 0;
- if(G.sipo) {
- /* do these exist? */
- sa= G.curscreen->areabase.first;
- while(sa) {
- if(sa->spacetype==SPACE_IPO && sa->spacedata.first==G.sipo) break;
- sa= sa->next;
- }
- if(sa) {
- if(G.sipo->ipo && G.sipo->ipo->curve.first) ok= 1;
- }
- }
-
- sprintf(str, "%.3f", G.sipo->v2d.tot.xmin);
- uiDefBut(block, LABEL, 0, str, 1020, 140, 100, 19, 0, 0, 0, 0, 0, "");
- sprintf(str, "%.3f", G.sipo->v2d.tot.xmax);
- uiDefBut(block, LABEL, 0, str, 1120, 140, 100, 19, 0, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUM, B_DIFF, "Xmin:", 1020, 120, 100, 19, &G.sipo->tot.xmin, -G.sipo->v2d.max[0], G.sipo->v2d.max[0], 100, 0, "");
- uiDefButF(block, NUM, B_DIFF, "Xmax:", 1120, 120, 100, 19, &G.sipo->tot.xmax, -G.sipo->v2d.max[0], G.sipo->v2d.max[0], 100, 0, "");
-
- sprintf(str, "%.3f", G.sipo->v2d.tot.ymin);
- uiDefBut(block, LABEL, 0, str, 1020, 100, 100, 19, 0, 0, 0, 0, 0, "");
- sprintf(str, "%.3f", G.sipo->v2d.tot.ymax);
- uiDefBut(block, LABEL, 0, str, 1120, 100, 100, 19, 0, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUM, B_DIFF, "Ymin:", 1020, 80, 100, 19, &G.sipo->tot.ymin, -G.sipo->v2d.max[1], G.sipo->v2d.max[1], 100, 0, "");
- uiDefButF(block, NUM, B_DIFF, "Ymax:", 1120, 80, 100, 19, &G.sipo->tot.ymax, -G.sipo->v2d.max[1], G.sipo->v2d.max[1], 100, 0, "");
-
- uiDefBut(block, BUT, B_MUL_IPO, "SET", 1220,79,50,62, 0, 0, 0, 0, 0, "");
-
-
- /* SPEED BUTTON */
- uiDefButF(block, NUM, B_DIFF, "Speed:", 1020,23,164,28, &hspeed, 0.0, 180.0, 1, 0, "");
-
- uiDefBut(block, BUT, B_SETSPEED, "SET", 1185,23,83,29, 0, 0, 0, 0, 0, "");
-
-#endif
}
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 8e304b9fd51..13b3fd54774 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -2480,6 +2480,106 @@ void texture_panels()
}
}
+#if 0
+/* old popup.. too hackish, should be fixed once (ton) */
+void clever_numbuts_buts()
+{
+ Material *ma;
+ Lamp *la;
+ World *wo;
+ static char hexrgb[8]; /* Uh... */
+ static char hexspec[8]; /* Uh... */
+ static char hexmir[8]; /* Uh... */
+ static char hexho[8];
+ static char hexze[8];
+ int rgb[3];
+
+ switch (G.buts->mainb){
+ case BUTS_FPAINT:
+
+ sprintf(hexrgb, "%02X%02X%02X", (int)(Gvp.r*255), (int)(Gvp.g*255), (int)(Gvp.b*255));
+
+ add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the RGB color");
+ do_clever_numbuts("Vertex Paint RGB Hex Value", 1, REDRAW);
+
+ /* Assign the new hex value */
+ sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ Gvp.r= (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ Gvp.g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ Gvp.b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+
+ break;
+ case BUTS_LAMP:
+ la= G.buts->lockpoin;
+ if (la){
+ sprintf(hexrgb, "%02X%02X%02X", (int)(la->r*255), (int)(la->g*255), (int)(la->b*255));
+ add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the lamp color");
+ do_clever_numbuts("Lamp RGB Hex Values", 1, REDRAW);
+ sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ la->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ la->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ la->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ case BUTS_WORLD:
+ wo= G.buts->lockpoin;
+ if (wo){
+ sprintf(hexho, "%02X%02X%02X", (int)(wo->horr*255), (int)(wo->horg*255), (int)(wo->horb*255));
+ sprintf(hexze, "%02X%02X%02X", (int)(wo->zenr*255), (int)(wo->zeng*255), (int)(wo->zenb*255));
+ add_numbut(0, TEX, "Zen:", 0, 6, hexze, "HTML Hex value for the Zenith color");
+ add_numbut(1, TEX, "Hor:", 0, 6, hexho, "HTML Hex value for the Horizon color");
+ do_clever_numbuts("World RGB Hex Values", 2, REDRAW);
+
+ sscanf(hexho, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ wo->horr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ wo->horg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ wo->horb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+ sscanf(hexze, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ wo->zenr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ wo->zeng = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ wo->zenb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+ BIF_preview_changed(G.buts);
+
+ }
+ break;
+ case BUTS_MAT:
+
+ ma= G.buts->lockpoin;
+
+ /* Build a hex value */
+ if (ma){
+ sprintf(hexrgb, "%02X%02X%02X", (int)(ma->r*255), (int)(ma->g*255), (int)(ma->b*255));
+ sprintf(hexspec, "%02X%02X%02X", (int)(ma->specr*255), (int)(ma->specg*255), (int)(ma->specb*255));
+ sprintf(hexmir, "%02X%02X%02X", (int)(ma->mirr*255), (int)(ma->mirg*255), (int)(ma->mirb*255));
+
+ add_numbut(0, TEX, "Col:", 0, 6, hexrgb, "HTML Hex value for the RGB color");
+ add_numbut(1, TEX, "Spec:", 0, 6, hexspec, "HTML Hex value for the Spec color");
+ add_numbut(2, TEX, "Mir:", 0, 6, hexmir, "HTML Hex value for the Mir color");
+ do_clever_numbuts("Material RGB Hex Values", 3, REDRAW);
+
+ /* Assign the new hex value */
+ sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ ma->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ ma->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ ma->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+ sscanf(hexspec, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ ma->specr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ ma->specg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ ma->specb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+ sscanf(hexmir, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]);
+ ma->mirr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ;
+ ma->mirg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ;
+ ma->mirb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ;
+
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ }
+}
+
+#endif
+
void radio_panels()
{
Radio *rad;
@@ -2500,3 +2600,5 @@ void radio_panels()
}
+
+
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index ca7a195ff34..5519fa3ece8 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -48,6 +48,7 @@
#include "BMF_Api.h"
#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
@@ -63,6 +64,7 @@
#include "BKE_curve.h"
#include "BKE_ipo.h"
#include "BKE_global.h"
+#include "BKE_key.h"
#include "BIF_gl.h"
#include "BIF_resources.h"
@@ -80,6 +82,7 @@
#include "mydevice.h"
#include "ipo.h" /* retains old stuff */
#include "blendef.h"
+#include "butspace.h" // shouldnt be...
/* local define... also used in editipo ... */
#define ISPOIN(a, b, c) ( (a->b) && (a->c) )
@@ -772,16 +775,14 @@ static void draw_ipobuts(SpaceIpo *sipo)
sprintf(naam, "ipowin %d", area->win);
block= uiNewBlock(&area->uiblocks, naam, UI_EMBOSSN, UI_HELV, area->win);
-
+
ei= sipo->editipo;
y= area->winy-30+sipo->butofs;
for(a=0; a<sipo->totipo; a++, ei++, y-=IPOBUTY) {
but= uiDefButI(block, TOG|BIT|a, a+1, ei->name, v2d->mask.xmax+18, y, IPOBUTX-15, IPOBUTY-1, &(sipo->rowbut), 0, 0, 0, 0, "");
- /* XXXXX, is this, the sole caller
- * of this function, really necessary?
- */
- uiButSetFlag(but, UI_TEXT_LEFT);
+ // no hilite, its not visible, but most of all the winmatrix is not correct later on...
+ uiButSetFlag(but, UI_TEXT_LEFT|UI_NO_HILITE);
if(ei->icu) {
cpack(ei->col);
@@ -1308,16 +1309,303 @@ static void draw_key(SpaceIpo *sipo, int visible)
setlinestyle(0);
}
+/* ************************** buttons *********************** */
+
+
+#define B_SETSPEED 3401
+#define B_MUL_IPO 3402
+#define B_TRANS_IPO 3403
+#define B_IPO_NONE 3404
+
+static float hspeed= 0;
+
+
+static void boundbox_ipo_visible(SpaceIpo *si)
+{
+ EditIpo *ei;
+ Key *key;
+ KeyBlock *kb;
+ int a, first= 1;
+
+ ei= si->editipo;
+ if(ei==0)
+ return;
+
+ for(a=0; a<si->totipo; a++, ei++) {
+
+ if(ei->icu) {
+ if(ei->flag & IPO_VISIBLE) {
+
+ boundbox_ipocurve(ei->icu);
+ if(first) {
+ si->v2d.tot= ei->icu->totrct;
+ first= 0;
+ }
+ else BLI_union_rctf(&(si->v2d.tot), &(ei->icu->totrct));
+ }
+ }
+ }
+ /* keylines? */
+ if(si->blocktype==ID_KE) {
+ key= (Key *)si->from;
+ if(key && key->block.first) {
+ kb= key->block.first;
+ if(kb->pos < si->v2d.tot.ymin) si->v2d.tot.ymin= kb->pos;
+ kb= key->block.last;
+ if(kb->pos > si->v2d.tot.ymax) si->v2d.tot.ymax= kb->pos;
+ }
+ }
+ si->tot= si->v2d.tot;
+}
+
+
+/* is used for both read and write... */
+static void ipo_editvertex_buts(uiBlock *block, SpaceIpo *si, float min, float max)
+{
+ EditIpo *ei;
+ BezTriple *bezt;
+ float median[3];
+ int a, b, tot, iskey=0;
+
+ median[0]= median[1]= median[2]= 0.0;
+ tot= 0;
+
+ ei= G.sipo->editipo;
+ for(a=0; a<G.sipo->totipo; a++, ei++) {
+
+ if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
+ if( (ei->flag & IPO_EDIT) || G.sipo->showkey) {
+
+ if(ei->icu->bezt) {
+ bezt= ei->icu->bezt;
+ b= ei->icu->totvert;
+ while(b--) {
+ // all three selected
+ if(bezt->f2 & 1) {
+ VecAddf(median, median, bezt->vec[1]);
+ tot++;
+ }
+ else {
+ if(bezt->f1 & 1) {
+ VecAddf(median, median, bezt->vec[0]);
+ tot++;
+ }
+ if(bezt->f3 & 1) {
+ VecAddf(median, median, bezt->vec[2]);
+ tot++;
+ }
+ }
+ bezt++;
+ }
+
+ }
+ }
+ }
+ }
+ /* check for keys */
+ if(tot==0) {
+ if(G.sipo->blocktype==ID_KE) {
+ Key *key= (Key *)G.sipo->from;
+ KeyBlock *kb;
+
+ if(key==0) return;
+ iskey= 1;
+
+ kb= key->block.first;
+ while(kb) {
+ if(kb->flag & SELECT) {
+ median[1]+= kb->pos;
+ tot++;
+ }
+ kb= kb->next;
+ }
+ }
+ }
+ if(tot==0) return;
+
+ median[0] /= (float)tot;
+ median[1] /= (float)tot;
+ median[2] /= (float)tot;
+
+ if(block) { // buttons
+
+ VECCOPY(si->median, median);
+
+ if(tot==1) {
+ if(iskey)
+ uiDefButF(block, NUM, B_TRANS_IPO, "Key Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 10, 0, "");
+ else {
+ uiDefButF(block, NUM, B_TRANS_IPO, "Vertex X:", 10, 100, 300, 19, &(si->median[0]), min, max, 100, 0, "");
+ uiDefButF(block, NUM, B_TRANS_IPO, "Vertex Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 100, 0, "");
+ }
+ }
+ else {
+ if(iskey)
+ uiDefButF(block, NUM, B_TRANS_IPO, "Median Key Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 10, 0, "");
+ else {
+ uiDefButF(block, NUM, B_TRANS_IPO, "Median X:", 10, 100, 300, 19, &(si->median[0]), min, max, 100, 0, "");
+ uiDefButF(block, NUM, B_TRANS_IPO, "Median Y:", 10, 80, 300, 19, &(si->median[1]), min, max, 100, 0, "");
+ }
+ }
+ }
+ else if(iskey) { // apply
+ VecSubf(median, si->median, median);
+
+ if(G.sipo->blocktype==ID_KE) {
+ Key *key= (Key *)G.sipo->from;
+ KeyBlock *kb;
+
+ if(key==0) return;
+
+ kb= key->block.first;
+ while(kb) {
+ if(kb->flag & SELECT) {
+ kb->pos+= median[1];
+ tot++;
+ }
+ kb= kb->next;
+ }
+ sort_keys(key);
+ }
+ }
+ else {
+
+ VecSubf(median, si->median, median);
+
+ ei= G.sipo->editipo;
+ for(a=0; a<G.sipo->totipo; a++, ei++) {
+
+ if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
+ if( (ei->flag & IPO_EDIT) || G.sipo->showkey) {
+
+ if(ei->icu->bezt) {
+ bezt= ei->icu->bezt;
+ b= ei->icu->totvert;
+ while(b--) {
+ // all three selected
+ if(bezt->f2 & 1) {
+ VecAddf(bezt->vec[0], bezt->vec[0], median);
+ VecAddf(bezt->vec[1], bezt->vec[1], median);
+ VecAddf(bezt->vec[2], bezt->vec[2], median);
+ }
+ else {
+ if(bezt->f1 & 1) {
+ VecAddf(bezt->vec[0], bezt->vec[0], median);
+ }
+ if(bezt->f3 & 1) {
+ VecAddf(bezt->vec[2], bezt->vec[2], median);
+ }
+ }
+ bezt++;
+ }
+
+ }
+ }
+ }
+ }
+ }
+}
+
+void do_ipobuts(unsigned short event)
+{
+
+ switch(event) {
+ case B_SETSPEED:
+ set_speed_editipo(hspeed);
+ break;
+ case B_MUL_IPO:
+ scale_editipo();
+ allqueue(REDRAWIPO, 0);
+ break;
+ case B_TRANS_IPO:
+ ipo_editvertex_buts(NULL, G.sipo, 0.0, 0.0);
+ editipo_changed(G.sipo, 1);
+ allqueue(REDRAWIPO, 0);
+ break;
+ }
+}
+
+
+static void ipo_panel_properties(short cntrl) // IPO_HANDLER_PROPERTIES
+{
+ extern int totipo_vis; // editipo.c
+ uiBlock *block;
+ float min, max;
+
+ block= uiNewBlock(&curarea->uiblocks, "ipo_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
+ uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
+ uiSetPanelHandler(IPO_HANDLER_PROPERTIES); // for close and esc
+ if(uiNewPanel(curarea, block, "Transform Properties", "Ipo", 10, 230, 318, 204)==0) return;
+
+
+ boundbox_ipo_visible(G.sipo); // should not be needed... transform/draw calls should update
+
+ /* calculate a nice range for the button */
+ min= MIN2(G.sipo->tot.xmin, G.sipo->tot.ymin)-100.0;
+ min= MIN2(min, -100);
+ max= MAX2(G.sipo->tot.xmax, G.sipo->tot.ymax)+100.0;
+ max= MAX2(max, 100);
+
+ if(G.sipo->ipo && G.sipo->ipo->curve.first && totipo_vis) {
+ extern int totipo_vertsel; // editipo.c
+ uiDefBut(block, LABEL, 0, "Visible curves", 10, 200, 150, 19, NULL, 1.0, 0.0, 0, 0, "");
+
+ uiDefButF(block, NUM, B_MUL_IPO, "Xmin:", 10, 180, 150, 19, &G.sipo->tot.xmin, min, max, 100, 0, "");
+ uiDefButF(block, NUM, B_MUL_IPO, "Xmax:", 160, 180, 150, 19, &G.sipo->tot.xmax, min, max, 100, 0, "");
+
+ uiDefButF(block, NUM, B_MUL_IPO, "Ymin:", 10, 160, 150, 19, &G.sipo->tot.ymin, min, max, 100, 0, "");
+ uiDefButF(block, NUM, B_MUL_IPO, "Ymax:", 160, 160, 150, 19, &G.sipo->tot.ymax, min, max, 100, 0, "");
+
+ /* SPEED BUTTON */
+ if(totipo_vertsel) {
+ uiDefButF(block, NUM, B_IPO_NONE, "Speed:", 10,130,150,19, &hspeed, 0.0, 180.0, 1, 0, "");
+ uiDefBut(block, BUT, B_SETSPEED,"SET", 160,130,50,19, 0, 0, 0, 0, 0, "");
+ }
+
+ ipo_editvertex_buts(block, G.sipo, min, max);
+ }
+ /* this one also does keypositions */
+ if(G.sipo->ipo) ipo_editvertex_buts(block, G.sipo, min, max);
+}
+
+static void ipo_blockhandlers(ScrArea *sa)
+{
+ SpaceIpo *sipo= sa->spacedata.first;
+ short a;
+
+ /* warning; blocks need to be freed each time, handlers dont remove (for ipo moved to drawipospace) */
+
+ for(a=0; a<SPACE_MAXHANDLER; a+=2) {
+ switch(sipo->blockhandler[a]) {
+
+ case IPO_HANDLER_PROPERTIES:
+ ipo_panel_properties(sipo->blockhandler[a+1]);
+ break;
+
+ }
+ /* clear action value for event */
+ sipo->blockhandler[a+1]= 0;
+ }
+ uiDrawBlocksPanels(sa, 0);
+
+}
+
+
void drawipospace(ScrArea *sa, void *spacedata)
{
- SpaceIpo *sipo= curarea->spacedata.first;
+ SpaceIpo *sipo= sa->spacedata.first;
View2D *v2d= &sipo->v2d;
EditIpo *ei;
float col[3];
int ofsx, ofsy, a, disptype;
+ bwin_clear_viewmat(sa->win); /* clear buttons view */
+ glLoadIdentity();
+
+ uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */
+
v2d->hor.xmax+=IPOBUTX;
- calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
+ calc_scrollrcts(G.v2d, sa->winx, sa->winy);
BIF_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
@@ -1329,10 +1617,10 @@ void drawipospace(ScrArea *sa, void *spacedata)
glClear(GL_COLOR_BUFFER_BIT);
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
+ if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
if(v2d->scroll) {
- ofsx= curarea->winrct.xmin; // ivm mywin
- ofsy= curarea->winrct.ymin;
+ ofsx= sa->winrct.xmin; // ivm mywin
+ ofsy= sa->winrct.ymin;
glViewport(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
glScissor(ofsx+v2d->mask.xmin, ofsy+v2d->mask.ymin, ( ofsx+v2d->mask.xmax-1)-(ofsx+v2d->mask.xmin)+1, ( ofsy+v2d->mask.ymax-1)-( ofsy+v2d->mask.ymin)+1);
}
@@ -1384,12 +1672,12 @@ void drawipospace(ScrArea *sa, void *spacedata)
draw_ipovertices(1);
/* restore viewport */
- mywinset(curarea->win);
+ mywinset(sa->win);
- if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
+ if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
- /* ortho at pixel level curarea */
- myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
+ /* ortho at pixel level sa */
+ myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
if(v2d->scroll) {
drawscroll(disptype);
@@ -1404,10 +1692,14 @@ void drawipospace(ScrArea *sa, void *spacedata)
draw_ipogrid();
}
- myortho2(-0.5, curarea->winx-0.5, -0.5, curarea->winy-0.5);
+ myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
draw_area_emboss(sa);
- curarea->win_swap= WIN_BACK_OK;
+ /* it is important to end a view in a transform compatible with buttons */
+ bwin_scalematrix(sa->win, sipo->blockscale, sipo->blockscale, sipo->blockscale);
+ ipo_blockhandlers(sa);
+
+ sa->win_swap= WIN_BACK_OK;
}
void scroll_ipobuts()
@@ -1719,9 +2011,16 @@ EditIpo *select_proj_ipo(rctf *rectf, int event)
glInitNames(); /* whatfor? but otherwise it does not work */
glPushName(-1);
+ /* get rid of buttons view */
+ glPushMatrix();
+ glLoadIdentity();
+
init_pickselcode(); /* drawipo.c */
draw_ipocurves(0);
+ /* restore buttons view */
+ glPopMatrix();
+
G.f -= G_PICKSEL;
hits= glRenderMode(GL_RENDER);
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 84e40c4a8a4..3f98ec4a496 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -673,7 +673,7 @@ void scale_editipo()
facx= (G.sipo->tot.xmax-G.sipo->tot.xmin)/(G.sipo->v2d.tot.xmax-G.sipo->v2d.tot.xmin);
facy= (G.sipo->tot.ymax-G.sipo->tot.ymin)/(G.sipo->v2d.tot.ymax-G.sipo->v2d.tot.ymin);
-
+
ei= G.sipo->editipo;
if(ei==0) return;
for(a=0; a<G.sipo->totipo; a++, ei++) {
@@ -1840,7 +1840,6 @@ EditIpo *get_editipo()
get_status_editipo();
if(totipo_edit>1) {
- error("Too many editipo's");
return 0;
}
if(G.sipo->editipo==0) return 0;
@@ -2102,8 +2101,11 @@ void add_vert_ipo()
if(mval[0]>G.v2d->mask.xmax) return;
ei= get_editipo();
- if(ei==0) return;
-
+ if(ei==0) {
+ error("Too many editipo's");
+ return;
+ }
+
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
if(ei->icu==0) {
@@ -3459,7 +3461,7 @@ void set_speed_editipo(float speed)
didit= 1;
}
else {
- error("Cannot set speed");
+ error("Only works for 3 visible curves with handles");
}
}
}
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 9ca8f58ce94..53e314d5d39 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -1078,7 +1078,8 @@ static int ui_do_but_TOG(uiBlock *block, uiBut *but)
}
ui_set_but_val(but, (double)lvalue);
if(but->type==ICONTOG) ui_check_but(but);
- ui_draw_but(but);
+ // no frontbuffer draw for this one
+ if((but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
}
else {
@@ -1088,7 +1089,8 @@ static int ui_do_but_TOG(uiBlock *block, uiBut *but)
if(but->type==TOGN) push= !push;
ui_set_but_val(but, (double)push);
if(but->type==ICONTOG) ui_check_but(but);
- ui_draw_but(but);
+ // no frontbuffer draw for this one
+ if((but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
}
/* no while loop...this button is used for viewmove */
@@ -2470,7 +2472,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
}
ui_set_ftf_font(block); // sets just a pointer in ftf lib... the button dont have ftf handles
-
+
Mat4CpyMat4(UIwinmat, block->winmat);
uiPanelPush(block); // push matrix; no return without pop!
@@ -2633,7 +2635,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
if(but->flag & UI_MOUSE_OVER) {
if( (but->flag & UI_ACTIVE)==0) {
but->flag |= UI_ACTIVE;
- if(but->type != LABEL /* && but->embossfunc != ui_emboss_N */) ui_draw_but(but);
+ if(but->type != LABEL && (but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
}
}
/* hilite case 2 */
@@ -2642,7 +2644,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
/* we dont clear active flag until mouse move, for Menu buttons to remain showing active item when opened */
if (uevent->event==MOUSEY) {
but->flag &= ~UI_ACTIVE;
- if(but->type != LABEL /* && but->embossfunc != ui_emboss_N */) ui_draw_but(but);
+ if(but->type != LABEL && (but->flag & UI_NO_HILITE)==0) ui_draw_but(but);
}
}
else if(but->type==BLOCK || but->type==MENU) { // automatic opens block button (pulldown)
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 3dd1df83b5b..d24dff25659 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -1500,6 +1500,7 @@ static void changeview2dspace(ScrArea *sa, void *spacedata)
void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
{
+ extern void do_ipobuts(unsigned short event); // drawipo.c
unsigned short event= evt->event;
short val= evt->val;
SpaceIpo *sipo= curarea->spacedata.first;
@@ -1508,15 +1509,19 @@ void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
int cfra, doredraw= 0;
short mval[2];
- if(curarea->win==0) return;
+
+ if(sa->win==0) return;
if(val) {
- if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
+ if( uiDoBlocks(&sa->uiblocks, event)!=UI_NOTHING ) event= 0;
switch(event) {
case UI_BUT_EVENT:
- if(val>0) do_ipowin_buts((short)(val-1));
+ /* note: bad bad code, will be cleaned! is because event queues are all shattered */
+ if(val>0 && val < 32) do_ipowin_buts(val-1);
+ else do_ipobuts(val);
break;
+
case LEFTMOUSE:
if( in_ipo_buttons() ) {
do_ipo_selectbuttons();
@@ -1561,11 +1566,11 @@ void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWNLA, 0);
break;
case PADPLUSKEY:
- view2d_zoom(v2d, 0.1154f, curarea->winx, curarea->winy);
+ view2d_zoom(v2d, 0.1154, sa->winx, sa->winy);
doredraw= 1;
break;
case PADMINUS:
- view2d_zoom(v2d, -0.15f, curarea->winx, curarea->winy);
+ view2d_zoom(v2d, -0.15, sa->winx, sa->winy);
doredraw= 1;
break;
case PAGEUPKEY:
@@ -1630,6 +1635,10 @@ void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
doredraw= 1;
}
break;
+ case NKEY:
+ add_blockhandler(sa, IPO_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ doredraw= 1;
+ break;
case RKEY:
if((G.qual==0))
ipo_record();
@@ -1658,7 +1667,7 @@ void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
}
- if(doredraw) scrarea_queue_winredraw(curarea);
+ if(doredraw) scrarea_queue_winredraw(sa);
}
void initipo(ScrArea *sa)
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index b5153364b8b..4167078c3f9 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -798,8 +798,11 @@ int blenderqread(unsigned short event, short val)
case NKEY:
if(textediting==0 && textspace==0 ) {
- if(G.qual==0 || (G.qual==LR_SHIFTKEY)) {
- if(curarea->spacetype!=SPACE_VIEW3D) { // is new panel, in view3d queue
+ if(G.qual & LR_CTRLKEY);
+ 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 {
clever_numbuts();
return 0;
}
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 9072dd3d053..5363787af2e 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -1451,7 +1451,7 @@ void clever_numbuts(void)
clever_numbuts_imasel();
}
else if(curarea->spacetype==SPACE_BUTS){
- clever_numbuts_buts();
+ // clever_numbuts_buts();
}
else if(curarea->spacetype==SPACE_OOPS) {
clever_numbuts_oops();