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:
authorTon Roosendaal <ton@blender.org>2003-10-10 21:29:01 +0400
committerTon Roosendaal <ton@blender.org>2003-10-10 21:29:01 +0400
commit0d03929b9b2cb05936a62e84fecfff18fca2fa7b (patch)
tree921c8ec7c8e451538b10a00037cf550bfcd5f6d4 /source/blender
parent952cd8260eb20f42c3c23306c89b2eb68f5a112f (diff)
Another huge commit!!!
First, check on the new files, which are listed below. The new butspace.h is a local include, only to be used for the buttons drawn in the buttonswindow. - editbuts, animbuts, gamebuts, displaybuts, paintbuts, work now - i quite completely reorganized it, it's now nicely telling you what context it is in - sorting error in panel align fixed (tabs were flipping) - align works correctly automatic when you click around in Blender - editsca.c renamed to buttons_logic.h - button names are truncated from the right for allmost all buttons (except text buttons and number buttons) - while dragging panels, you cannot move them outside window anymore And of course fixed loads of little bugs I encountered while testing it all. This is a version I really need good test & feedback for. Next step: restoring material/lamp/texture/world
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h3
-rw-r--r--source/blender/blenkernel/intern/displist.c2
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/include/BIF_butspace.h434
-rw-r--r--source/blender/include/BIF_editarmature.h4
-rw-r--r--source/blender/include/BIF_interface.h5
-rw-r--r--source/blender/include/butspace.h482
-rw-r--r--source/blender/makesdna/DNA_screen_types.h2
-rw-r--r--source/blender/makesdna/DNA_space_types.h51
-rw-r--r--source/blender/src/butspace.c199
-rw-r--r--source/blender/src/buttons.txt3423
-rw-r--r--source/blender/src/buttons_editing.c2057
-rw-r--r--source/blender/src/buttons_logic.c (renamed from source/blender/src/editsca.c)25
-rw-r--r--source/blender/src/buttons_object.c903
-rw-r--r--source/blender/src/buttons_scene.c62
-rw-r--r--source/blender/src/buttons_script.c82
-rw-r--r--source/blender/src/buttons_shading.c85
-rw-r--r--source/blender/src/editarmature.c255
-rw-r--r--source/blender/src/editconstraint.c1
-rw-r--r--source/blender/src/editface.c1
-rw-r--r--source/blender/src/editipo.c2
-rw-r--r--source/blender/src/editscreen.c8
-rw-r--r--source/blender/src/ghostwinlay.c6
-rw-r--r--source/blender/src/header_buttonswin.c38
-rw-r--r--source/blender/src/headerbuttons.c1
-rw-r--r--source/blender/src/interface.c490
-rw-r--r--source/blender/src/previewrender.c1
-rw-r--r--source/blender/src/space.c41
29 files changed, 4141 insertions, 4528 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index d0f418ec192..4fae54369c1 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -88,9 +88,8 @@
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1];
-
/* interferes elsewhere */
-/* deze getallen ook invullen in blender.h SpaceFile: struct dna herkent geen defines */
+/* also fill in structs itself, dna cannot handle defines */
#define FILE_MAXDIR 160
#define FILE_MAXFILE 80
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 84b55ca8fb5..36f2c10b518 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -663,7 +663,7 @@ void shadeDispList(Object *ob)
Mesh *me;
Curve *cu;
/* extern Material defmaterial; *//* initrender.c, already in bad lev calls*/
- float *orco, imat[3][3], tmat[4][4], mat[4][4], vec[3], xn, yn, zn;
+ float *orco=NULL, imat[3][3], tmat[4][4], mat[4][4], vec[3], xn, yn, zn;
float *fp, *nor, n1[3];
unsigned int *col1, *col2, *vertcol;
int a, lastmat= -1, need_orco = 0;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 13c3b921dee..859e009cbd4 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1444,7 +1444,7 @@ void solve_constraints (Object *ob, short obtype, void *obdata, float ctime)
bConstraint *con;
float tmat[4][4], focusmat[4][4], lastmat[4][4];
int i, clear=1, tot=0;
- float a;
+ float a=0;
float aquat[4], quat[4];
float aloc[3], loc[3];
float asize[3], size[3];
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ceaee7788b8..5ee56d80052 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -47,6 +47,7 @@
#include <stdio.h> // for printf fopen fwrite fclose sprintf FILE
#include <stdlib.h> // for getenv atoi
#include <fcntl.h> // for open
+#include <string.h> // for strcasecmp strrchr strncmp strstr
#ifndef WIN32
#include <unistd.h> // for read close
@@ -117,6 +118,8 @@
#include "BPY_extern.h" // for BPY_do_pyscript
+#include "BIF_butspace.h" // for do_versions, patching event codes
+
#include "BLO_readfile.h"
#include "readfile.h"
@@ -126,7 +129,6 @@
#include "mydevice.h"
-#include <string.h> // for strcasecmp strrchr strncmp strstr
diff --git a/source/blender/include/BIF_butspace.h b/source/blender/include/BIF_butspace.h
index b2c9aec0f83..9023a88310a 100644
--- a/source/blender/include/BIF_butspace.h
+++ b/source/blender/include/BIF_butspace.h
@@ -32,394 +32,64 @@
#ifndef BIF_BUTSPACE_H
#define BIF_BUTSPACE_H
-/* all internal calls and event codes for buttons space */
+/* all internal/external calls and event codes for buttons space */
+/* should be split in 2 parts... */
+
struct Base;
struct ID;
-extern void render_panels(void);
-extern void do_render_panels(unsigned short event);
-
+/* external, butspace.c */
extern void do_butspace(unsigned short event);
-
extern void redraw_test_buttons(struct Base *new);
-void test_meshpoin_but(char *name, struct ID **idpp);
-void test_obpoin_but(char *name, struct ID **idpp);
-void test_scenepoin_but(char *name, struct ID **idpp);
-void test_matpoin_but(char *name, struct ID **idpp);
-void test_scriptpoin_but(char *name, struct ID **idpp);
-void test_actionpoin_but(char *name, ID **idpp);
-
-
-/* -------------- event defines ------------ */
-
-
-#define B_DIFF 1
-
-/* *********************** */
-#define B_VIEWBUTS 1100
-
-#define B_LOADBGPIC 1001
-#define B_BLENDBGPIC 1002
-#define B_BGPICBROWSE 1003
-#define B_BGPICTEX 1004
-#define B_BGPICCLEAR 1005
-#define B_BGPICTEXCLEAR 1006
-
-/* *********************** */
-#define B_LAMPBUTS 1200
-
-#define B_LAMPREDRAW 1101
-#define B_COLLAMP 1102
-#define B_TEXCLEARLAMP 1103
-#define B_SBUFF 1104
-
-/* *********************** */
-#define B_MATBUTS 1300
-
-#define B_MATCOL 1201
-#define B_SPECCOL 1202
-#define B_MIRCOL 1203
-#define B_ACTCOL 1204
-#define B_MATFROM 1205
-#define B_MATPRV 1206
-#define B_MTEXCOL 1207
-#define B_TEXCLEAR 1208
-#define B_MATPRV_DRAW 1209
-#define B_MTEXPASTE 1210
-#define B_MTEXCOPY 1211
-#define B_MATLAY 1212
-
-/* *********************** */
-#define B_TEXBUTS 1400
-
-#define B_TEXTYPE 1301
-#define B_DEFTEXVAR 1302
-#define B_LOADTEXIMA 1303
-#define B_NAMEIMA 1304
-#define B_TEXCHANNEL 1305
-#define B_TEXREDR_PRV 1306
-#define B_TEXIMABROWSE 1307
-#define B_IMAPTEST 1308
-#define B_RELOADIMA 1309
-#define B_LOADPLUGIN 1310
-#define B_NAMEPLUGIN 1311
-#define B_COLORBAND 1312
-#define B_ADDCOLORBAND 1313
-#define B_DELCOLORBAND 1314
-#define B_CALCCBAND 1315
-#define B_CALCCBAND2 1316
-#define B_DOCOLORBAND 1317
-#define B_REDRAWCBAND 1318
-#define B_BANDCOL 1319
-#define B_LOADTEXIMA1 1320
-#define B_PLUGBUT 1321
-
-/* plugbut reserves 24 buttons at least! */
-
-#define B_ENV_MAKE 1350
-#define B_ENV_FREE 1351
-#define B_ENV_DELETE 1352
-#define B_ENV_SAVE 1353
-#define B_ENV_OB 1354
-
-#define B_PACKIMA 1355
-#define B_TEXSETFRAMES 1356
-
-#define B_ENV_FREE_ALL 1357
-
-/* *********************** */
-#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
-#define B_PREVEFFECT 1406
-#define B_NEXTEFFECT 1407
-#define B_CHANGEEFFECT 1408
-#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
-
- /* this has MAX_EFFECT settings! Next free define is 1450... */
-#define B_SELEFFECT 1430
-
-
-/* *********************** */
-#define B_WORLDBUTS 1600
-
-#define B_TEXCLEARWORLD 1501
-
-/* *********************** */
-#define B_RENDERBUTS 1700
-
-#define B_FS_PIC 1601
-#define B_FS_BACKBUF 1602
-
-#define B_FS_FTYPE 1604
-#define B_DORENDER 1605
-#define B_DOANIM 1606
-#define B_PLAYANIM 1607
-#define B_PR_PAL 1608
-#define B_PR_FULL 1609
-#define B_PR_PRV 1610
-#define B_PR_CDI 1611
-#define B_PR_PAL169 1612
-#define B_PR_D2MAC 1613
-#define B_PR_MPEG 1614
-#define B_REDRAWDISP 1615
-#define B_SETBROWSE 1616
-#define B_CLEARSET 1617
-#define B_PR_PRESET 1618
-#define B_PR_PANO 1619
-#define B_PR_NTSC 1620
-
-#define B_IS_FTYPE 1622
-#define B_IS_BACKBUF 1623
-#define B_PR_PC 1624
-
-#define B_PR_PANO360 1627
-#define B_PR_HALFFIELDS 1628
-#define B_NEWRENDERPIPE 1629
-#define B_R_SCALE 1630
-#define B_G_SCALE 1631
-#define B_B_SCALE 1632
-#define B_USE_R_SCALE 1633
-#define B_USE_G_SCALE 1634
-#define B_USE_B_SCALE 1635
-#define B_EDGECOLSLI 1636
-#define B_GAMMASLI 1637
-
-#define B_FILETYPEMENU 1638
-#define B_SELECTCODEC 1639
-#define B_RTCHANGED 1640
-
-#ifdef __NLA
-/* *********************** */
-enum {
- B_ARMATUREBUTS = 1800,
- B_POSE = 1701
-};
-#endif
-
-/* *********************** */
-#define B_COMMONEDITBUTS 2049
-
-#define B_MATWICH 2003
-#define B_MATNEW 2004
-#define B_MATDEL 2005
-#define B_MATASS 2006
-#define B_MATSEL 2007
-#define B_MATDESEL 2008
-#define B_HIDE 2009
-#define B_REVEAL 2010
-#define B_SELSWAP 2011
-#define B_SETSMOOTH 2012
-#define B_SETSOLID 2013
-#define B_AUTOTEX 2014
-#define B_DOCENTRE 2015
-#define B_DOCENTRENEW 2016
-#define B_DOCENTRECURSOR 2017
-
- /* 32 values! */
-#define B_OBLAY 2018
-
-#define B_MESHBUTS 2100
-
-#define B_FLIPNORM 2050
-#define B_SPIN 2051
-#define B_SPINDUP 2052
-#define B_EXTR 2053
-#define B_SCREW 2054
-#define B_EXTREP 2055
-#define B_SPLIT 2056
-#define B_REMDOUB 2057
-#define B_SUBDIV 2058
-#define B_FRACSUBDIV 2059
-#define B_XSORT 2060
-#define B_HASH 2061
-#define B_DELSTICKY 2062
-#define B_DELVERTCOL 2063
-#define B_MAKE_TFACES 2064
-#define B_TOSPHERE 2065
-#define B_DEL_TFACES 2066
-#define B_NEWVGROUP 2067
-#define B_DELVGROUP 2068
-#define B_ASSIGNVGROUP 2069
-#define B_REMOVEVGROUP 2070
-#define B_SELVGROUP 2071
-#define B_DESELVGROUP 2072
-#define B_DECIM_FACES 2073
-#define B_DECIM_CANCEL 2074
-#define B_DECIM_APPLY 2075
-#define B_AUTOVGROUP 2076
-#define B_SLOWERDRAW 2077
-#define B_FASTERDRAW 2078
-#define B_VERTEXNOISE 2079
-#define B_VERTEXSMOOTH 2080
-#define B_MAKESTICKY 2082
-#define B_MAKEVERTCOL 2083
-
-/* *********************** */
-#define B_CURVEBUTS 2200
-
-#define B_CONVERTPOLY 2101
-#define B_CONVERTBEZ 2102
-#define B_CONVERTBSPL 2103
-#define B_CONVERTCARD 2104
-#define B_CONVERTNURB 2105
-#define B_UNIFU 2106
-#define B_ENDPU 2107
-#define B_BEZU 2108
-#define B_UNIFV 2109
-#define B_ENDPV 2110
-#define B_BEZV 2111
-#define B_SETWEIGHT 2112
-#define B_SETW1 2113
-#define B_SETW2 2114
-#define B_SETW3 2115
-#define B_SETORDER 2116
-#define B_MAKEDISP 2117
-#define B_SUBDIVCURVE 2118
-#define B_SPINNURB 2119
-#define B_CU3D 2120
-#define B_SETRESOLU 2121
-#define B_SETW4 2122
-
-
-/* *********************** */
-#define B_FONTBUTS 2300
-
-#define B_MAKEFONT 2201
-#define B_TOUPPER 2202
-#define B_SETFONT 2203
-#define B_LOADFONT 2204
-#define B_TEXTONCURVE 2205
-#define B_PACKFONT 2206
-
-/* *********************** */
-#define B_IKABUTS 2400
-
-#define B_IKASETREF 2301
-#define B_IKARECALC 2302
-
-/* *********************** */
-#define B_CAMBUTS 2500
-
-/* *********************** */
-#define B_MBALLBUTS 2600
-
-#define B_RECALCMBALL 2501
-
-/* *********************** */
-#define B_LATTBUTS 2700
-
-#define B_RESIZELAT 2601
-#define B_DRAWLAT 2602
-#define B_LATTCHANGED 2603
-
-/* *********************** */
-#define B_GAMEBUTS 2800
-
-/* in editsca.c */
-
-/* *********************** */
-#define B_FPAINTBUTS 2900
-
-#define B_VPCOLSLI 2801
-#define B_VPGAMMA 2802
-
-#define B_COPY_TF_MODE 2804
-#define B_COPY_TF_UV 2805
-#define B_COPY_TF_COL 2806
-#define B_REDR_3D_IMA 2807
-#define B_SET_VCOL 2808
-
-#define B_COPY_TF_TEX 2814
-#define B_TFACE_HALO 2815
-#define B_TFACE_BILLB 2816
-
-#define B_SHOWTEX 2832
-#define B_ASSIGNMESH 2833
-
-
-/* *********************** */
-#define B_RADIOBUTS 3000
-
-#define B_RAD_GO 2901
-#define B_RAD_INIT 2902
-#define B_RAD_LIMITS 2903
-#define B_RAD_FAC 2904
-#define B_RAD_NODELIM 2905
-#define B_RAD_NODEFILT 2906
-#define B_RAD_FACEFILT 2907
-#define B_RAD_ADD 2908
-#define B_RAD_DELETE 2909
-#define B_RAD_COLLECT 2910
-#define B_RAD_SHOOTP 2911
-#define B_RAD_SHOOTE 2912
-#define B_RAD_REPLACE 2913
-#define B_RAD_DRAW 2914
-#define B_RAD_FREE 2915
-#define B_RAD_ADDMESH 2916
-
-/* *********************** */
-#define B_SCRIPTBUTS 3100
-
-#define B_SCRIPT_ADD 3001
-#define B_SCRIPT_DEL 3002
-#define B_SCRIPT_TYPE 3003
-
-/* Scene script buttons */
-#define B_SSCRIPT_ADD 3004
-#define B_SSCRIPT_DEL 3005
-#define B_SSCRIPT_TYPE 3006
-
-/* *********************** */
-#define B_SOUNDBUTS 3200
-enum B_SOUND_BUTTONS {
- B_SOUND_CHANGED = 3101,
- B_SOUND_REDRAW,
- B_SOUND_VOLUME,
- B_SOUND_PANNING,
- B_SOUND_PITCH,
- B_SOUND_LOAD_SAMPLE,
- B_SOUND_MENU_SAMPLE,
- B_SOUND_NAME_SAMPLE,
- B_SOUND_UNLINK_SAMPLE,
- B_SOUND_RELOAD_SAMPLE,
- B_SOUND_UNPACK_SAMPLE,
- B_SOUND_PLAY_SAMPLE,
- B_SOUND_COPY_SOUND,
- B_SOUND_LOOPSTART,
- B_SOUND_LOOPEND,
- B_SOUND_BIDIRECTIONAL,
- B_SOUND_RECALC,
- B_SOUND_RATECHANGED,
- B_SOUND_MIXDOWN
-};
-
-/* *********************** */
-#define B_CONSTRAINTBUTS 3300
-enum {
- B_CONSTRAINT_REDRAW = 3201,
- B_CONSTRAINT_ADD,
- B_CONSTRAINT_DEL,
- B_CONSTRAINT_TEST,
- B_CONSTRAINT_CHANGETYPE,
- B_CONSTRAINT_CHANGENAME,
- B_CONSTRAINT_CHANGETARGET
-};
-
-/* *********************** */
-/* BUTTON BUT: > 4000 */
-/* BUTTON 4001-4032: layers */
+/* buts->mainb old */
+#define BUTS_VIEW 0
+#define BUTS_LAMP 1
+#define BUTS_MAT 2
+#define BUTS_TEX 3
+#define BUTS_ANIM 4
+#define BUTS_WORLD 5
+#define BUTS_RENDER 6
+#define BUTS_EDIT 7
+#define BUTS_GAME 8
+#define BUTS_FPAINT 9
+#define BUTS_RADIO 10
+#define BUTS_SCRIPT 11
+#define BUTS_SOUND 12
+#define BUTS_CONSTRAINT 13
+
+/* warning: the values of these defines are used in sbuts->tabs[7] */
+/* buts->mainb new */
+#define CONTEXT_SCENE 0
+#define CONTEXT_OBJECT 1
+#define CONTEXT_TYPES 2
+#define CONTEXT_SHADING 3
+#define CONTEXT_EDITING 4
+#define CONTEXT_SCRIPT 5
+#define CONTEXT_LOGIC 6
+
+/* buts->tab new */
+#define TAB_SCENE_RENDER 0
+#define TAB_SCENE_WORLD 1
+#define TAB_SCENE_ANIM 2
+#define TAB_SCENE_SOUND 3
+
+#define TAB_SHADING_MAT 0
+#define TAB_SHADING_TEX 1
+#define TAB_SHADING_RAD 2
+#define TAB_SHADING_WORLD 3
+#define TAB_SHADING_LAMP 4
+
+/* buts->scaflag */
+#define BUTS_SENS_SEL 1
+#define BUTS_SENS_ACT 2
+#define BUTS_SENS_LINK 4
+#define BUTS_CONT_SEL 8
+#define BUTS_CONT_ACT 16
+#define BUTS_CONT_LINK 32
+#define BUTS_ACT_SEL 64
+#define BUTS_ACT_ACT 128
+#define BUTS_ACT_LINK 256
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h
index f33349c61e6..c0c8c726906 100644
--- a/source/blender/include/BIF_editarmature.h
+++ b/source/blender/include/BIF_editarmature.h
@@ -83,7 +83,7 @@ void adduplicate_armature(void);
void addvert_armature(void);
void add_primitiveArmature(int type);
void apply_rot_armature (struct Object *ob, float mat[3][3]);
-void armaturebuts(void);
+
void clear_armature(struct Object *ob, char mode);
void clever_numbuts_armature (void);
void clever_numbuts_posearmature (void);
@@ -105,6 +105,8 @@ void remake_editArmature(void);
void selectconnected_armature(void);
void selectconnected_posearmature(void);
void select_bone_by_name (struct bArmature *arm, char *name, int select);
+void unique_editbone_name (char* name);
+
struct Bone *get_first_selected_bone (void);
void auto_align_armature(void);
void create_vgroups_from_armature(Object *ob, Object *par);
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index c8471a5c01f..578ee41020e 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -141,11 +141,14 @@ short pupmenu(char *instr);
short pupmenu_col(char *instr, int maxrow);
extern void uiFreePanels(struct ListBase *lb);
-extern void uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
+extern int uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
extern void uiScalePanelBlock(struct uiBlock *block);
extern int uiIsPanelClosed(struct uiBlock *block);
extern void uiAnimatePanels(struct ScrArea *sa);
extern void uiSetPanel_view2d(struct ScrArea *sa);
+extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align);
+extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
+
#endif /* BIF_INTERFACE_H */
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
new file mode 100644
index 00000000000..8d32878d111
--- /dev/null
+++ b/source/blender/include/butspace.h
@@ -0,0 +1,482 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BUTSPACE_H
+#define BUTSPACE_H
+
+/* all internal calls and event codes for buttons space */
+
+struct Base;
+struct ID;
+
+
+/* buts->scaflag */
+#define BUTS_SENS_SEL 1
+#define BUTS_SENS_ACT 2
+#define BUTS_SENS_LINK 4
+#define BUTS_CONT_SEL 8
+#define BUTS_CONT_ACT 16
+#define BUTS_CONT_LINK 32
+#define BUTS_ACT_SEL 64
+#define BUTS_ACT_ACT 128
+#define BUTS_ACT_LINK 256
+
+/* internal */
+
+/* scene */
+extern void render_panels(void);
+extern void do_render_panels(unsigned short event);
+extern void anim_panels(void);
+extern void sound_panels(void);
+
+/* object */
+extern void object_panels(void);
+extern void do_object_panels(unsigned short event);
+
+/* types */
+extern void types_panels(void);
+
+/* editing */
+extern void editing_panels(void);
+extern void do_common_editbuts(unsigned short event);
+extern void do_meshbuts(unsigned short event);
+extern void do_curvebuts(unsigned short event);
+extern void do_fontbuts(unsigned short event);
+extern void do_mballbuts(unsigned short event);
+extern void do_latticebuts(unsigned short event);
+extern void do_fpaintbuts(unsigned short event);
+
+/* shading */
+
+/* logic */
+extern void do_logic_buts(unsigned short event);
+extern void logic_buts(void);
+
+
+/* butspace.c */
+void test_meshpoin_but(char *name, struct ID **idpp);
+void test_obpoin_but(char *name, struct ID **idpp);
+void test_scenepoin_but(char *name, struct ID **idpp);
+void test_matpoin_but(char *name, struct ID **idpp);
+void test_scriptpoin_but(char *name, struct ID **idpp);
+void test_actionpoin_but(char *name, ID **idpp);
+void test_obcurpoin_but(char *name, ID **idpp);
+
+
+/* -------------- internal event defines ------------ */
+
+
+#define B_DIFF 1
+
+/* *********************** */
+#define B_VIEWBUTS 1100
+
+#define B_LOADBGPIC 1001
+#define B_BLENDBGPIC 1002
+#define B_BGPICBROWSE 1003
+#define B_BGPICTEX 1004
+#define B_BGPICCLEAR 1005
+#define B_BGPICTEXCLEAR 1006
+
+/* *********************** */
+#define B_LAMPBUTS 1200
+
+#define B_LAMPREDRAW 1101
+#define B_COLLAMP 1102
+#define B_TEXCLEARLAMP 1103
+#define B_SBUFF 1104
+
+/* *********************** */
+#define B_MATBUTS 1300
+
+#define B_MATCOL 1201
+#define B_SPECCOL 1202
+#define B_MIRCOL 1203
+#define B_ACTCOL 1204
+#define B_MATFROM 1205
+#define B_MATPRV 1206
+#define B_MTEXCOL 1207
+#define B_TEXCLEAR 1208
+#define B_MATPRV_DRAW 1209
+#define B_MTEXPASTE 1210
+#define B_MTEXCOPY 1211
+#define B_MATLAY 1212
+
+/* *********************** */
+#define B_TEXBUTS 1400
+
+#define B_TEXTYPE 1301
+#define B_DEFTEXVAR 1302
+#define B_LOADTEXIMA 1303
+#define B_NAMEIMA 1304
+#define B_TEXCHANNEL 1305
+#define B_TEXREDR_PRV 1306
+#define B_TEXIMABROWSE 1307
+#define B_IMAPTEST 1308
+#define B_RELOADIMA 1309
+#define B_LOADPLUGIN 1310
+#define B_NAMEPLUGIN 1311
+#define B_COLORBAND 1312
+#define B_ADDCOLORBAND 1313
+#define B_DELCOLORBAND 1314
+#define B_CALCCBAND 1315
+#define B_CALCCBAND2 1316
+#define B_DOCOLORBAND 1317
+#define B_REDRAWCBAND 1318
+#define B_BANDCOL 1319
+#define B_LOADTEXIMA1 1320
+#define B_PLUGBUT 1321
+
+/* plugbut reserves 24 buttons at least! */
+
+#define B_ENV_MAKE 1350
+#define B_ENV_FREE 1351
+#define B_ENV_DELETE 1352
+#define B_ENV_SAVE 1353
+#define B_ENV_OB 1354
+
+#define B_PACKIMA 1355
+#define B_TEXSETFRAMES 1356
+
+#define B_ENV_FREE_ALL 1357
+
+/* *********************** */
+#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
+#define B_PREVEFFECT 1406
+#define B_NEXTEFFECT 1407
+#define B_CHANGEEFFECT 1408
+#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
+
+ /* this has MAX_EFFECT settings! Next free define is 1450... */
+#define B_SELEFFECT 1430
+
+
+/* *********************** */
+#define B_WORLDBUTS 1600
+
+#define B_TEXCLEARWORLD 1501
+
+/* *********************** */
+#define B_RENDERBUTS 1700
+
+#define B_FS_PIC 1601
+#define B_FS_BACKBUF 1602
+
+#define B_FS_FTYPE 1604
+#define B_DORENDER 1605
+#define B_DOANIM 1606
+#define B_PLAYANIM 1607
+#define B_PR_PAL 1608
+#define B_PR_FULL 1609
+#define B_PR_PRV 1610
+#define B_PR_CDI 1611
+#define B_PR_PAL169 1612
+#define B_PR_D2MAC 1613
+#define B_PR_MPEG 1614
+#define B_REDRAWDISP 1615
+#define B_SETBROWSE 1616
+#define B_CLEARSET 1617
+#define B_PR_PRESET 1618
+#define B_PR_PANO 1619
+#define B_PR_NTSC 1620
+
+#define B_IS_FTYPE 1622
+#define B_IS_BACKBUF 1623
+#define B_PR_PC 1624
+
+#define B_PR_PANO360 1627
+#define B_PR_HALFFIELDS 1628
+#define B_NEWRENDERPIPE 1629
+#define B_R_SCALE 1630
+#define B_G_SCALE 1631
+#define B_B_SCALE 1632
+#define B_USE_R_SCALE 1633
+#define B_USE_G_SCALE 1634
+#define B_USE_B_SCALE 1635
+#define B_EDGECOLSLI 1636
+#define B_GAMMASLI 1637
+
+#define B_FILETYPEMENU 1638
+#define B_SELECTCODEC 1639
+#define B_RTCHANGED 1640
+
+#ifdef __NLA
+/* *********************** */
+enum {
+ B_ARMATUREBUTS = 1800,
+ B_POSE = 1701
+};
+#endif
+
+/* *********************** */
+#define B_COMMONEDITBUTS 2049
+
+#define B_MATWICH 2003
+#define B_MATNEW 2004
+#define B_MATDEL 2005
+#define B_MATASS 2006
+#define B_MATSEL 2007
+#define B_MATDESEL 2008
+#define B_HIDE 2009
+#define B_REVEAL 2010
+#define B_SELSWAP 2011
+#define B_SETSMOOTH 2012
+#define B_SETSOLID 2013
+#define B_AUTOTEX 2014
+#define B_DOCENTRE 2015
+#define B_DOCENTRENEW 2016
+#define B_DOCENTRECURSOR 2017
+
+ /* 32 values! */
+#define B_OBLAY 2018
+
+#define B_MESHBUTS 2100
+
+#define B_FLIPNORM 2050
+#define B_SPIN 2051
+#define B_SPINDUP 2052
+#define B_EXTR 2053
+#define B_SCREW 2054
+#define B_EXTREP 2055
+#define B_SPLIT 2056
+#define B_REMDOUB 2057
+#define B_SUBDIV 2058
+#define B_FRACSUBDIV 2059
+#define B_XSORT 2060
+#define B_HASH 2061
+#define B_DELSTICKY 2062
+#define B_DELVERTCOL 2063
+#define B_MAKE_TFACES 2064
+#define B_TOSPHERE 2065
+#define B_DEL_TFACES 2066
+#define B_NEWVGROUP 2067
+#define B_DELVGROUP 2068
+#define B_ASSIGNVGROUP 2069
+#define B_REMOVEVGROUP 2070
+#define B_SELVGROUP 2071
+#define B_DESELVGROUP 2072
+#define B_DECIM_FACES 2073
+#define B_DECIM_CANCEL 2074
+#define B_DECIM_APPLY 2075
+#define B_AUTOVGROUP 2076
+#define B_SLOWERDRAW 2077
+#define B_FASTERDRAW 2078
+#define B_VERTEXNOISE 2079
+#define B_VERTEXSMOOTH 2080
+#define B_MAKESTICKY 2082
+#define B_MAKEVERTCOL 2083
+
+/* *********************** */
+#define B_CURVEBUTS 2200
+
+#define B_CONVERTPOLY 2101
+#define B_CONVERTBEZ 2102
+#define B_CONVERTBSPL 2103
+#define B_CONVERTCARD 2104
+#define B_CONVERTNURB 2105
+#define B_UNIFU 2106
+#define B_ENDPU 2107
+#define B_BEZU 2108
+#define B_UNIFV 2109
+#define B_ENDPV 2110
+#define B_BEZV 2111
+#define B_SETWEIGHT 2112
+#define B_SETW1 2113
+#define B_SETW2 2114
+#define B_SETW3 2115
+#define B_SETORDER 2116
+#define B_MAKEDISP 2117
+#define B_SUBDIVCURVE 2118
+#define B_SPINNURB 2119
+#define B_CU3D 2120
+#define B_SETRESOLU 2121
+#define B_SETW4 2122
+
+
+/* *********************** */
+#define B_FONTBUTS 2300
+
+#define B_MAKEFONT 2201
+#define B_TOUPPER 2202
+#define B_SETFONT 2203
+#define B_LOADFONT 2204
+#define B_TEXTONCURVE 2205
+#define B_PACKFONT 2206
+
+/* *********************** */
+#define B_IKABUTS 2400
+
+#define B_IKASETREF 2301
+#define B_IKARECALC 2302
+
+/* *********************** */
+#define B_CAMBUTS 2500
+
+/* *********************** */
+#define B_MBALLBUTS 2600
+
+#define B_RECALCMBALL 2501
+
+/* *********************** */
+#define B_LATTBUTS 2700
+
+#define B_RESIZELAT 2601
+#define B_DRAWLAT 2602
+#define B_LATTCHANGED 2603
+
+/* *********************** */
+#define B_GAMEBUTS 2800
+
+#define B_ADD_PROP 2701
+#define B_CHANGE_PROP 2702
+
+#define B_ADD_SENS 2703
+#define B_CHANGE_SENS 2704
+#define B_DEL_SENS 2705
+
+#define B_ADD_CONT 2706
+#define B_CHANGE_CONT 2707
+#define B_DEL_CONT 2708
+
+#define B_ADD_ACT 2709
+#define B_CHANGE_ACT 2710
+#define B_DEL_ACT 2711
+
+#define B_SOUNDACT_BROWSE 2712
+
+/* *********************** */
+#define B_FPAINTBUTS 2900
+
+#define B_VPCOLSLI 2801
+#define B_VPGAMMA 2802
+
+#define B_COPY_TF_MODE 2804
+#define B_COPY_TF_UV 2805
+#define B_COPY_TF_COL 2806
+#define B_REDR_3D_IMA 2807
+#define B_SET_VCOL 2808
+
+#define B_COPY_TF_TEX 2814
+#define B_TFACE_HALO 2815
+#define B_TFACE_BILLB 2816
+
+#define B_SHOWTEX 2832
+#define B_ASSIGNMESH 2833
+
+
+/* *********************** */
+#define B_RADIOBUTS 3000
+
+#define B_RAD_GO 2901
+#define B_RAD_INIT 2902
+#define B_RAD_LIMITS 2903
+#define B_RAD_FAC 2904
+#define B_RAD_NODELIM 2905
+#define B_RAD_NODEFILT 2906
+#define B_RAD_FACEFILT 2907
+#define B_RAD_ADD 2908
+#define B_RAD_DELETE 2909
+#define B_RAD_COLLECT 2910
+#define B_RAD_SHOOTP 2911
+#define B_RAD_SHOOTE 2912
+#define B_RAD_REPLACE 2913
+#define B_RAD_DRAW 2914
+#define B_RAD_FREE 2915
+#define B_RAD_ADDMESH 2916
+
+/* *********************** */
+#define B_SCRIPTBUTS 3100
+
+#define B_SCRIPT_ADD 3001
+#define B_SCRIPT_DEL 3002
+#define B_SCRIPT_TYPE 3003
+
+/* Scene script buttons */
+#define B_SSCRIPT_ADD 3004
+#define B_SSCRIPT_DEL 3005
+#define B_SSCRIPT_TYPE 3006
+
+/* *********************** */
+#define B_SOUNDBUTS 3200
+enum B_SOUND_BUTTONS {
+ B_SOUND_CHANGED = 3101,
+ B_SOUND_REDRAW,
+ B_SOUND_VOLUME,
+ B_SOUND_PANNING,
+ B_SOUND_PITCH,
+ B_SOUND_LOAD_SAMPLE,
+ B_SOUND_MENU_SAMPLE,
+ B_SOUND_NAME_SAMPLE,
+ B_SOUND_UNLINK_SAMPLE,
+ B_SOUND_RELOAD_SAMPLE,
+ B_SOUND_UNPACK_SAMPLE,
+ B_SOUND_PLAY_SAMPLE,
+ B_SOUND_COPY_SOUND,
+ B_SOUND_LOOPSTART,
+ B_SOUND_LOOPEND,
+ B_SOUND_BIDIRECTIONAL,
+ B_SOUND_RECALC,
+ B_SOUND_RATECHANGED,
+ B_SOUND_MIXDOWN
+};
+
+/* *********************** */
+#define B_CONSTRAINTBUTS 3300
+enum {
+ B_CONSTRAINT_REDRAW = 3201,
+ B_CONSTRAINT_ADD,
+ B_CONSTRAINT_DEL,
+ B_CONSTRAINT_TEST,
+ B_CONSTRAINT_CHANGETYPE,
+ B_CONSTRAINT_CHANGENAME,
+ B_CONSTRAINT_CHANGETARGET
+};
+
+/* *********************** */
+/* BUTTON BUT: > 4000 */
+/* BUTTON 4001-4032: layers */
+
+
+
+#endif
+
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index c90acd929a0..fbb9be3c653 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -89,7 +89,7 @@ typedef struct Panel { /* the part from uiBlock that needs saved in file */
struct Panel *next, *prev;
char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */
short ofsx, ofsy, sizex, sizey;
- short flag, pad;
+ short flag, active; /* active= used currently by a uiBlock */
int pad2;
struct Panel *paneltab; /* this panel is tabbed in *paneltab */
} Panel;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index e8e274157b8..8674eb3fb4c 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -89,7 +89,8 @@ typedef struct SpaceIpo {
typedef struct SpaceButs {
SpaceLink *next, *prev;
- int spacetype, pad1;
+ int spacetype;
+ short re_align, pad1;
struct ScrArea *area;
short cursens, curact;
@@ -333,53 +334,7 @@ typedef struct SpaceImaSel {
#define V3D_LOCAL 2
*/
-/* buts->mainb old */
-#define BUTS_VIEW 0
-#define BUTS_LAMP 1
-#define BUTS_MAT 2
-#define BUTS_TEX 3
-#define BUTS_ANIM 4
-#define BUTS_WORLD 5
-#define BUTS_RENDER 6
-#define BUTS_EDIT 7
-#define BUTS_GAME 8
-#define BUTS_FPAINT 9
-#define BUTS_RADIO 10
-#define BUTS_SCRIPT 11
-#define BUTS_SOUND 12
-#define BUTS_CONSTRAINT 13
-
-/* warning: the values of these defines are used in sbuts->tabs[7] */
-/* buts->mainb new */
-#define CONTEXT_SCENE 0
-#define CONTEXT_OBJECT 1
-#define CONTEXT_TYPES 2
-#define CONTEXT_SHADING 3
-#define CONTEXT_EDITING 4
-#define CONTEXT_SCRIPT 5
-#define CONTEXT_LOGIC 6
-
-/* buts->tab new */
-#define TAB_SCENE_RENDER 0
-#define TAB_SCENE_WORLD 1
-#define TAB_SCENE_SETTINGS 2
-
-#define TAB_SHADING_MAT 0
-#define TAB_SHADING_TEX 1
-#define TAB_SHADING_RAD 2
-#define TAB_SHADING_WORLD 3
-#define TAB_SHADING_LAMP 4
-
-/* buts->scaflag */
-#define BUTS_SENS_SEL 1
-#define BUTS_SENS_ACT 2
-#define BUTS_SENS_LINK 4
-#define BUTS_CONT_SEL 8
-#define BUTS_CONT_ACT 16
-#define BUTS_CONT_LINK 32
-#define BUTS_ACT_SEL 64
-#define BUTS_ACT_ACT 128
-#define BUTS_ACT_LINK 256
+/* buts defines in BIF_butspace.h */
/* these values need to be hardcoded in blender.h SpaceFile: struct dna does not recognize defines */
#define FILE_MAXDIR 160
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index b2b3cc4e064..730da7bc186 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -44,89 +44,41 @@
#endif
#include "MEM_guardedalloc.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_ika_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_mesh_types.h"
+
#include "DNA_object_types.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_radio_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
-#include "DNA_sound_types.h"
+#include "DNA_view3d_types.h"
#include "DNA_space_types.h"
#include "DNA_texture_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_world_types.h"
-
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_constraint.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_font.h"
+
#include "BKE_global.h"
-#include "BKE_ika.h"
-#include "BKE_image.h"
-#include "BKE_ipo.h"
-#include "BKE_lattice.h"
-#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_packedFile.h"
-#include "BKE_plugin_types.h"
-#include "BKE_sound.h"
-#include "BKE_texture.h"
+#include "BKE_library.h"
#include "BKE_utildefines.h"
-#include "BKE_writeavi.h"
#include "BLI_blenlib.h"
#include "BIF_gl.h"
#include "BIF_graphics.h"
#include "BIF_keyval.h"
-#include "BIF_mainqueue.h"
-#include "BIF_resources.h"
-#include "BIF_screen.h"
-#include "BIF_mywindow.h"
-#include "BIF_space.h"
-#include "BIF_glutil.h"
#include "BIF_interface.h"
-#include "BIF_editsca.h"
-#include "BIF_butspace.h"
-#include "BIF_previewrender.h"
#include "BIF_toolbox.h"
-
+#include "BIF_space.h"
+#include "BIF_screen.h"
+#include "BIF_butspace.h"
#include "BSE_headerbuttons.h"
+#include "BIF_previewrender.h"
+#include "BIF_mywindow.h"
+#include "BIF_glutil.h"
+#include "BIF_resources.h"
#include "mydevice.h"
+#include "butspace.h" // own module
/* Local vars ---------------------------------------------------------- */
short bgpicmode=0, near=1000, far=1000;
-short degr= 90, step= 9, turn= 1, editbutflag= 1;
-float hspeed=0.1f, prspeed=0.0f, prlen=0.0f, doublimit= 0.001f;
-int decim_faces=0;
-
-float editbutvweight=1;
-float extr_offs= 1.0, editbutweight=1.0, editbutsize=0.1, cumapsize= 1.0;
MTex emptytex;
MTex mtexcopybuf;
@@ -281,7 +233,6 @@ void do_butspace(unsigned short event)
buts= curarea->spacedata.first;
if(buts->mainb==CONTEXT_SCENE) allqueue(REDRAWBUTSSCENE, curarea->win);
if(buts->mainb==CONTEXT_OBJECT) allqueue(REDRAWBUTSOBJECT, curarea->win);
- if(buts->mainb==CONTEXT_TYPES) allqueue(REDRAWBUTSTYPES, curarea->win);
if(buts->mainb==CONTEXT_SHADING) allqueue(REDRAWBUTSSHADING, curarea->win);
if(buts->mainb==CONTEXT_EDITING) allqueue(REDRAWBUTSEDIT, curarea->win);
if(buts->mainb==CONTEXT_SCRIPT) allqueue(REDRAWBUTSSCRIPT, curarea->win);
@@ -303,7 +254,7 @@ void do_butspace(unsigned short event)
//do_texbuts(event);
}
else if(event<=B_ANIMBUTS) {
- //do_animbuts(event);
+ do_object_panels(event);
}
else if(event<=B_WORLDBUTS) {
//do_worldbuts(event);
@@ -312,34 +263,31 @@ void do_butspace(unsigned short event)
do_render_panels(event); // buttons_scene.c
}
else if(event<=B_COMMONEDITBUTS) {
- //do_common_editbuts(event);
+ do_common_editbuts(event);
}
else if(event<=B_MESHBUTS) {
- //do_meshbuts(event);
+ do_meshbuts(event);
}
else if(event<=B_CURVEBUTS) {
- //do_curvebuts(event);
+ do_curvebuts(event);
}
else if(event<=B_FONTBUTS) {
- //do_fontbuts(event);
- }
- else if(event<=B_IKABUTS) {
- //do_ikabuts(event);
+ do_fontbuts(event);
}
else if(event<=B_CAMBUTS) {
;
}
else if(event<=B_MBALLBUTS) {
- //do_mballbuts(event);
+ do_mballbuts(event);
}
else if(event<=B_LATTBUTS) {
- //do_latticebuts(event);
+ do_latticebuts(event);
}
else if(event<=B_GAMEBUTS) {
- do_gamebuts(event); // editsca.c
+ do_logic_buts(event); // buttons_logic.c
}
else if(event<=B_FPAINTBUTS) {
- //do_fpaintbuts(event);
+ do_fpaintbuts(event);
}
else if(event<=B_RADIOBUTS) {
//do_radiobuts(event);
@@ -367,13 +315,15 @@ void redraw_test_buttons(Base *new)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
- if(ELEM5(buts->mainb, CONTEXT_OBJECT, CONTEXT_TYPES, CONTEXT_EDITING, CONTEXT_SHADING, CONTEXT_LOGIC)) {
+ if(ELEM4(buts->mainb, CONTEXT_OBJECT, CONTEXT_EDITING, CONTEXT_SHADING, CONTEXT_LOGIC)) {
addqueue(sa->win, REDRAW, 1);
+ buts->re_align= 1;
}
if(buts->mainb==CONTEXT_SHADING) {
- // change type automatically
+ buts->re_align= 1;
+ // change type automatically
if(new) {
if(buts->tab[CONTEXT_SHADING] == TAB_SHADING_WORLD);
else if(buts->tab[CONTEXT_SHADING] == TAB_SHADING_TEX);
@@ -395,68 +345,13 @@ void redraw_test_buttons(Base *new)
}
-
-/* here the calls for building the button main/tabs tree */
-
-
-static void context_scene_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
- if(sbuts->tab[CONTEXT_SCENE] == TAB_SCENE_RENDER)
- render_panels();
-
-}
-
-static void context_object_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
-
-}
-
-static void context_types_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
-
-}
-
-static void context_shading_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
-
-}
-
-static void context_editing_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
-
-}
-
-static void context_logic_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* no tabs */
- gamebuts(); /* (editsca.c) */
-
-}
-
-static void context_script_buttons(ScrArea *sa, SpaceButs *sbuts)
-{
-
- /* select tabs */
-
-}
-
/* callback */
void drawbutspace(ScrArea *sa, void *spacedata)
{
SpaceButs *sbuts= sa->spacedata.first;
View2D *v2d= &sbuts->v2d;
-
+ int align=0;
+
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
glClearColor(0.73, 0.73, 0.73, 0.0);
@@ -468,30 +363,54 @@ void drawbutspace(ScrArea *sa, void *spacedata)
/* select the context to be drawn, per contex/tab the actual context is tested */
switch(sbuts->mainb) {
case CONTEXT_SCENE:
- context_scene_buttons(sa, sbuts);
+ /* select tabs */
+ if(sbuts->tab[CONTEXT_SCENE] == TAB_SCENE_RENDER)
+ render_panels();
+ else if(sbuts->tab[CONTEXT_SCENE] == TAB_SCENE_ANIM)
+ anim_panels();
+ else if(sbuts->tab[CONTEXT_SCENE] == TAB_SCENE_SOUND)
+ sound_panels();
+
break;
case CONTEXT_OBJECT:
- context_object_buttons(sa, sbuts);
+ /* no tabs */
+ object_panels();
break;
- case CONTEXT_TYPES:
- context_types_buttons(sa, sbuts);
+
break;
case CONTEXT_SHADING:
- context_shading_buttons(sa, sbuts);
+
break;
case CONTEXT_EDITING:
- context_editing_buttons(sa, sbuts);
+ /* no tabs */
+ editing_panels();
+
break;
case CONTEXT_SCRIPT:
- context_script_buttons(sa, sbuts);
+
break;
case CONTEXT_LOGIC:
- context_logic_buttons(sa, sbuts);
+ /* no tabs */
+ logic_buts();
break;
}
uiClearButLock();
+
+ /* when align changes, also do this for new panels */
+ /* don't always align, this function is called during AnmatePanels too */
+ if(sbuts->align)
+ if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
+ align= 1;
+
+ uiDrawBlocksPanels(sa, align);
+
+ sbuts->re_align= 0;
+ // also for memory for finding which texture you'd like to see
+ sbuts->mainbo= sbuts->mainb;
+ sbuts->tabo= sbuts->tab[sbuts->mainb];
+
myortho2(-0.5, (float)(sa->winx)-.05, -0.5, (float)(sa->winy)-0.5);
draw_area_emboss(sa);
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
diff --git a/source/blender/src/buttons.txt b/source/blender/src/buttons.txt
index b32ad5ea201..1b209c3515e 100644
--- a/source/blender/src/buttons.txt
+++ b/source/blender/src/buttons.txt
@@ -593,1839 +593,10 @@ static void draw_buttons_edge(int win, float x1)
static int packdummy = 0;
-void test_scriptpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- id= G.main->text.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-#ifdef __NLA
-void test_actionpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- id= G.main->action.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-#endif
-
-void test_obpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if(idpp == (ID **)&(emptytex.object)) {
- error("You must add a Texture first!");
- *idpp= 0;
- return;
- }
-
- id= G.main->object.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-
-void test_obcurpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if(idpp == (ID **)&(emptytex.object)) {
- error("You must add a Texture first!");
- *idpp= 0;
- return;
- }
-
- id= G.main->object.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- if (((Object *)id)->type != OB_CURVE) {
- error ("Bevel object must be a Curve.");
- break;
- }
- *idpp= id;
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-
-void test_meshpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->mesh.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-
-void test_matpoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->mat.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-
-void test_scenepoin_but(char *name, ID **idpp)
-{
- ID *id;
-
- if( *idpp ) (*idpp)->us--;
-
- id= G.main->scene.first;
- while(id) {
- if( strcmp(name, id->name+2)==0 ) {
- *idpp= id;
- id_us_plus(id);
- return;
- }
- id= id->next;
- }
- *idpp= 0;
-}
-
-
-
-/* ************************************* */
-
-static void do_common_editbuts(unsigned short event)
-{
- EditVlak *evl;
- Base *base;
- Object *ob;
- Mesh *me;
- Nurb *nu;
- Curve *cu;
- MFace *mface;
- BezTriple *bezt;
- BPoint *bp;
- unsigned int local;
- int a, bit, index= -1;
-
- switch(event) {
-
- case B_MATWICH:
- if(G.obedit && G.obedit->actcol>0) {
- if(G.obedit->type == OB_MESH) {
- evl= G.edvl.first;
- while(evl) {
- if( vlakselectedAND(evl, 1) ) {
- if(index== -1) index= evl->mat_nr;
- else if(index!=evl->mat_nr) {
- error("Mixed colors");
- return;
- }
- }
- evl= evl->next;
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if( isNurbsel(nu) ) {
- if(index== -1) index= nu->mat_nr;
- else if(index!=nu->mat_nr) {
- error("Mixed colors");
- return;
- }
- }
- nu= nu->next;
- }
- }
- if(index>=0) {
- G.obedit->actcol= index+1;
- scrarea_queue_winredraw(curarea);
- }
- }
- break;
- case B_MATNEW:
- new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
- scrarea_queue_winredraw(curarea);
- allqueue(REDRAWVIEW3D_Z, 0);
- break;
- case B_MATDEL:
- delete_material_index();
- scrarea_queue_winredraw(curarea);
- allqueue(REDRAWVIEW3D_Z, 0);
- break;
- case B_MATASS:
- if(G.obedit && G.obedit->actcol>0) {
- if(G.obedit->type == OB_MESH) {
- evl= G.edvl.first;
- while(evl) {
- if( vlakselectedAND(evl, 1) )
- evl->mat_nr= G.obedit->actcol-1;
- evl= evl->next;
- }
- allqueue(REDRAWVIEW3D_Z, 0);
- makeDispList(G.obedit);
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if( isNurbsel(nu) )
- nu->mat_nr= G.obedit->actcol-1;
- nu= nu->next;
- }
- }
- }
- break;
- case B_MATSEL:
- case B_MATDESEL:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) {
- evl= G.edvl.first;
- while(evl) {
- if(evl->mat_nr== G.obedit->actcol-1) {
- if(event==B_MATSEL) {
- if(evl->v1->h==0) evl->v1->f |= 1;
- if(evl->v2->h==0) evl->v2->f |= 1;
- if(evl->v3->h==0) evl->v3->f |= 1;
- if(evl->v4 && evl->v4->h==0) evl->v4->f |= 1;
- }
- else {
- if(evl->v1->h==0) evl->v1->f &= ~1;
- if(evl->v2->h==0) evl->v2->f &= ~1;
- if(evl->v3->h==0) evl->v3->f &= ~1;
- if(evl->v4 && evl->v4->h==0) evl->v4->f &= ~1;
- }
- }
- evl= evl->next;
- }
- tekenvertices_ext( event==B_MATSEL );
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if(nu->mat_nr==G.obedit->actcol-1) {
- if(nu->bezt) {
- a= nu->pntsu;
- bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
- if(event==B_MATSEL) {
- bezt->f1 |= 1;
- bezt->f2 |= 1;
- bezt->f3 |= 1;
- }
- else {
- bezt->f1 &= ~1;
- bezt->f2 &= ~1;
- bezt->f3 &= ~1;
- }
- }
- bezt++;
- }
- }
- else if(nu->bp) {
- a= nu->pntsu*nu->pntsv;
- bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if(event==B_MATSEL) bp->f1 |= 1;
- else bp->f1 &= ~1;
- }
- bp++;
- }
- }
- }
- nu= nu->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- break;
- case B_HIDE:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) hide_mesh(0);
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
- }
- break;
- case B_REVEAL:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) reveal_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
- }
- else if(G.f & G_FACESELECT) reveal_tface();
-
- break;
- case B_SELSWAP:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) selectswap_mesh();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
- }
- break;
- case B_AUTOTEX:
- ob= OBACT;
- if(ob && G.obedit==0) {
- if(ob->type==OB_MESH) tex_space_mesh(ob->data);
- else if(ob->type==OB_MBALL) ;
- else tex_space_curve(ob->data);
- }
- break;
- case B_DOCENTRE:
- docentre();
- break;
- case B_DOCENTRENEW:
- docentre_new();
- break;
- case B_DOCENTRECURSOR:
- docentre_cursor();
- break;
- case B_SETSMOOTH:
- case B_SETSOLID:
- if(G.obedit) {
- if(G.obedit->type == OB_MESH) {
- evl= G.edvl.first;
- while(evl) {
- if( vlakselectedAND(evl, 1) ) {
- if(event==B_SETSMOOTH) evl->flag |= ME_SMOOTH;
- else evl->flag &= ~ME_SMOOTH;
- }
- evl= evl->next;
- }
-
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- }
- else {
- nu= editNurb.first;
- while(nu) {
- if(isNurbsel(nu)) {
- if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
- else nu->flag &= ~ME_SMOOTH;
- }
- nu= nu->next;
- }
-
- }
- }
- else {
- base= FIRSTBASE;
- while(base) {
- if(TESTBASELIB(base)) {
- if(base->object->type==OB_MESH) {
- me= base->object->data;
- mface= me->mface;
- for(a=0; a<me->totface; a++, mface++) {
- if(event==B_SETSMOOTH) mface->flag |= ME_SMOOTH;
- else mface->flag &= ~ME_SMOOTH;
- }
-
- makeDispList(base->object);
- }
- else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
- cu= base->object->data;
- nu= cu->nurb.first;
- while(nu) {
- if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
- else nu->flag &= ~ME_SMOOTH;
- nu= nu->next;
- }
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
-
- default:
- if(event>=B_OBLAY && event<=B_OBLAY+31) {
- local= BASACT->lay & 0xFF000000;
- BASACT->lay -= local;
- if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) {
- bit= event-B_OBLAY;
- BASACT->lay= 1<<bit;
- scrarea_queue_winredraw(curarea);
- }
- BASACT->lay += local;
- /* optimal redraw */
- if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
- else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
- else allqueue(REDRAWVIEW3D, 0);
-
- OBACT->lay= BASACT->lay;
- }
- }
-
-}
-
-void common_editbuts(void)
-{
- Object *ob;
- ID *id;
- Material *ma;
- uiBlock *block;
- void *poin;
- float min;
- int xco, a, dx, dy;
- char str[32];
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- /* LAYERS */
- xco= 291;
- dx= 32;
- dy= 30;
- for(a=0; a<10; a++) {
- /* the (a+10) evaluates correctly because of
- precedence... brackets aren't a bad idea though */
- uiDefButI(block, TOG|BIT|(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
- uiDefButI(block, TOG|BIT|a, B_OBLAY+a, "",(short)(xco+a*(dx/2)), (short)(180+dy/2), (short)(dx/2), (short)(1+dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
- if(a==4) xco+= 5;
- }
-
- id= ob->data;
- if(id && id->lib) uiSetButLock(1, "Can't edit library data");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, LABEL, 0, "Drawtype", 28,200,100,18, 0, 0, 0, 0, 0, "");
- uiDefButC(block, MENU, REDRAWVIEW3D, "Drawtype%t|Bounds %x1|Wire %x2|Solid %x3|Shaded %x4",
- 28,180,100,18, &ob->dt, 0, 0, 0, 0, "Sets the drawing type of the active object");
- uiDefBut(block, LABEL, 0, "Draw Extra", 28,160,100,18, 0, 0, 0, 0, 0, "");
- uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Bounds", 28, 140, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
- uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder",
- 28, 120, 100, 18, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
- uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Wire", 28, 100, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
- uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Axis", 28, 80, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis");
- uiDefButC(block, TOG|BIT|2, REDRAWVIEW3D, "TexSpace", 28, 60, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space");
- uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "Name", 28, 40, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name");
-
- uiBlockSetCol(block, BUTGREY);
-
- /* material and select swap and hide */
- if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) {
-
- if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
- else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
- else poin= &( ((Curve *)ob->data)->texflag );
- uiDefButI(block, TOG|BIT|0, B_AUTOTEX, "AutoTexSpace", 143,180,130,19, poin, 0, 0, 0, 0, "Adjusts active object's texture space automatically when transforming object");
-
- sprintf(str,"%d Mat:", ob->totcol);
- if(ob->totcol) min= 1.0; else min= 0.0;
- ma= give_current_material(ob, ob->actcol);
-
- if(ma) {
- uiDefButF(block, COL, 0, "", 291,123,24,30, &(ma->r), 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, ma->id.name+2, 318,146, 103, 30, 0, 0, 0, 0, 0, "");
- }
- uiDefButC(block, NUM, B_REDR, str, 318,123,103,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
- uiDefBut(block, BUT,B_MATWICH, "?", 423,123,31,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_MATNEW, "New", 292,101,80,21, 0, 0, 0, 0, 0, "Adds a new Material index");
- uiDefBut(block, BUT,B_MATDEL, "Delete", 374,101,80,21, 0, 0, 0, 0, 0, "Deletes this Material index");
- uiDefBut(block, BUT,B_MATASS, "Assign", 291,47,162,26, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT,B_MATSEL, "Select", 292,76,79,22, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
- uiDefBut(block, BUT,B_MATDESEL, "Deselect", 373,76,79,21, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
-
- if(ob->type!=OB_FONT) {
- uiDefBut(block, BUT,B_HIDE, "Hide", 1091,152,77,18, 0, 0, 0, 0, 0, "Hides selected faces");
- uiDefBut(block, BUT,B_REVEAL, "Reveal", 1171,152,86,18, 0, 0, 0, 0, 0, "Reveals selected faces");
- uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 1091,129,166,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
- }
- uiDefBut(block, BUT,B_SETSMOOTH, "Set Smooth", 291,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
- uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 373,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
-
- }
-
- if ELEM3(ob->type, OB_MESH, OB_SURF, OB_CURVE) {
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_DOCENTRE, "Centre", 961, 115, 100, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
- uiDefBut(block, BUT,B_DOCENTRENEW, "Centre New", 961, 95, 100, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data");
- uiDefBut(block, BUT,B_DOCENTRECURSOR, "Centre Cursor", 961, 75, 100, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location");
- }
-
-
- uiDrawBlock(block);
-
-}
-
-
-
-/* *************************** MESH ******************************** */
-
-#ifdef NAN_DECIMATION
-
-static int decimate_count_tria(Object *ob)
-{
- int tottria;
- MFace *mface;
- Mesh *me;
- int a;
-
- me= ob->data;
-
- /* count number of trias, since decimator doesnt allow quads */
- tottria= 0;
- mface= me->mface;
- for(a=0; a<me->totface; a++, mface++) {
- if(mface->v4) tottria++;
- if(mface->v3) tottria++;
- }
-
- return tottria;
-}
-
-static void decimate_faces(void)
-{
- Object *ob;
- Mesh *me;
- MVert *mvert;
- MFace *mface;
- LOD_Decimation_Info lod;
- float *vb=NULL;
- float *vnb=NULL;
- int *tib=NULL;
- int a, tottria;
-
- /* we assume the active object being decimated */
- ob= OBACT;
- if(ob==NULL || ob->type!=OB_MESH) return;
- me= ob->data;
-
- /* add warning for vertex col and tfaces */
- if(me->tface || me->mcol) {
- if(okee("This will remove UV coordinates and vertexcolors")==0) return;
- if(me->tface) MEM_freeN(me->tface);
- if(me->mcol) MEM_freeN(me->mcol);
- me->tface= NULL;
- me->mcol= NULL;
- }
-
- /* count number of trias, since decimator doesnt allow quads */
- tottria= decimate_count_tria(ob);
-
- if(tottria<3) {
- error("You must have more than 3 input faces selected.");
- return;
- }
- /* allocate and init */
- lod.vertex_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "vertices");
- lod.vertex_normal_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "normals");
- lod.triangle_index_buffer= MEM_mallocN(3*sizeof(int)*tottria, "trias");
- lod.vertex_num= me->totvert;
- lod.face_num= tottria;
-
- /* fill vertex buffer */
- vb= lod.vertex_buffer;
- vnb= lod.vertex_normal_buffer;
- mvert= me->mvert;
- for(a=0; a<me->totvert; a++, mvert++, vb+=3, vnb+=3) {
- VECCOPY(vb, mvert->co);
- VECCOPY(vnb, mvert->no);
- Normalise(vnb);
- }
-
- /* fill index buffer */
- mface= me->mface;
- tib= lod.triangle_index_buffer;
- for(a=0; a<me->totface; a++, mface++) {
- if(mface->v4) {
- tib[0]= mface->v1;
- tib[1]= mface->v3;
- tib[2]= mface->v4;
- tib+= 3;
- }
- if(mface->v3) {
- tib[0]= mface->v1;
- tib[1]= mface->v2;
- tib[2]= mface->v3;
- tib+= 3;
- }
- }
-
- if(LOD_LoadMesh(&lod) ) {
- if( LOD_PreprocessMesh(&lod) ) {
- DispList *dl;
- DispListMesh *dlm;
- MFaceInt *mfaceint;
-
- /* we assume the decim_faces tells how much to reduce */
-
- while(lod.face_num > decim_faces) {
- if( LOD_CollapseEdge(&lod)==0) break;
- }
-
- /* ok, put back the stuff in a displist */
- freedisplist(&(ob->disp));
- dl= MEM_callocN(sizeof(DispList), "disp");
- BLI_addtail(&ob->disp, dl);
- dl->type= DL_MESH;
- dlm=dl->mesh= MEM_callocN(sizeof(DispListMesh), "dispmesh");
- dlm->mvert= MEM_callocN(lod.vertex_num*sizeof(MVert), "mvert");
- dlm->mface= MEM_callocN(lod.face_num*sizeof(MFaceInt), "mface");
- dlm->totvert= lod.vertex_num;
- dlm->totface= lod.face_num;
-
- mvert= dlm->mvert;
- vb= lod.vertex_buffer;
- for(a=0; a<lod.vertex_num; a++, vb+=3, mvert++) {
- VECCOPY(mvert->co, vb);
- }
-
- mfaceint= dlm->mface;
- tib= lod.triangle_index_buffer;
- for(a=0; a<lod.face_num; a++, mfaceint++, tib+=3) {
- mfaceint->v1= tib[0];
- mfaceint->v2= tib[1];
- mfaceint->v3= tib[2];
- }
- }
- else error("No memory");
-
- LOD_FreeDecimationData(&lod);
- }
- else error("No manifold Mesh");
-
- MEM_freeN(lod.vertex_buffer);
- MEM_freeN(lod.vertex_normal_buffer);
- MEM_freeN(lod.triangle_index_buffer);
-
- allqueue(REDRAWVIEW3D, 0);
-}
-
-
-
-static void decimate_cancel(void)
-{
- Object *ob;
-
- ob= OBACT;
- if(ob) {
- freedisplist(&ob->disp);
- makeDispList(ob);
- }
- allqueue(REDRAWVIEW3D, 0);
-}
-
-static void decimate_apply(void)
-{
- Object *ob;
- DispList *dl;
- DispListMesh *dlm;
- Mesh *me;
- MFace *mface;
- MFaceInt *mfaceint;
- int a;
-
- if(G.obedit) return;
-
- ob= OBACT;
- if(ob) {
- dl= ob->disp.first;
- if(dl && dl->mesh) {
- dlm= dl->mesh;
- me= ob->data;
-
- // vertices
- if(me->mvert) MEM_freeN(me->mvert);
- me->mvert= dlm->mvert;
- dlm->mvert= NULL;
- me->totvert= dlm->totvert;
-
- // faces
- if(me->mface) MEM_freeN(me->mface);
- me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface");
- me->totface= dlm->totface;
- mface= me->mface;
- mfaceint= dlm->mface;
- for(a=0; a<me->totface; a++, mface++, mfaceint++) {
- mface->v1= mfaceint->v1;
- mface->v2= mfaceint->v2;
- mface->v3= mfaceint->v3;
- test_index_mface(mface, 3);
- }
-
- freedisplist(&ob->disp);
-
- G.obedit= ob;
- make_editMesh();
- load_editMesh();
- free_editMesh();
- G.obedit= NULL;
- tex_space_mesh(me);
- }
- else error("Not a decimated Mesh");
- }
-}
-
-#endif
-
-void do_meshbuts(unsigned short event)
-{
- Object *ob;
- Mesh *me;
- float fac;
- short randfac;
-
- ob= OBACT;
- if(ob && ob->type==OB_MESH) {
-
- me= get_mesh(ob);
- if(me==0) return;
-
- switch(event) {
-#ifdef __NLA
- case B_AUTOVGROUP:
- if (!get_armature(ob->parent)){
- error ("Mesh must be the child of an armature");
- break;
- }
- /* Verify that there are vertex groups for bones in armature */
- /* Remove selected vertices from all defgroups */
- /* Perform assignment for selected vertices */
-
- allqueue (REDRAWVIEW3D, 1);
- break;
- case B_NEWVGROUP:
- add_defgroup (G.obedit);
- scrarea_queue_winredraw(curarea);
- break;
- case B_DELVGROUP:
- del_defgroup (G.obedit);
- allqueue (REDRAWVIEW3D, 1);
- break;
- case B_ASSIGNVGROUP:
- assign_verts_defgroup ();
- allqueue (REDRAWVIEW3D, 1);
- break;
- case B_REMOVEVGROUP:
- remove_verts_defgroup (0);
- allqueue (REDRAWVIEW3D, 1);
- break;
- case B_SELVGROUP:
- sel_verts_defgroup(1);
- allqueue (REDRAWVIEW3D, 1);
- break;
- case B_DESELVGROUP:
- sel_verts_defgroup(0);
- allqueue (REDRAWVIEW3D, 1);
- break;
-#endif
- case B_DELSTICKY:
-
- if(me->msticky) MEM_freeN(me->msticky);
- me->msticky= 0;
- allqueue(REDRAWBUTSEDIT, 0);
- break;
- case B_MAKESTICKY:
- make_sticky();
- break;
- case B_MAKEVERTCOL:
- make_vertexcol();
- break;
- case B_DELVERTCOL:
- if(me->mcol) MEM_freeN(me->mcol);
- me->mcol= 0;
- G.f &= ~G_VERTEXPAINT;
- freedisplist(&(ob->disp));
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_MAKE_TFACES:
- make_tfaces(me);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_DEL_TFACES:
- if(me->tface) MEM_freeN(me->tface);
- me->tface= 0;
- G.f &= ~G_FACESELECT;
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
-
- case B_FLIPNORM:
- if(G.obedit) {
- flip_editnormals();
- }
- else flipnorm_mesh( get_mesh(ob) );
-
- allqueue(REDRAWVIEW3D, 0);
- break;
-
- case B_DECIM_FACES:
- decimate_faces();
- break;
- case B_DECIM_CANCEL:
- decimate_cancel();
- break;
- case B_DECIM_APPLY:
- decimate_apply();
- break;
-
- case B_SLOWERDRAW:
- slowerdraw();
- break;
- case B_FASTERDRAW:
- fasterdraw();
- break;
- }
- }
-
- if(G.obedit==0 || (G.obedit->type!=OB_MESH)) return;
-
- switch(event) {
- case B_SPIN:
- if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 0);
- break;
- case B_SPINDUP:
- if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 1);
- break;
- case B_EXTR:
- G.f |= G_DISABLE_OK;
- if( select_area(SPACE_VIEW3D)) extrude_mesh();
- G.f -= G_DISABLE_OK;
- break;
- case B_SCREW:
- if( select_area(SPACE_VIEW3D)) screw_mesh(step, turn);
- break;
- case B_EXTREP:
- if( select_area(SPACE_VIEW3D)) extrude_repeat_mesh(step, extr_offs);
- break;
- case B_SPLIT:
- G.f |= G_DISABLE_OK;
- split_mesh();
- G.f -= G_DISABLE_OK;
- break;
- case B_REMDOUB:
- notice("Removed: %d", removedoublesflag(1, doublimit));
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SUBDIV:
- waitcursor(1);
- subdivideflag(1, 0.0, editbutflag & B_BEAUTY);
- countall();
- waitcursor(0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_FRACSUBDIV:
- randfac= 10;
- if(button(&randfac, 1, 100, "Rand fac:")==0) return;
- waitcursor(1);
- fac= -( (float)randfac )/100;
- subdivideflag(1, fac, editbutflag & B_BEAUTY);
- countall();
- waitcursor(0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_XSORT:
- if( select_area(SPACE_VIEW3D)) xsortvert_flag(1);
- break;
- case B_HASH:
- hashvert_flag(1);
- break;
- case B_TOSPHERE:
- vertices_to_sphere();
- break;
- case B_VERTEXNOISE:
- vertexnoise();
- break;
- case B_VERTEXSMOOTH:
- vertexsmooth();
- break;
- }
- /* WATCH IT: previous events only in editmode! */
-}
-
-static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
-{
- unique_vertexgroup_name((bDeformGroup*)datav, OBACT);
-}
-
-void meshbuts(void)
-{
- Object *ob;
- Mesh *me;
- uiBlock *block;
- uiBut *but;
- float val;
- char str[64];
-#ifdef __NLA
- int by;
- float min;
- int defCount;
- bDeformGroup *defGroup;
-#endif
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- me= get_mesh(ob);
-
- if(me) {
- uiDefButS(block, TOG|BIT|1, REDRAWVIEW3D, "No V.Normal Flip", 143,160,130,18, &me->flag, 0, 0, 0, 0, "Disables flipping of vertexnormals during render");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth", 143,140,130,18, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render");
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, B_DIFF, "Degr:", 143, 120, 130, 18, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf", 143,100,130,18, &me->flag, 0, 0, 0, 0, "Treats the active object as a Catmull-Clark Subdivision Surface");
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:", 143, 80, 100, 18, &me->subdiv, 0, 12, 0, 0, "Defines the level of subdivision to display in real time interactively");
- uiDefButS(block, NUM, B_MAKEDISP, "", 243, 80, 30, 18, &me->subdivr, 0, 12, 0, 0, "Defines the level of subdivision to apply during rendering");
- uiDefButS(block, TOG|BIT|2, REDRAWVIEW3D, "Double Sided", 1090,184,164,19, &me->flag, 0, 0, 0, 0, "Toggles selected faces as doublesided or single-sided");
-
- uiBlockSetCol(block, BUTSALMON);
-
- if(me->msticky) val= 1.0; else val= 0.0;
- uiDefBut(block, LABEL, 0, "Sticky", 137,55,70,20, 0, val, 0, 0, 0, "");
- if(me->msticky==0) {
- uiDefBut(block, BUT, B_MAKESTICKY, "Make", 210,58,63,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
- }
- else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 210,58,63,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
-
- if(me->mcol) val= 1.0; else val= 0.0;
- uiDefBut(block, LABEL, 0, "VertCol", 140,33,70,20, 0, val, 0, 0, 0, "");
- if(me->mcol==0) {
- uiDefBut(block, BUT, B_MAKEVERTCOL, "Make", 209,36,64,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
- }
- else uiDefBut(block, BUT, B_DELVERTCOL, "Delete", 209,36,64,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
-
- if(me->tface) val= 1.0; else val= 0.0;
- uiDefBut(block, LABEL, 0, "TexFace", 142,13,70,20, 0, val, 0, 0, 0, "");
- if(me->tface==0) {
- uiDefBut(block, BUT, B_MAKE_TFACES, "Make", 209,14,64,20, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
- }
- else uiDefBut(block, BUT, B_DEL_TFACES, "Delete", 209,14,64,20, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
-
- uiBlockSetCol(block, BUTGREY);
-
- uiDefIDPoinBut(block, test_meshpoin_but, 0, "TexMesh: ", 477,185,249,19, &me->texcomesh, "Enter the name of a Meshblock");
- }
-
-
- /* EDIT */
-
- if(me) {
-#ifdef NAN_DECIMATION
- int tottria= decimate_count_tria(ob);
- DispList *dl;
-
- // wacko, wait for new displist system (ton)
- if( (dl=ob->disp.first) && dl->mesh);
- else decim_faces= tottria;
-
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButI(block, NUMSLI,B_DECIM_FACES, "Decimator: ", 477,155,249,20, &decim_faces, 4.0, tottria, 10, 10, "Defines the number of triangular faces to decimate the active Mesh object to");
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_DECIM_CANCEL, "Cancel", 477,135,124,19, 0, 0, 0, 0, 0, "Restores the Mesh to its original number of faces");
- uiDefBut(block, BUT,B_DECIM_APPLY, "Apply", 602,135,124,19, 0, 0, 0, 0, 0, "Applies the decimation to the active Mesh object");
-#endif
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_EXTR,"Extrude", 477,100,249,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices");
- uiDefBut(block, BUT,B_SPINDUP,"Spin Dupe", 639,75,87,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport");
- uiDefBut(block, BUT,B_SPIN, "Spin", 558,75,78,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport");
- uiDefBut(block, BUT,B_SCREW,"Screw", 477,75,79,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition
- uiDefBut(block, BUT,B_EXTREP, "Extrude Dupe",477,15,128,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, B_DIFF, "Degr:", 477,55,78,19, &degr,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves");
- uiDefButS(block, NUM, B_DIFF, "Steps:", 558,55,78,19, &step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices");
- uiDefButS(block, NUM, B_DIFF, "Turns:", 639,55,86,19, &turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns");
- uiDefButS(block, TOG|BIT|0, B_DIFF, "Clockwise", 639,35,86,19, &editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'");
- uiDefButS(block, TOG|BIT|1, B_DIFF, "Keep Original", 477,35,156,19, &editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools");
- uiDefButF(block, NUM, B_DIFF, "Offset:", 608,15,117,19, &extr_offs, 0.01, 10.0, 100, 0, "Sets the distance between each copy for 'Extrude Dupe'");
- }
-
- by=206;
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|2, 0, "Beauty", 847,by-=20,94,19, &editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters");
- uiBlockSetCol(block, BUTSALMON);
-
- uiDefBut(block, BUT,B_SPLIT,"Split", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Separates selected faces from unselected faces");
- uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape");
- uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters");
- uiDefBut(block, BUT,B_FRACSUBDIV, "Fract Subd",847,by-=19,94,18, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor");
-
- uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate");
- uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Flattens angles of selected faces");
- uiDefBut(block, BUT,B_XSORT,"Xsort", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Sorts selected vertice data in the X direction");
- uiDefBut(block, BUT,B_HASH,"Hash", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Randomizes selected vertice sequence data");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_DIFF, "Limit:", 959,151,100,19, &doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'");
-
- uiBlockSetCol(block, BUTSALMON);
-
- uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 958,173,101,32, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices");
-
- uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 961,55,100,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals");
-
- uiDefBut(block, BUT, B_SLOWERDRAW,"SlowerDraw", 961,35,100,19, 0, 0, 0, 0, 0, "Displays the active object with all possible edges shown");
- uiDefBut(block, BUT, B_FASTERDRAW,"FasterDraw", 961,15,100,19, 0, 0, 0, 0, 0, "Displays the active object faster by omitting some edges when drawing");
-
-#ifdef __NLA
-
- /* Draw Vertex grouping buttons if we're in editmode*/
- if (ob){
- char *s, *menustr;
- bDeformGroup *dg;
- int index;
-
- by = 210;
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, LABEL,0,"Vertex Groups", 740,by-=19,93,18, 0, 0, 0, 0, 0, "");
-
- defCount=BLI_countlist(&ob->defbase);
-
- if (!defCount)
- min=0;
- else
- min=1;
-
-#if 0
- sprintf (str, "%d Group:", defCount);
- uiDefButS(block, NUM, REDRAWBUTSEDIT, str, 740, by-=22,93,18, &ob->actdef, min, defCount, 0, 0, "");
-#else
- s= menustr = MEM_callocN((32 * defCount)+20, "menustr");
-
- for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next){
- int cnt= sprintf (s, "%s%%x%d|", dg->name, index);
-
- if (cnt>0)
- s+= cnt;
- }
-
- by-=22;
- if (defCount)
- uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr, 740, by,18,18, &ob->actdef, min, defCount, 0, 0, "Browses available vertex groups");
- MEM_freeN (menustr);
-#endif
- if (ob->actdef){
- defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- but= uiDefBut(block, TEX,REDRAWBUTSEDIT,"", 758,by,93-18,18, defGroup->name, 0, 32, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
- uiButSetFunc(but, verify_vertexgroup_name_func, defGroup, NULL);
- }
- uiDefButF(block, NUM, REDRAWVIEW3D, "Weight:", 740, by-=22, 93, 18, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
-
- }
-
- if (G.obedit && G.obedit==ob){
-
- uiBlockSetCol(block, BUTSALMON);
-/* uiDefBut(block, BUT,B_AUTOVGROUP,"Auto Weight", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Automatically assigns deformation groups"); */
- uiDefBut(block, BUT,B_NEWVGROUP,"New", 740,by-=22,45,18, 0, 0, 0, 0, 0, "Creates a new vertex group");
- uiDefBut(block, BUT,B_DELVGROUP,"Delete", 788,by,45,18, 0, 0, 0, 0, 0, "Removes the current vertex group");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_ASSIGNVGROUP,"Assign", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Assigns selected vertices to the current vertex group");
- uiDefBut(block, BUT,B_REMOVEVGROUP,"Remove", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Removes selected vertices from the current vertex group");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT,B_SELVGROUP,"Select", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Selects vertices belonging to the current vertex group");
- uiDefBut(block, BUT,B_DESELVGROUP,"Deselect", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Deselects vertices belonging to the current vertex group");
-
-}
-#endif
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 1090, 90, 164, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
- uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals", 1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
- uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
- uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
- uiDefButI(block, TOG|BIT|11, 0, "All edges", 1090,10,164,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
-
- uiDrawBlock(block);
-}
// Bish made it to here. (reviewing tooltips)
-/* *************************** FONT ******************************** */
-
-short give_vfontnr(VFont *vfont)
-{
- VFont *vf;
- short nr= 1;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(vf==vfont) return nr;
- nr++;
- vf= vf->id.next;
- }
- return -1;
-}
-
-VFont *give_vfontpointer(int nr) /* nr= button */
-{
- VFont *vf;
- short tel= 1;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(tel==nr) return vf;
- tel++;
- vf= vf->id.next;
- }
- return G.main->vfont.first;
-}
-
-VFont *exist_vfont(char *str)
-{
- VFont *vf;
-
- vf= G.main->vfont.first;
- while(vf) {
- if(strcmp(vf->name, str)==0) return vf;
- vf= vf->id.next;
- }
- return 0;
-}
-
-static char *give_vfontbutstr(void)
-{
- VFont *vf;
- int len= 0;
- char *str, di[FILE_MAXDIR], fi[FILE_MAXFILE];
-
- vf= G.main->vfont.first;
- while(vf) {
- strcpy(di, vf->name);
- BLI_splitdirstring(di, fi);
- len+= strlen(fi)+4;
- vf= vf->id.next;
- }
-
- str= MEM_callocN(len+21, "vfontbutstr");
- strcpy(str, "FONTS %t");
- vf= G.main->vfont.first;
- while(vf) {
-
- if(vf->id.us==0) strcat(str, "|0 ");
- else strcat(str, "| ");
-
- strcpy(di, vf->name);
- BLI_splitdirstring(di, fi);
-
- strcat(str, fi);
- vf= vf->id.next;
- }
- return str;
-}
-
-void load_buts_vfont(char *name)
-{
- VFont *vf;
- Curve *cu;
-
- if(OBACT && OBACT->type==OB_FONT) cu= OBACT->data;
- else return;
-
- vf= exist_vfont(name);
- if(vf==0) {
- vf= load_vfont(name);
- if(vf==0) return;
- }
- else id_us_plus((ID *)vf);
-
- if(cu->vfont) cu->vfont->id.us--;
- cu->vfont= vf;
-
- text_to_curve(OBACT, 0);
- makeDispList(OBACT);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
-void do_fontbuts(unsigned short event)
-{
- Curve *cu;
- VFont *vf;
- Object *ob;
- ScrArea *sa;
- char str[80];
-
- ob= OBACT;
-
- switch(event) {
- case B_MAKEFONT:
- text_to_curve(ob, 0);
- makeDispList(ob);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_TOUPPER:
- to_upper();
- break;
- case B_LOADFONT:
- vf= give_vfontpointer(G.buts->texnr);
- if(vf && vf->id.prev!=vf->id.next) strcpy(str, vf->name);
- else strcpy(str, U.fontdir);
-
- sa= closest_bigger_area();
- areawinset(sa->win);
-
- activate_fileselect(FILE_SPECIAL, "SELECT FONT", str, load_buts_vfont);
-
- break;
- case B_PACKFONT:
- if (ob) {
- cu= ob->data;
- if(cu && cu->vfont) {
- if (cu->vfont->packedfile) {
- if (G.fileflags & G_AUTOPACK) {
- if (okee("Disable AutoPack ?")) {
- G.fileflags &= ~G_AUTOPACK;
- }
- }
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- if (unpackVFont(cu->vfont, PF_ASK) == RET_OK) {
- text_to_curve(ob, 0);
- makeDispList(ob);
- allqueue(REDRAWVIEW3D, 0);
- }
- }
- } else {
- cu->vfont->packedfile = newPackedFile(cu->vfont->name);
- }
- }
- }
- allqueue(REDRAWHEADERS, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- break;
-
- case B_SETFONT:
- if(ob) {
- cu= ob->data;
-
- vf= give_vfontpointer(G.buts->texnr);
- if(vf) {
- id_us_plus((ID *)vf);
- cu->vfont->id.us--;
- cu->vfont= vf;
- text_to_curve(ob, 0);
- makeDispList(ob);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
- }
- break;
- case B_TEXTONCURVE:
- if(ob) {
- cu= ob->data;
- if(cu->textoncurve && cu->textoncurve->type!=OB_CURVE) {
- error("Only Curve Objects");
- cu->textoncurve= 0;
- allqueue(REDRAWBUTSEDIT, 0);
- }
- text_to_curve(ob, 0);
- makeDispList(ob);
- }
- }
-}
-
-
-
-void fontbuts(void)
-{
- Curve *cu;
- uiBlock *block;
- char *strp, str[64];
-
- if(OBACT==0) return;
-
- sprintf(str, "editbuttonswin1 %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- cu= OBACT->data;
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW,B_MAKEFONT, "Left", 484,139,53,18, &cu->spacemode, 0.0,0.0, 0, 0, "");
- uiDefButS(block, ROW,B_MAKEFONT, "Middle", 604,139,61,18, &cu->spacemode, 0.0,1.0, 0, 0, "");
- uiDefButS(block, ROW,B_MAKEFONT, "Right", 540,139,62,18, &cu->spacemode, 0.0,2.0, 0, 0, "");
- uiDefButS(block, ROW,B_MAKEFONT, "Flush", 665,139,61,18, &cu->spacemode, 0.0,3.0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
-
- uiDefIDPoinBut(block, test_obpoin_but, B_TEXTONCURVE, "TextOnCurve:", 484,115,243,19, &cu->textoncurve, "");
-
- uiDefButF(block, NUM,B_MAKEFONT, "Size:", 482,56,121,19, &cu->fsize, 0.1,10.0, 10, 0, "");
- uiDefButF(block, NUM,B_MAKEFONT, "Linedist:", 605,56,121,19, &cu->linedist, 0.0,10.0, 10, 0, "");
- uiDefButF(block, NUM,B_MAKEFONT, "Spacing:", 482,34,121,19, &cu->spacing, 0.0,10.0, 10, 0, "");
- uiDefButF(block, NUM,B_MAKEFONT, "Y offset:", 605,34,121,19, &cu->yof, -50.0,50.0, 10, 0, "");
- uiDefButF(block, NUM,B_MAKEFONT, "Shear:", 482,12,121,19, &cu->shear, -1.0,1.0, 10, 0, "");
- uiDefButF(block, NUM,B_MAKEFONT, "X offset:", 605,12,121,19, &cu->xof, -50.0,50.0, 10, 0, "");
-
- uiDefBut(block, TEX,REDRAWVIEW3D, "Ob Family:", 752,192,164,19, cu->family, 0.0, 20.0, 0, 0, "");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_TOUPPER, "ToUpper", 623,163,103,23, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
-
- G.buts->texnr= give_vfontnr(cu->vfont);
-
- strp= give_vfontbutstr();
-
- uiDefButS(block, MENU, B_SETFONT, strp, 484,191,220,20, &G.buts->texnr, 0, 0, 0, 0, "");
-
- if (cu->vfont->packedfile) {
- packdummy = 1;
- } else {
- packdummy = 0;
- }
-
- uiBlockSetCol(block, BUTYELLOW);
- uiDefIconButI(block, TOG|BIT|0, B_PACKFONT, ICON_PACKAGE, 706,191,20,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Vectorfont");
-
- MEM_freeN(strp);
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_LOADFONT, "Load Font", 484,163,103,23, 0, 0, 0, 0, 0, "");
-
- uiDrawBlock(block);
-}
-
-/* *************************** CURVE ******************************** */
-
-
-void do_curvebuts(unsigned short event)
-{
- extern Nurb *lastnu;
- Object *ob;
- Curve *cu;
- Nurb *nu;
-
- ob= OBACT;
- if(ob==0) return;
-
- switch(event) {
-
- case B_CONVERTPOLY:
- case B_CONVERTBEZ:
- case B_CONVERTBSPL:
- case B_CONVERTCARD:
- case B_CONVERTNURB:
- if(G.obedit) {
- setsplinetype(event-B_CONVERTPOLY);
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_UNIFU:
- case B_ENDPU:
- case B_BEZU:
- case B_UNIFV:
- case B_ENDPV:
- case B_BEZV:
- if(G.obedit) {
- nu= editNurb.first;
- while(nu) {
- if(isNurbsel(nu)) {
- if((nu->type & 7)==CU_NURBS) {
- if(event<B_UNIFV) {
- nu->flagu &= 1;
- nu->flagu += ((event-B_UNIFU)<<1);
- makeknots(nu, 1, nu->flagu>>1);
- }
- else if(nu->pntsv>1) {
- nu->flagv &= 1;
- nu->flagv += ((event-B_UNIFV)<<1);
- makeknots(nu, 2, nu->flagv>>1);
- }
- }
- }
- nu= nu->next;
- }
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETWEIGHT:
- if(G.obedit) {
- weightflagNurb(1, editbutweight, 0);
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_SETW1:
- editbutweight= 1.0;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW2:
- editbutweight= sqrt(2.0)/4.0;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW3:
- editbutweight= 0.25;
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETW4:
- editbutweight= sqrt(0.5);
- scrarea_queue_winredraw(curarea);
- break;
- case B_SETORDER:
- if(G.obedit) {
- nu= lastnu;
- if(nu && (nu->type & 7)==CU_NURBS ) {
- if(nu->orderu>nu->pntsu) {
- nu->orderu= nu->pntsu;
- scrarea_queue_winredraw(curarea);
- }
- makeknots(nu, 1, nu->flagu>>1);
- if(nu->orderv>nu->pntsv) {
- nu->orderv= nu->pntsv;
- scrarea_queue_winredraw(curarea);
- }
- makeknots(nu, 2, nu->flagv>>1);
- }
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- }
- break;
- case B_MAKEDISP:
- if(ob->type==OB_FONT) text_to_curve(ob, 0);
- makeDispList(ob);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
- break;
-
- case B_SUBDIVCURVE:
- subdivideNurb();
- break;
- case B_SPINNURB:
- /* bad bad bad!!! use brackets!!! In case you wondered:
- {==,!=} goes before & goes before || */
- if( (G.obedit==0) ||
- (G.obedit->type!=OB_SURF) ||
- ((G.obedit->lay & G.vd->lay) == 0) ) return;
- spinNurb(0, 0);
- countall();
- makeDispList(G.obedit);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_CU3D: /* allow 3D curve */
- if(G.obedit) {
- cu= G.obedit->data;
- nu= editNurb.first;
- while(nu) {
- nu->type &= ~CU_2D;
- if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
- test2DNurb(nu);
- nu= nu->next;
- }
- }
- if(ob->type==OB_CURVE) {
- cu= ob->data;
- nu= cu->nurb.first;
- while(nu) {
- nu->type &= ~CU_2D;
- if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
- test2DNurb(nu);
- nu= nu->next;
- }
- }
- break;
- case B_SETRESOLU:
- if(ob->type==OB_CURVE) {
- cu= ob->data;
- if(ob==G.obedit) nu= editNurb.first;
- else nu= cu->nurb.first;
-
- while(nu) {
- nu->resolu= cu->resolu;
- nu= nu->next;
- }
- }
- else if(ob->type==OB_FONT) text_to_curve(ob, 0);
-
- makeDispList(ob);
- allqueue(REDRAWVIEW3D, 0);
-
- break;
- }
-}
-
-void curvebuts(void)
-{
- Object *ob;
- Curve *cu;
- Nurb *nu;
- extern Nurb *lastnu;
- uiBlock *block;
- short *sp;
- char str[64];
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- cu= ob->data;
-
- if(ob->type==OB_CURVE || ob->type==OB_SURF) {
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, LABEL, 0, "Convert", 463,173,72, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 467,152,72, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 467,132,72, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_CONVERTBSPL,"Bspline", 467,112,72, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_CONVERTCARD,"Cardinal", 467,92,72, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 467,72,72, 18, 0, 0, 0, 0, 0, "");
-
- uiDefBut(block, LABEL, 0, "Make Knots",562,173,102, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_UNIFU,"Uniform U", 565,152,102, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_ENDPU,"Endpoint U", 565,132,102, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_BEZU,"Bezier U", 565,112,102, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_UNIFV,"V", 670,152,50, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_ENDPV,"V", 670,132,50, 18, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_BEZV,"V", 670,112,50, 18, 0, 0, 0, 0, 0, "");
-
- uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 465,11,95,49, 0, 0, 0, 0, 0, "");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM,0,"Weight:", 564,36,102,22, &editbutweight, 0.01, 10.0, 10, 0, "");
- uiDefBut(block, BUT,B_SETW1,"1.0", 669,36,50,22, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4", 564,11,57,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW3,"0.25", 621,11,43,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SETW4,"sqrt(0.5)", 664,11,57,20, 0, 0, 0, 0, 0, "");
-
- if(ob==G.obedit) {
- nu= lastnu;
- if(nu==NULL) nu= editNurb.first;
- if(nu) {
- sp= &(nu->orderu);
- uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,91,102, 18, sp, 2.0, 6.0, 0, 0, "");
- sp= &(nu->orderv);
- uiDefButS(block, NUM, B_SETORDER, "V:", 670,91,50, 18, sp, 2.0, 6.0, 0, 0, "");
- sp= &(nu->resolu);
- uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 18, sp, 1.0, 128.0, 0, 0, "");
- sp= &(nu->resolv);
- uiDefButS(block, NUM, B_MAKEDISP, "V:", 670,70,50, 18, sp, 1.0, 128.0, 0, 0, "");
- }
- }
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 1092,105,165,20, 0, 0, 0, 0, 0, "");
- }
-
- if(ob->type==OB_SURF) {
- uiDefBut(block, BUT, B_SPINNURB, "Spin", 808,92,101,36, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, TOG|BIT|5, 0, "UV Orco", 143,160,130,18, &cu->flag, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip", 143,140,130,18, &cu->flag, 0, 0, 0, 0, "");
- }
- else {
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, TOG|BIT|5, 0, "UV Orco", 143,160,130,18, &cu->flag, 0, 0, 0, 0, "");
-
- uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 752,163,132,21, &cu->resolu, 1.0, 128.0, 0, 0, "");
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_SETRESOLU, "Set", 887,163,29,21, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, B_MAKEDISP, "BevResol:", 753,30,163,18, &cu->bevresol, 0.0, 10.0, 0, 0, "");
-
- uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:", 753,10,163,18, &cu->bevobj, "");
- uiDefButF(block, NUM, B_MAKEDISP, "Width:", 753,90,163,18, &cu->width, 0.0, 2.0, 1, 0, "");
- uiDefButF(block, NUM, B_MAKEDISP, "Ext1:", 753,70,163,18, &cu->ext1, 0.0, 5.0, 10, 0, "");
- uiDefButF(block, NUM, B_MAKEDISP, "Ext2:", 753,50,163,18, &cu->ext2, 0.0, 2.0, 1, 0, "");
- uiBlockSetCol(block, BUTBLUE);
- if(ob->type==OB_FONT) {
- uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front", 833,130,79,18, &cu->flag, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 753,130,76,18, &cu->flag, 0, 0, 0, 0, "");
- }
- else {
- uiDefButS(block, TOG|BIT|0, B_CU3D, "3D", 867,130,47,18, &cu->flag, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front", 810,130,55,18, &cu->flag, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 753,130,53,18, &cu->flag, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, BUTGREY);
- }
-
- uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 1090, 80, 164, 19, &editbutsize, 0.001, 1.0, 10, 0, "");
-
- uiDrawBlock(block);
-}
-
-
-/* *************************** CAMERA ******************************** */
-
-
-void camerabuts(void)
-{
- Camera *cam;
- Object *ob;
- uiBlock *block;
- float grid=0.0;
- char str[64];
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- cam= ob->data;
- uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
- uiDefButF(block, NUM,REDRAWVIEW3D, "ClipSta:", 470,147,160,20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view");
- uiDefButF(block, NUM,REDRAWVIEW3D, "ClipEnd:", 470,125,160,20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view");
- uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,49,61,40, &cam->type, 0, 0, 0, 0, "Render orthogonally");
-
- uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,69,97,20, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
- uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist", 533,49,97,20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
-
- if(G.special1 & G_HOLO) {
- uiBlockSetCol(block, BUTGREY);
- if(cam->netend==0.0) cam->netend= EFRA;
- uiDefButF(block, NUM, REDRAWVIEW3D, "Anim len", 670,80,100,20, &cam->netend, 1.0, 2500.0, 0, 0, "");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Path len:", 670,160,100,20, &cam->hololen, 0.1, 25.0, 10, 0, "");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Shear fac:", 670,140,100,20, &cam->hololen1, 0.1, 5.0, 10, 0, "");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Holo 1", 670,120,100,20, &cam->flag, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Holo 2", 670,100,100,20, &cam->flag, 0.0, 0.0, 0, 0, "");
-
- }
- uiDrawBlock(block);
-}
-
-/* *************************** FACE/PAINT *************************** */
-
-void do_fpaintbuts(unsigned short event)
-{
- Mesh *me;
- Object *ob;
- extern TFace *lasttface; /* caches info on tface bookkeeping ?*/
-
- ob= OBACT;
- if(ob==0) return;
-
- switch(event) {
-
- case B_VPGAMMA:
- vpaint_dogamma();
- break;
- case B_COPY_TF_MODE:
- case B_COPY_TF_UV:
- case B_COPY_TF_COL:
- case B_COPY_TF_TEX:
- me= get_mesh(ob);
- if(me && me->tface) {
-/* extern TFace *lasttface; */
- TFace *tface= me->tface;
- int a= me->totface;
-
- set_lasttface();
- if(lasttface) {
-
- while(a--) {
- if(tface!=lasttface && (tface->flag & TF_SELECT)) {
- if(event==B_COPY_TF_MODE) {
- tface->mode= lasttface->mode;
- tface->transp= lasttface->transp;
- }
- else if(event==B_COPY_TF_UV) {
- memcpy(tface->uv, lasttface->uv, sizeof(tface->uv));
- tface->tpage= lasttface->tpage;
- tface->tile= lasttface->tile;
-
- if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES;
- else tface->mode &= ~TF_TILES;
-
- }
- else if(event==B_COPY_TF_TEX) {
- tface->tpage= lasttface->tpage;
- tface->tile= lasttface->tile;
-
- if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES;
- else tface->mode &= ~TF_TILES;
- }
- else if(event==B_COPY_TF_COL) memcpy(tface->col, lasttface->col, sizeof(tface->col));
- }
- tface++;
- }
- }
- do_shared_vertexcol(me);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
- break;
- case B_SET_VCOL:
- clear_vpaint_selectedfaces();
- break;
- case B_REDR_3D_IMA:
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- break;
- case B_ASSIGNMESH:
-
- test_object_materials(ob->data);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSGAME, 0);
- break;
-
- case B_TFACE_HALO:
- set_lasttface();
- if(lasttface) {
- lasttface->mode &= ~TF_BILLBOARD2;
- allqueue(REDRAWBUTSGAME, 0);
- }
- break;
-
- case B_TFACE_BILLB:
- set_lasttface();
- if(lasttface) {
- lasttface->mode &= ~TF_BILLBOARD;
- allqueue(REDRAWBUTSGAME, 0);
- }
- break;
- }
-}
-
-void fpaintbuts(void)
-{
-/* extern VPaint Gvp; already in the top of the file */
- Object *ob;
- uiBlock *block;
- char str[32];
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- /* VPAINT BUTTONS */
- uiBlockSetCol(block, BUTGREY);
-
- if (G.f & G_VERTEXPAINT) {
- uiDefBut(block, LABEL, 0, "Vertex Paint", 1037,180,194,18, 0, 0, 0, 0, 0, "");
- } else if (G.f & G_TEXTUREPAINT) {
- uiDefBut(block, LABEL, 0, "Texture Paint", 1037,180,194,18, 0, 0, 0, 0, 0, "");
- }
-
- uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
- uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
- uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
- uiDefButF(block, NUMSLI, 0, "Opacity ", 979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
- uiDefButF(block, NUMSLI, 0, "Size ", 979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
-
- uiDefButF(block, COL, B_VPCOLSLI, "", 1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, "");
-
- uiDefButS(block, ROW, B_DIFF, "Mix", 1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
- uiDefButS(block, ROW, B_DIFF, "Add", 1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
- uiDefButS(block, ROW, B_DIFF, "Sub", 1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
- uiDefButS(block, ROW, B_DIFF, "Mul", 1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
- uiDefButS(block, ROW, B_DIFF, "Filter", 1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1, 0, "Area", 980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
- uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
- uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_VPGAMMA, "Set", 980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
- uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
-
- uiDefBut(block, LABEL, 0, "Face Select", 600,180,194,18, 0, 0, 0, 0, 0, "");
- if(G.f & G_FACESELECT) {
- extern TFace *lasttface;
-
- set_lasttface();
- if(lasttface) {
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|2, B_REDR_3D_IMA, "Tex", 600,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face with texture");
- uiDefButS(block, TOG|BIT|7, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use tilemode for face");
- uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Light", 720,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use light for face");
- uiDefButS(block, TOG|BIT|10, REDRAWVIEW3D, "Invisible",780,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Make face invisible");
- uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Collision", 840,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use face for collision detection");
-
- uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "Shared", 600,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Blend vertex colours across face when vertices are shared");
- uiDefButS(block, TOG|BIT|9, REDRAWVIEW3D, "Twoside", 660,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face twosided");
- uiDefButS(block, TOG|BIT|11, REDRAWVIEW3D, "ObColor",720,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colours");
-
- uiDefButS(block, TOG|BIT|8, B_TFACE_HALO, "Halo", 600,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Screen aligned billboard");
- uiDefButS(block, TOG|BIT|12, B_TFACE_BILLB, "Billboard",660,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
- uiDefButS(block, TOG|BIT|13, REDRAWVIEW3D, "Shadow", 720,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Face is used for shadow");
- uiDefButS(block, TOG|BIT|14, REDRAWVIEW3D, "Text", 780,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Enable bitmap text on face");
-
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,100,60,19, &lasttface->transp, 2.0, 0.0, 0, 0, "Render colour of textured face as colour");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,100,60,19, &lasttface->transp, 2.0, 1.0, 0, 0, "Render face transparent and add colour of face");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,100,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
- /* uiDefButC(block, ROW, REDRAWVIEW3D, "Sub", 780,100,60,19, &lasttface->transp, 2.0, 3.0, 0, 0); ,""*/
-
- }
- }
- uiBlockSetCol(block, BUTSALMON);
- if(G.f & G_FACESELECT) {
- uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 859,37,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
-
- }
- uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 650,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode");
- uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex", 771,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures");
- uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol", 859,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours");
-
- uiDrawBlock(block);
-}
-
/* *************************** RADIO ******************************** */
void do_radiobuts(short event)
@@ -2671,67 +842,6 @@ void radiobuts(void)
}
-/* *************************** MBALL ******************************** */
-
-void do_mballbuts(unsigned short event)
-{
- switch(event) {
- case B_RECALCMBALL:
- makeDispList(OBACT);
- allqueue(REDRAWVIEW3D, 0);
- break;
- }
-}
-
-void mballbuts(void)
-{
- extern MetaElem *lastelem;
- MetaBall *mb;
- Object *ob;
- uiBlock *block;
- char str[64];
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- mb= ob->data;
- if (ob==find_basis_mball(ob)) {
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 0, 0, "");
- uiDefButF(block, NUMSLI, 0, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 0, 0, "");
-
- uiBlockSetCol(block, BUTBLUE);
- uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, "");
- uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "");
- uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "");
- uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "");
- uiBlockSetCol(block, BUTGREY);
- }
-
- if(ob==G.obedit && lastelem) {
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, "");
- if(lastelem->type!=MB_BALL)
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, "");
- if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, "");
-
- if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
- uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, "");
-
- uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "");
- uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "");
- uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "");
- uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "");
- uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "");
- }
- uiDrawBlock(block);
-}
/* *************************** SCRIPT ******************************** */
@@ -3013,86 +1123,6 @@ void ikabuts(void)
uiDrawBlock(block);
}
-/* *************************** LATTICE ******************************** */
-
-void do_latticebuts(unsigned short event)
-{
- Object *ob;
- Lattice *lt;
-
- ob= OBACT;
-
- switch(event) {
- case B_RESIZELAT:
- if(ob) {
- if(ob==G.obedit) resizelattice(editLatt);
- else resizelattice(ob->data);
- }
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_DRAWLAT:
- if(ob==G.obedit) calc_lattverts_ext();
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_LATTCHANGED:
-
- lt= ob->data;
- if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
-
- make_displists_by_parent(ob);
-
- allqueue(REDRAWVIEW3D, 0);
-
- break;
- }
-}
-
-void latticebuts(void)
-{
- Lattice *lt;
- Object *ob;
- uiBlock *block;
- char str[64];
-
- ob= OBACT;
- if(ob==0) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- if(ob==G.obedit) lt= editLatt;
- else lt= ob->data;
-
- uiSetButLock(lt->key!=0, "Not with VertexKeys");
- uiSetButLock(ob==G.obedit, "Unable to perform function in EditMode");
- uiDefButS(block, NUM, B_RESIZELAT, "U:", 470,178,100,19, &lt->pntsu, 1.0, 64.0, 0, 0, "");
- uiDefButS(block, NUM, B_RESIZELAT, "V:", 470,158,100,19, &lt->pntsv, 1.0, 64.0, 0, 0, "");
- uiDefButS(block, NUM, B_RESIZELAT, "W:", 470,138,100,19, &lt->pntsw, 1.0, 64.0, 0, 0, "");
- uiClearButLock();
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_LINEAR, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_BSPLINE, 0, 0, "");
-
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 158, 40, 19, &lt->typev, 2.0, (float)KEY_LINEAR, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 158, 40, 19, &lt->typev, 2.0, (float)KEY_CARDINAL, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 158, 40, 19, &lt->typev, 2.0, (float)KEY_BSPLINE, 0, 0, "");
-
- uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 138, 40, 19, &lt->typew, 3.0, (float)KEY_LINEAR, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 138, 40, 19, &lt->typew, 3.0, (float)KEY_CARDINAL, 0, 0, "");
- uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 138, 40, 19, &lt->typew, 3.0, (float)KEY_BSPLINE, 0, 0, "");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_RESIZELAT, "Make Regular", 470,101,99,32, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1, B_LATTCHANGED, "Outside", 571,101,120,31, &lt->flag, 0, 0, 0, 0, "");
-
- uiDrawBlock(block);
-}
-
-
/* *************************** TEXTURE ******************************** */
Tex *cur_imatex=0;
@@ -5164,518 +3194,6 @@ void lampbuts(void)
uiDrawBlock(block);
}
-/* ***************************** ANIM ************************** */
-
-void do_animbuts(unsigned short event)
-{
- Object *ob;
- Base *base;
- Effect *eff, *effn;
- int type;
-
- ob= OBACT;
-
- switch(event) {
-
- case B_RECALCPATH:
- calc_curvepath(OBACT);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_MUL_IPO:
- scale_editipo();
- allqueue(REDRAWBUTSANIM, 0);
- break;
- case B_AUTOTIMEOFS:
- auto_timeoffs();
- break;
- case B_FRAMEMAP:
- G.scene->r.framelen= G.scene->r.framapto;
- G.scene->r.framelen/= G.scene->r.images;
- break;
- case B_NEWEFFECT:
- if(ob) {
- if (BLI_countlist(&ob->effect)==MAX_EFFECT)
- error("Unable to add: effect limit reached");
- else
- copy_act_effect(ob);
- }
- allqueue(REDRAWBUTSANIM, 0);
- break;
- case B_DELEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- effn= eff->next;
- if(eff->flag & SELECT) {
- BLI_remlink(&ob->effect, eff);
- free_effect(eff);
- break;
- }
- eff= effn;
- }
- allqueue(REDRAWBUTSANIM, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_NEXTEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->next) {
- eff->flag &= ~SELECT;
- eff->next->flag |= SELECT;
- }
- break;
- }
- eff= eff->next;
- }
- allqueue(REDRAWBUTSANIM, 0);
- break;
- case B_PREVEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->prev) {
- eff->flag &= ~SELECT;
- eff->prev->flag |= SELECT;
- }
- break;
- }
- eff= eff->next;
- }
- allqueue(REDRAWBUTSANIM, 0);
- break;
- case B_CHANGEEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->type!=eff->buttype) {
- BLI_remlink(&ob->effect, eff);
- type= eff->buttype;
- free_effect(eff);
- eff= add_effect(type);
- BLI_addtail(&ob->effect, eff);
- }
- break;
- }
- eff= eff->next;
- }
- allqueue(REDRAWBUTSANIM, 0);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_CALCEFFECT:
- if(ob==0 || ob->type!=OB_MESH) break;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->type==EFF_PARTICLE) build_particle_system(ob);
- else if(eff->type==EFF_WAVE) object_wave(ob);
- }
- eff= eff->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSANIM, 0);
- break;
- case B_RECALCAL:
- base= FIRSTBASE;
- while(base) {
- if(base->lay & G.vd->lay) {
- ob= base->object;
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
- if(eff->type==EFF_PARTICLE) build_particle_system(ob);
- }
- eff= eff->next;
- }
- }
- base= base->next;
- }
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_SETSPEED:
- set_speed_editipo(hspeed);
- break;
- case B_PRINTSPEED:
- ob= OBACT;
- if(ob) {
- float vec[3];
- CFRA++;
- do_ob_ipo(ob);
- where_is_object(ob);
- VECCOPY(vec, ob->obmat[3]);
- CFRA--;
- do_ob_ipo(ob);
- where_is_object(ob);
- VecSubf(vec, vec, ob->obmat[3]);
- prspeed= Normalise(vec);
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_PRINTLEN:
- ob= OBACT;
- if(ob && ob->type==OB_CURVE) {
- Curve *cu=ob->data;
-
- if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
- scrarea_queue_winredraw(curarea);
- }
- break;
- case B_RELKEY:
- allspace(REMAKEIPO, 0);
- allqueue(REDRAWBUTSANIM, 0);
- allqueue(REDRAWIPO, 0);
- break;
-
- default:
- if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
- ob= OBACT;
- if(ob) {
- int a=B_SELEFFECT;
-
- eff= ob->effect.first;
- while(eff) {
- if(event==a) eff->flag |= SELECT;
- else eff->flag &= ~SELECT;
-
- a++;
- eff= eff->next;
- }
- allqueue(REDRAWBUTSANIM, 0);
- }
- }
- }
-}
-
-void animbuts(void)
-{
- Object *ob;
- Mesh *me;
- Lattice *lt;
- Effect *eff;
- Curve *cu;
- ScrArea *sa;
- uiBlock *block;
- int a, ok;
- char str[32];
- short x, y;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 320,17,93,27,&G.scene->r.sfra,1.0,18000.0, 0, 0, "Specify the start frame of the animation");
- uiDefButS(block, NUM,REDRAWSEQ,"End:", 416,17,95,27,&G.scene->r.efra,1.0,18000.0, 0, 0, "Specify the end frame of the animation");
-
- uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old map value in frames");
- uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify new map value in frames");
-
- uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 320,47,93,19, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1, B_SOUND_CHANGED, "Sync", 416,47,95,19, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
-
-/* intrr: obsoleted, replaced by frs/sec */
-/* uiDefButS(block, NUM, 0, "AnimSpeed:", 320,47,192,19, &G.animspeed, 1.0, 9.0, 0, 0, "Set the maximum speed of the animation");*/
-
-
- ob= OBACT;
- if(ob) {
-
- uiBlockSetCol(block, BUTGREEN);
-/* uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Quaternions", 320,190,192,19, &ob->transflag, 0.0, 0.0, 0, 0, "Use quaternions for rotation"); */
- uiBlockSetCol(block, BUTGREY);
-
- uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 23,18,114,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Draw Key", 25,144,84,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
- uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Draw Key Sel", 25,123,84,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
-
- uiDefButC(block, TOG|BIT|2, REDRAWALL, "Offs Ob", 25,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
- uiDefButC(block, TOG|BIT|6, REDRAWALL, "Offs Par", 85,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
- uiDefButC(block, TOG|BIT|7, REDRAWALL, "Offs Parti", 145,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
-
- uiDefButS(block, TOG|BIT|4, 0, "SlowPar", 205,64,60,20, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
-
- /* uiDefButC(block, TOG|BIT|5, REDRAWALL, "Offs Path", 85,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/
- /* uiDefButC(block, TOG|BIT|3, REDRAWALL, "Offs Mat", 145,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/
- /* uiDefButC(block, TOG|BIT|4, REDRAWALL, "Offs VertKey", 205,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/
-
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "DupliFrames", 112,144,106,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
- uiDefButC(block, TOG|BIT|4, REDRAWVIEW3D, "DupliVerts", 112,123,80,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rot", 194,123,24,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 220,144,93,19, &ob->dupsta, 1.0, 1500.0, 0, 0, "Specify startframe for Dupliframes");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 315,144,93,19, &ob->dupend, 1.0, 2500.0, 0, 0, "Specify endframe for Dupliframes");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 220,123,93,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
- uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 315,123,93,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButC(block, TOG|BIT|6, REDRAWVIEW3D, "No Speed", 410,144,93,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
- uiDefButC(block, TOG|BIT|7, REDRAWVIEW3D, "Powertrack", 410,123,93,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 140,18,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
- uiBlockSetCol(block, BUTGREY);
- sprintf(str, "%.4f", prspeed);
- uiDefBut(block, LABEL, 0, str, 247,40,63,31, 0, 1.0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 247,18,63,31, 0, 0, 0, 0, 0, "Print objectspeed");
-
- if(ob->type==OB_MESH) {
- me= ob->data;
- if(me->key) {
- uiDefButS(block, NUM, B_DIFF, "Slurph:", 125,101,93,19, &(me->key->slurph), -500.0, 500.0, 0, 0, "");
- uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 220,100,93,19, &me->key->type, 0, 0, 0, 0, "");
- }
- }
- if(ob->type==OB_CURVE) {
- cu= ob->data;
- uiDefButS(block, NUM, B_RECALCPATH, "PathLen:", 34,100,90,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "");
- /* if(cu->key==0) { */
- uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath", 125,100,90,19 , &cu->flag, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow", 216,100,90,19, &cu->flag, 0, 0, 0, 0, "");
- /* } */
- sprintf(str, "%.4f", prlen);
- uiDefBut(block, LABEL, 0, str, 396,100,90,19, 0, 1.0, 0, 0, 0, "");
- uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 306,100,90,19, 0, 0, 0, 0, 0, "");
- }
- if(ob->type==OB_SURF) {
- cu= ob->data;
-
- if(cu->key) {
- /* uiDefButS(block, NUM, B_DIFF, "Slurph:", 124,100,93,19, &(cu->key->slurph), -500.0, 500.0,0,0); ,""*/
- uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 220,100,93,19, &cu->key->type, 0, 0, 0, 0, "");
- }
- }
- if(ob->type==OB_LATTICE) {
- lt= ob->data;
- if(lt->key) {
- uiDefButS(block, NUM, B_DIFF, "Slurph:", 124,100,93,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, "");
- uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 370,190,133,19, &lt->key->type, 0, 0, 0, 0, "");
- }
- }
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButC(block, ROW,REDRAWVIEW3D,"TrackX", 27,190,58,17, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 85,190,19,17, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 104,190,19,17, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"-X", 123,190,24,17, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"-Y", 147,190,24,17, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"-Z", 171,190,24,17, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
- uiDefButC(block, ROW,REDRAWVIEW3D,"UpX", 205,190,40,17, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
- uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 245,190,20,17, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
- uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 265,190,19,17, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
-
- uiBlockSetCol(block, BUTSALMON);
-
- /* EFFECTS */
-
- draw_buttons_edge(curarea->win, 540);
- draw_buttons_edge(curarea->win, 1010);
-
- if (ob->type == OB_MESH) {
- uiDefBut(block, BUT, B_NEWEFFECT, "NEW Effect", 550,187,124,27, 0, 0, 0, 0, 0, "Create a new effect");
- uiDefBut(block, BUT, B_DELEFFECT, "Delete", 676,187,62,27, 0, 0, 0, 0, 0, "Delete the effect");
- }
-
- uiBlockSetCol(block, BUTGREY);
-
- /* select effs */
- eff= ob->effect.first;
- a= 0;
- while(eff) {
-
- x= 15 * a + 550;
- y= 172; // - 12*( abs(a/10) ) ;
- uiDefButS(block, TOG|BIT|0, B_SELEFFECT+a, "", x, y, 15, 12, &eff->flag, 0, 0, 0, 0, "");
-
- a++;
- if(a==MAX_EFFECT) break;
- eff= eff->next;
- }
-
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) break;
- eff= eff->next;
- }
-
- if(eff) {
- uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Start building the effect");
-
- if(eff->type==EFF_BUILD) {
- BuildEff *bld;
-
- bld= (BuildEff *)eff;
-
- uiDefButF(block, NUM, 0, "Len:", 649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the building requires");
- uiDefButF(block, NUM, 0, "Sfra:", 746,138,94,22, &bld->sfra, 1.0, 9000.0, 100, 0, "Specify the startframe of the effect");
- }
- else if(eff->type==EFF_WAVE) {
- WaveEff *wav;
-
- wav= (WaveEff *)eff;
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X", 782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis");
- uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y", 840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis");
- uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl", 890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave efefct");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_CALCEFFECT, "Sta x:", 550,135,113,24, &wav->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
- uiDefButF(block, NUM, B_CALCEFFECT, "Sta y:", 665,135,104,24, &wav->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis");
-
- uiDefButF(block, NUMSLI, B_CALCEFFECT, "Speed:", 550,100,216,20, &wav->speed, -2.0, 2.0, 0, 0, "Specify the wave speed");
- uiDefButF(block, NUMSLI, B_CALCEFFECT, "Heigth:", 550,80,216,20, &wav->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave");
- uiDefButF(block, NUMSLI, B_CALCEFFECT, "Width:", 550,60,216,20, &wav->width, 0.0, 5.0, 0, 0, "Specify the width of the wave");
- uiDefButF(block, NUMSLI, B_CALCEFFECT, "Narrow:", 550,40,216,20, &wav->narrow, 0.0, 10.0, 0, 0, "Specify how narrow the wave follows");
-
- uiDefButF(block, NUM, B_CALCEFFECT, "Time sta:", 780,100,219,20, &wav->timeoffs, -1000.0, 1000.0, 100, 0, "Specify startingframe of the wave");
-
- uiDefButF(block, NUM, B_CALCEFFECT, "Lifetime:", 780,80,219,20, &wav->lifetime, -1000.0, 1000.0, 100, 0, "Specify the lifespan of the wave");
- uiDefButF(block, NUM, B_CALCEFFECT, "Damptime:", 780,60,219,20, &wav->damp, -1000.0, 1000.0, 100, 0, "Specify the dampingtime of the wave");
-
- }
- else if(eff->type==EFF_PARTICLE) {
- PartEff *paf;
-
- paf= (PartEff *)eff;
-
- uiDefBut(block, BUT, B_RECALCAL, "RecalcAll", 741,187,67,27, 0, 0, 0, 0, 0, "Update the particle system");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Static", 825,187,67,27, &paf->flag, 0, 0, 0, 0, "Make static particles");
- uiBlockSetCol(block, BUTGREY);
-
- uiDefButI(block, NUM, B_CALCEFFECT, "Tot:", 550,146,91,20, &paf->totpart, 1.0, 100000.0, 0, 0, "Set the total number of particles");
- if(paf->flag & PAF_STATIC) {
- uiDefButS(block, NUM, REDRAWVIEW3D, "Step:", 644,146,84,20, &paf->staticstep, 1.0, 100.0, 10, 0, "");
- }
- else {
- uiDefButF(block, NUM, B_CALCEFFECT, "Sta:", 644,146,84,20, &paf->sta, -250.0, 9000.0, 100, 0, "Specify the startframe");
- uiDefButF(block, NUM, B_CALCEFFECT, "End:", 731,146,97,20, &paf->end, 1.0, 9000.0, 100, 0, "Specify the endframe");
- }
- uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,146,88,20, &paf->lifetime, 1.0, 9000.0, 100, 0, "Specify the life span of the particles");
- uiDefButI(block, NUM, B_CALCEFFECT, "Keys:", 922,146,80,20, &paf->totkey, 1.0, 32.0, 0, 0, "Specify the number of key positions");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, NUM, B_REDR, "CurMul:", 550,124,91,20, &paf->curmult, 0.0, 3.0, 0, 0, "Multiply the particles");
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM, B_CALCEFFECT, "Mat:", 644,124,84,20, paf->mat+paf->curmult, 1.0, 8.0, 0, 0, "Specify the material used for the particles");
- uiDefButF(block, NUM, B_CALCEFFECT, "Mult:", 730,124,98,20, paf->mult+paf->curmult, 0.0, 1.0, 10, 0, "Probability \"dying\" particle spawns a new one.");
- uiDefButS(block, NUM, B_CALCEFFECT, "Child:", 922,124,80,20, paf->child+paf->curmult, 1.0, 600.0, 100, 0, "Specify the number of children of a particle that multiply itself");
- uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,124,89,20, paf->life+paf->curmult, 1.0, 600.0, 100, 0, "Specify the lifespan of the next generation particles");
-
- uiDefButF(block, NUM, B_CALCEFFECT, "Randlife:", 550,96,96,20, &paf->randlife, 0.0, 2.0, 10, 0, "Give the particlelife a random variation");
- uiDefButI(block, NUM, B_CALCEFFECT, "Seed:", 652,96,80,20, &paf->seed, 0.0, 255.0, 0, 0, "Set an offset in the random table");
-
- uiDefButF(block, NUM, B_DIFF, "VectSize", 885,96,116,20, &paf->vectsize, 0.0, 1.0, 10, 0, "Set the speed for Vect");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Face", 735,96,46,20, &paf->flag, 0, 0, 0, 0, "Emit particles also from faces");
- uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "Bspline", 782,96,54,20, &paf->flag, 0, 0, 0, 0, "Use B spline formula for particle interpolation");
- uiDefButS(block, TOG, REDRAWVIEW3D, "Vect", 837,96,45,20, &paf->stype, 0, 0, 0, 0, "Give the particles a rotation direction");
-
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButF(block, NUM, B_CALCEFFECT, "Norm:", 550,67,96,20, &paf->normfac, -2.0, 2.0, 10, 0, "Let the mesh give the particle a starting speed");
- uiDefButF(block, NUM, B_CALCEFFECT, "Ob:", 649,67,86,20, &paf->obfac, -1.0, 1.0, 10, 0, "Let the object give the particle a starting speed");
- uiDefButF(block, NUM, B_CALCEFFECT, "Rand:", 738,67,86,20, &paf->randfac, 0.0, 2.0, 10, 0, "Give the startingspeed a random variation");
- uiDefButF(block, NUM, B_CALCEFFECT, "Tex:", 826,67,85,20, &paf->texfac, 0.0, 2.0, 10, 0, "Let the texture give the particle a starting speed");
- uiDefButF(block, NUM, B_CALCEFFECT, "Damp:", 913,67,89,20, &paf->damp, 0.0, 1.0, 10, 0, "Specify the damping factor");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_CALCEFFECT, "X:", 550,31,72,20, paf->force, -1.0, 1.0, 1, 0, "Specify the X axis of a continues force");
- uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 624,31,78,20, paf->force+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a continues force");
- uiDefBut(block, LABEL, 0, "Force:", 550,9,72,20, 0, 1.0, 0, 0, 0, "");
- uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 623,9,79,20, paf->force+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a continues force");
-
- uiDefBut(block, LABEL, 0, "Texture:", 722,9,74,20, 0, 1.0, 0, 0, 0, "");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_CALCEFFECT, "Int", 875,9,32,43, &paf->texmap, 14.0, 0.0, 0, 0, "Use texture intensity as a factor for texture force");
- uiDefButS(block, ROW, B_CALCEFFECT, "RGB", 911,31,45,20, &paf->texmap, 14.0, 1.0, 0, 0, "Use RGB values as a factor for particle speed");
- uiDefButS(block, ROW, B_CALCEFFECT, "Grad", 958,31,44,20, &paf->texmap, 14.0, 2.0, 0, 0, "Use texture gradient as a factor for particle speed");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_CALCEFFECT, "Nabla:", 911,9,91,20, &paf->nabla, 0.0001, 1.0, 1, 0, "Specify the dimension of the area for gradient calculation");
- uiDefButF(block, NUM, B_CALCEFFECT, "X:", 722,31,74,20, paf->defvec, -1.0, 1.0, 1, 0, "Specify the X axis of a force, determined by the texture");
- uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 798,31,74,20, paf->defvec+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a force, determined by the texture");
- uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 797,9,75,20, paf->defvec+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a force, determined by the texture");
-
- }
- }
- }
-
- /* IPO BUTTONS AS LAST */
- 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;
- }
- }
-
- uiBlockSetCol(block, BUTGREEN);
- // RMGRP uiDefButC(block, ROW, B_REDR, "Ipo settings", 1020, 180, 100, 19, &G.buts->showgroup, 15.0, 0.0, 0, 0, "");
- // RMGRP uiDefButC(block, ROW, B_REDR, "Group settings", 1120, 180, 100, 19, &G.buts->showgroup, 15.0, 1.0, 0, 0, "");
- uiBlockSetCol(block, BUTGREY);
-
- if(ok && G.buts->showgroup==0) {
- 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, "");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_MUL_IPO, "SET", 1220,79,50,62, 0, 0, 0, 0, 0, "");
-
-
- /* SPEED BUTTON */
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_DIFF, "Speed:", 1020,23,164,28, &hspeed, 0.0, 180.0, 1, 0, "");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_SETSPEED, "SET", 1185,23,83,29, 0, 0, 0, 0, 0, "");
- }
-
- if(G.buts->showgroup && G.scene->group) {
- GroupKey *gk;
- short yco= 140;
-
- gk= G.scene->group->gkey.first;
- while(gk) {
- if(gk==G.scene->group->active) uiBlockSetCol(block, BUTPURPLE);
- else uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, TEX, B_DIFF, "Name:", 1020, yco, 140, 19, &gk->name, 0.0, 31.0, 10, 0, "");
- uiDefButS(block, NUM, B_DIFF, "Sta:", 1160, yco, 60, 19, &gk->sfra, 0.0, 5000.0, 10, 0, "");
- uiDefButS(block, NUM, B_DIFF, "End:", 1220, yco, 50, 19, &gk->efra, 0.0, 5000.0, 10, 0, "");
- yco-= 20;
- gk= gk->next;
- }
- }
-
- uiDrawBlock(block);
-}
-
-
-
/* ***************************** WORLD ************************** */
@@ -6082,729 +3600,6 @@ static void scene_change_set(Scene *sc, Scene *set) {
}
}
-static void run_playanim(char *file) {
- extern char bprogname[]; /* usiblender.c */
- char str[FILE_MAXDIR+FILE_MAXFILE];
- int pos[2], size[2];
-
- calc_renderwin_rectangle(R.winpos, pos, size);
-
- sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
- system(str);
-}
-
-void do_renderbuts(unsigned short event)
-{
- ScrArea *sa;
- ID *id;
- char file[FILE_MAXDIR+FILE_MAXFILE];
-
- switch(event) {
-
- case B_DORENDER:
- BIF_do_render(0);
- break;
- case B_RTCHANGED:
- allqueue(REDRAWALL, 0);
- break;
- case B_PLAYANIM:
-#ifdef WITH_QUICKTIME
- if(G.scene->r.imtype == R_QUICKTIME)
- makeqtstring(file);
- else
-#endif
- makeavistring(file);
- if(BLI_exist(file)) {
- run_playanim(file);
- }
- else {
- makepicstring(file, G.scene->r.sfra);
- if(BLI_exist(file)) {
- run_playanim(file);
- }
- else error("Can't find image: %s", file);
- }
- break;
-
- case B_DOANIM:
- BIF_do_render(1);
- break;
-
- case B_FS_PIC:
- sa= closest_bigger_area();
- areawinset(sa->win);
- activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic);
- break;
- case B_FS_BACKBUF:
- sa= closest_bigger_area();
- areawinset(sa->win);
- activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
- break;
- case B_IS_BACKBUF:
- sa= closest_bigger_area();
- areawinset(sa->win);
- activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
- break;
- case B_FS_FTYPE:
- sa= closest_bigger_area();
- areawinset(sa->win);
- activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
- break;
- case B_IS_FTYPE:
- sa= closest_bigger_area();
- areawinset(sa->win);
- activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
- break;
-
- case B_PR_PAL:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 54;
- G.scene->r.yasp= 51;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 25;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWBUTSRENDER, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
-
-#ifdef WITH_QUICKTIME
- case B_FILETYPEMENU:
- allqueue(REDRAWBUTSRENDER, 0);
-#if defined (_WIN32) || defined (__APPLE__)
- // fall through to codec settings if this is the first
- // time R_AVICODEC is selected for this scene.
- if (((G.scene->r.imtype == R_AVICODEC)
- && (G.scene->r.avicodecdata == NULL)) ||
- ((G.scene->r.imtype == R_QUICKTIME)
- && (G.scene->r.qtcodecdata == NULL))) {
- } else {
- break;
- }
-#else /* libquicktime */
- if(G.scene->r.imtype == R_QUICKTIME) {
- /* i'm not sure if this should be here... */
- /* set default quicktime codec */
- if (!G.scene->r.qtcodecdata) {
- G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData),
- "QtCodecData");
- qtcodec_idx = 1;
- }
-
- qt_init_codecs();
- if (qtcodec_idx < 1) qtcodec_idx = 1;
-
- G.scene->r.qtcodecdata->fourcc =
- qtcodecidx_to_fcc(qtcodec_idx-1);
- qt_init_codecdata(G.scene->r.qtcodecdata);
-/* I'm not sure if this is really needed, so don't remove it yet */
-#if 0
- /* get index of codec that can handle a given fourcc */
- if (qtcodec_idx < 1)
- qtcodec_idx = get_qtcodec_idx(G.scene->r.qtcodecdata->fourcc)+1;
-
- /* no suitable codec found, alert user */
- if (qtcodec_idx < -1) {
- error("no suitable codec found!");
- qtcodec_idx = 1;
- }
-#endif /* 0 */
- }
-#endif /*_WIN32 || __APPLE__ */
-
- case B_SELECTCODEC:
-#if defined (_WIN32) || defined (__APPLE__)
- if ((G.scene->r.imtype == R_QUICKTIME)) /* || (G.scene->r.qtcodecdata)) */
- get_qtcodec_settings();
-#ifdef _WIN32
- else
- get_avicodec_settings();
-#endif /* _WIN32 */
-#else /* libquicktime */
- if (!G.scene->r.qtcodecdata) {
- G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData),
- "QtCodecData");
- qtcodec_idx = 1;
- }
- if (qtcodec_idx < 1) {
- qtcodec_idx = 1;
- qt_init_codecs();
- }
-
- G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1);
- /* if the selected codec differs from the previous one, reinit it */
- qt_init_codecdata(G.scene->r.qtcodecdata);
- allqueue(REDRAWBUTSRENDER, 0);
-#endif /* _WIN32 || __APPLE__ */
- break;
-#endif /* WITH_QUICKTIME */
-
- case B_PR_FULL:
- G.scene->r.xsch= 1280;
- G.scene->r.ysch= 1024;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWBUTSRENDER, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
- case B_PR_PRV:
- G.scene->r.xsch= 640;
- G.scene->r.ysch= 512;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 50;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_CDI:
- G.scene->r.xsch= 384;
- G.scene->r.ysch= 280;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.15, 0.85, 0.15, 0.85);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_PAL169:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 64;
- G.scene->r.yasp= 45;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 25;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_D2MAC:
- G.scene->r.xsch= 1024;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 1;
- G.scene->r.yasp= 1;
- G.scene->r.size= 50;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_MPEG:
- G.scene->r.xsch= 368;
- G.scene->r.ysch= 272;
- G.scene->r.xasp= 105;
- G.scene->r.yasp= 100;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_PC:
- G.scene->r.xsch= 640;
- G.scene->r.ysch= 480;
- G.scene->r.xasp= 100;
- G.scene->r.yasp= 100;
- G.scene->r.size= 100;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_PRESET:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 576;
- G.scene->r.xasp= 54;
- G.scene->r.yasp= 51;
- G.scene->r.size= 100;
- G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS;
- G.scene->r.imtype= R_TARGA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_PANO:
- G.scene->r.xsch= 36;
- G.scene->r.ysch= 176;
- G.scene->r.xasp= 115;
- G.scene->r.yasp= 100;
- G.scene->r.size= 100;
- G.scene->r.mode |= R_PANORAMA;
- G.scene->r.xparts= 16;
- G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWVIEWCAM, 0);
- allqueue(REDRAWBUTSRENDER, 0);
- break;
- case B_PR_NTSC:
- G.scene->r.xsch= 720;
- G.scene->r.ysch= 480;
- G.scene->r.xasp= 10;
- G.scene->r.yasp= 11;
- G.scene->r.size= 100;
- G.scene->r.frs_sec= 30;
- G.scene->r.mode &= ~R_PANORAMA;
- G.scene->r.xparts= G.scene->r.yparts= 1;
-
- BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9);
- allqueue(REDRAWBUTSRENDER, 0);
- allqueue(REDRAWVIEWCAM, 0);
- break;
-
- case B_SETBROWSE:
- id= (ID*) G.scene->set;
-
- if (G.buts->menunr==-2) {
- activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_renderbuts);
- } else if (G.buts->menunr>0) {
- Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1);
-
- if (newset==G.scene)
- error("Not allowed");
- else if (newset)
- scene_change_set(G.scene, newset);
- }
- break;
- case B_CLEARSET:
- scene_change_set(G.scene, NULL);
- break;
- }
-}
-
-uiBlock *edge_render_menu(void *arg_unused)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks,
- "edge render", UI_EMBOSSX, UI_HELV,
- curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "",
-/* 285, -20, 230, 100, NULL, */
- 285, -20, 230, 120, NULL,
- 0, 0, 0, 0, "");
-
- uiDefButS(block, NUM, 0,"Eint:",
- 295,50,70,19,
- &G.scene->r.edgeint, 0.0, 255.0, 0, 0,
- "Sets edge intensity for Toon shading");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButI(block, TOG, 0,"Shift",
- 365,50,70,19,
- &G.compat, 0, 0, 0, 0,
- "For unified renderer: use old offsets for edges");
- uiDefButI(block, TOG, 0,"All", 435,50,70,19,
- &G.notonlysolid, 0, 0, 0, 0,
- "For unified renderer: also consider transparent "
- "faces for toon shading");
-
- /* colour settings for the toon shading */
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, COL, B_EDGECOLSLI, "",
- 295,-10,30,60,
- &(G.scene->r.edgeR), 0, 0, 0, 0,
- "");
-
- uiDefButF(block, NUMSLI, 0, "R ",
- 325, 30, 180,19,
- &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0,
- "For unified renderer: Colour for edges in toon shading mode.");
- uiDefButF(block, NUMSLI, 0, "G ",
- 325, 10, 180,19,
- &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0,
- "For unified renderer: Colour for edges in toon shading mode.");
- uiDefButF(block, NUMSLI, 0, "B ",
- 325, -10, 180,19,
- &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0,
- "For unified renderer: Colour for edges in toon shading mode.");
-
- uiDefButS(block, NUM, 0,"AntiShift",
- 365,70,140,19,
- &(G.scene->r.same_mat_redux), 0, 255.0, 0, 0,
- "For unified renderer: reduce intensity on boundaries "
- "with identical materials with this number.");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-static uiBlock *post_render_menu(void *arg_unused)
-{
- uiBlock *block;
-
- block= uiNewBlock(&curarea->uiblocks, "post render", UI_EMBOSSX, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -10, 10, 200, 80, NULL, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, 0,"Add:", 0,60,180,19,
- &G.scene->r.postadd, -1.0, 1.0, 0, 0, "");
- uiDefButF(block, NUMSLI, 0,"Mul:", 0,40,180,19,
- &G.scene->r.postmul, 0.01, 4.0, 0, 0, "");
- uiDefButF(block, NUMSLI, 0,"Gamma:", 0,20,180,19,
- &G.scene->r.postgamma, 0.2, 2.0, 0, 0, "");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-
-static uiBlock *framing_render_menu(void *arg_unused)
-{
- uiBlock *block;
- short yco = 60, xco = 0;
- int randomcolorindex = 1234;
-
- block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSSX, UI_HELV, curarea->win);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -10, -10, 300, 100, NULL, 0, 0, 0, 0, "");
-
- uiDefBut(block, LABEL, B_NOP, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, "");
- uiDefButC(block, ROW, 0, "Stretch", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_SCALE , 0, 0, "Stretch or squeeze the viewport to fill the display window");
- uiDefButC(block, ROW, 0, "Expose", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_EXTEND, 0, 0, "Show the entire viewport in the display window, viewing more horizontally or vertically");
- uiDefButC(block, ROW, 0, "Bars", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_BARS , 0, 0, "Show the entire viewport in the display window, using bar horizontally or vertically");
-
- yco -= 20;
- xco = 35;
-
- uiDefButF(block, COL, randomcolorindex, "", 0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, 0, "R ", xco,yco,243,18, &G.scene->framing.col[0], 0.0, 1.0, randomcolorindex, 0, "Set the red component of the bars");
- yco -= 20;
- uiDefButF(block, NUMSLI, 0, "G ", xco,yco,243,18, &G.scene->framing.col[1], 0.0, 1.0, randomcolorindex, 0, "Set the green component of the bars");
- yco -= 20;
- uiDefButF(block, NUMSLI, 0, "B ", xco,yco,243,18, &G.scene->framing.col[2], 0.0, 1.0, randomcolorindex, 0, "Set the blue component of the bars");
-
- uiBlockSetDirection(block, UI_TOP);
-
- return block;
-}
-
-
-static char *imagetype_pup(void)
-{
- static char string[1024];
- char formatstring[1024];
-
- strcpy(formatstring, "Save image as: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
-
-#ifdef __sgi
- strcat(formatstring, "|%s %%x%d"); // add space for Movie
-#endif
-
- strcat(formatstring, "|%s %%x%d"); // add space for PNG
-
-#ifdef _WIN32
- strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec
-#endif
-
-#ifdef WITH_QUICKTIME
- if(G.have_quicktime)
- strcat(formatstring, "|%s %%x%d"); // add space for Quicktime
-#endif
-
- if(G.have_quicktime) {
- sprintf(string, formatstring,
- "AVI Raw", R_AVIRAW,
- "AVI Jpeg", R_AVIJPEG,
-#ifdef _WIN32
- "AVI Codec", R_AVICODEC,
-#endif
-#ifdef WITH_QUICKTIME
- "QuickTime", R_QUICKTIME,
-#endif
- "Targa", R_TARGA,
- "Targa Raw", R_RAWTGA,
- "PNG", R_PNG,
- "Jpeg", R_JPEG90,
- "HamX", R_HAMX,
- "Iris", R_IRIS,
- "Iris + Zbuffer", R_IRIZ,
- "Ftype", R_FTYPE,
- "Movie", R_MOVIE
- );
- } else {
- sprintf(string, formatstring,
- "AVI Raw", R_AVIRAW,
- "AVI Jpeg", R_AVIJPEG,
-#ifdef _WIN32
- "AVI Codec", R_AVICODEC,
-#endif
- "Targa", R_TARGA,
- "Targa Raw", R_RAWTGA,
- "PNG", R_PNG,
- "Jpeg", R_JPEG90,
- "HamX", R_HAMX,
- "Iris", R_IRIS,
- "Iris + Zbuffer", R_IRIZ,
- "Ftype", R_FTYPE,
- "Movie", R_MOVIE
- );
- }
-
- return (string);
-}
-
-
-static char *avicodec_str(void)
-{
- static char string[1024];
-
- sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname);
-
- return string;
-}
-
-
-void renderbuts(void)
-{
- ID *id;
- int a,b;
- uiBlock *block;
- char *strp;
- char str[64];
- int yofs;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- uiDefBut(block, TEX,0,"", 34,172,257,19,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
- uiDefBut(block, BUT,B_FS_PIC," ", 10,172,22,19, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name");
- uiDefBut(block, TEX,0,"", 34,149,257,19,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
- uiDefBut(block, BUT,B_FS_BACKBUF," ", 21,149,11,19, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
- uiDefBut(block, TEX,0,"", 34,126,257,19,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type");
- uiDefBut(block, BUT,B_FS_FTYPE," ", 21,126,11,19, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image");
- uiDefIconBut(block, BUT, B_CLEARSET, ICON_X, 267,102,24,21, 0, 0, 0, 0, 0, "Remove Set link");
-
- /* SET BUTTON */
- id= (ID *)G.scene->set;
- IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
- if(strp[0])
- uiDefButS(block, MENU, B_SETBROWSE, strp, 10,103,22,19, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
- MEM_freeN(strp);
-
- uiDefBut(block, LABEL, 0, "Set", 295,103,63,19, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTBLUE);
-
- if(G.scene->set) {
- uiSetButLock(1, NULL);
- uiDefIDPoinBut(block, test_scenepoin_but, 0, "", 34,103,231,19, &(G.scene->set), "Name of the Set");
- uiClearButLock();
- }
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_IS_BACKBUF," ", 10,149,11,19, 0, 0, 0, 0, 0, "Open Imageselect to get Backbuf image");
- uiDefBut(block, BUT,B_IS_FTYPE," ", 10,126,11,19, 0, 0, 0, 0, 0, "Open Imageselect to get Ftype image");
- uiBlockSetCol(block, BUTGREY);
-
- uiDefBut(block, LABEL,0,"Pics", 295,172,63,19, 0, 0, 0, 0, 0, "");
- uiDefButS(block, TOG|BIT|0, 0,"Backbuf", 295,149,63,19, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
- uiDefBut(block, LABEL,0,"Ftype", 295,126,63,19, 0, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
-
- for(b=0; b<3; b++)
- for(a=0; a<3; a++)
- uiDefButS(block, TOG|BIT|(3*b+a),800,"", (short)(34+18*a),(short)(11+12*b),16,10, &R.winpos, 0, 0, 0, 0, "Render window placement on screen");
-
- uiDefButS(block, ROW, B_REDR, "DispView", 99,28,77,18, &R.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
- uiDefButS(block, ROW, B_REDR, "DispWin", 99,10,78,18, &R.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
-
- uiDefButS(block, TOG|BIT|4, 0, "Extensions", 190,10,95,18, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
-
- uiBlockSetCol(block, BUTSALMON);
-
- uiDefBut(block, BUT,B_DORENDER,"RENDER", 369,142,192,47, 0, 0, 0, 0, 0, "Start the rendering");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, TOG|BIT|1,0,"Shadow", 565,167,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
- uiDefButS(block, TOG|BIT|4,0,"EnvMap", 626,167,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation");
- uiDefButS(block, TOG|BIT|10,0,"Pano", 565,142,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)");
- uiDefButS(block, TOG|BIT|8,0,"Radio", 626,142,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering");
-
- uiDefButS(block, ROW,B_DIFF,"100%", 565,114,121,20,&G.scene->r.size,1.0,100.0, 0, 0, "Set render size to defined size");
- uiDefButS(block, ROW,B_DIFF,"75%", 565,90,36,20,&G.scene->r.size,1.0,75.0, 0, 0, "Set render size to 3/4 of defined size");
- uiDefButS(block, ROW,B_DIFF,"50%", 604,90,40,20,&G.scene->r.size,1.0,50.0, 0, 0, "Set render size to 1/2 of defined size");
- uiDefButS(block, ROW,B_DIFF,"25%", 647,90,39,20,&G.scene->r.size,1.0,25.0, 0, 0, "Set render size to 1/4 of defined size");
-
- uiDefButS(block, TOG|BIT|0, 0, "OSA", 369,114,124,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
- uiDefButF(block, NUM,B_DIFF,"Bf:", 495,90,65,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 0, "Sets motion blur factor");
- uiDefButS(block, TOG|BIT|14, 0, "MBLUR", 495,114,66,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
-
- uiDefButS(block, ROW,B_DIFF,"5", 369,90,29,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Sets oversample level to 5");
- uiDefButS(block, ROW,B_DIFF,"8", 400,90,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
- uiDefButS(block, ROW,B_DIFF,"11", 431,90,33,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Sets oversample level to 11");
- uiDefButS(block, ROW,B_DIFF,"16", 466,90,28,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
-
- uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,42,99,31,&G.scene->r.xparts,1.0, 64.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
- uiDefButS(block, NUM,B_DIFF,"Yparts:", 472,42,86,31,&G.scene->r.yparts,1.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in");
-
- uiDefButS(block, TOG|BIT|6,0,"Fields",564,42,90,31,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering");
-
- uiDefButS(block, TOG|BIT|13,0,"Odd", 655,57,30,16,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)");
- uiDefButS(block, TOG|BIT|7,0,"x", 655,42,30,15,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
-
- uiDefButS(block, ROW,800,"Sky", 369,11,38,24,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky");
- uiDefButS(block, ROW,800,"Premul", 410,11,54,24,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance");
- uiDefButS(block, ROW,800,"Key", 467,11,44,24,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and colour values remain unchanged");
-
- /* Toon shading buttons */
- uiDefButS(block, TOG|BIT|5, 0,"Edge", 295,70,70,19,
- &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon shading");
- uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings |>> ", 155, 70, 138, 19, "Display edge settings");
-
- /* unified render buttons */
- if(G.scene->r.mode & R_UNIFIED) {
- uiDefBlockBut(block, post_render_menu, NULL, "Post process |>> ", 15, 70, 138, 19, "Only for unified render");
- if (G.scene->r.mode & R_GAMMA) {
- uiDefButF(block, NUMSLI, 0,"Gamma:", 15, 50, 280, 19,
- &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0,
- "The gamma value for blending oversampled images (1.0 = no correction).");
- }
- }
-
-
- uiDefButS(block, TOG|BIT|9,REDRAWVIEWCAM, "Border", 565,11,58,24, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
- uiDefButS(block, TOG|BIT|2,0, "Gamma", 626,11,58,24, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT,B_DOANIM,"ANIM", 692,142,192,47, 0, 0, 0, 0, 0, "Start rendering a sequence");
-
- uiBlockSetCol(block, BUTBLUE);
-
- uiDefButS(block, TOG|BIT|0, 0, "Do Sequence", 692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
- uiDefButS(block, TOG|BIT|1, 0, "Render Daemon", 692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Let external network render current scene");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT,B_PLAYANIM, "PLAY", 692,40,94,33, 0, 0, 0, 0, 0, "Play animation of rendered images/avi (searches Pics: field)");
-
- uiDefButS(block, NUM, B_RTCHANGED, "rt:", 790,40,95,33, &G.rt, 0.0, 256.0, 0, 0, "General testing/debug button");
-
- uiDefButS(block, ROW,B_DIFF,"BW", 892, 10,74,20, &G.scene->r.planes, 5.0,(float)R_PLANESBW, 0, 0, "Images are saved with BW (grayscale) data");
- uiDefButS(block, ROW,B_DIFF,"RGB", 968, 10,74,20, &G.scene->r.planes, 5.0,(float)R_PLANES24, 0, 0, "Images are saved with RGB (color) data");
- uiDefButS(block, ROW,B_DIFF,"RGBA", 1044, 10,75,20, &G.scene->r.planes, 5.0,(float)R_PLANES32, 0, 0, "Images are saved with RGB and Alpha data (if supported)");
-
- yofs = 54;
-
-#ifdef __sgi
- yofs = 76;
- uiDefButS(block, NUM,B_DIFF,"MaxSize:", 892,32,165,20, &G.scene->r.maximsize, 0.0, 500.0, 0, 0, "Maximum size per frame to save in an SGI movie");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|12,0,"Cosmo", 1059,32,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Attempt to save SGI movies using Cosmo hardware");
- uiBlockSetCol(block, BUTGREY);
-#endif
-
- uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(), 892,yofs,174,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|11,0, "Crop", 1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "Exclude border rendering from total image");
- uiBlockSetCol(block, BUTGREY);
-
- yofs -= 22;
-
- if(G.scene->r.quality==0) G.scene->r.quality= 90;
-
-#ifdef WITH_QUICKTIME
- if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) {
-#else /* WITH_QUICKTIME */
- if (0) {
-#endif
- if(G.scene->r.imtype == R_QUICKTIME) {
-#ifdef WITH_QUICKTIME
-#if defined (_WIN32) || defined (__APPLE__)
- glColor3f(0.65, 0.65, 0.7);
- glRecti(892,yofs+46,892+225,yofs+45+20);
- if(G.scene->r.qtcodecdata == NULL)
- uiDefBut(block, LABEL, 0, "Codec: not set", 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
- else
- uiDefBut(block, LABEL, 0, G.scene->r.qtcodecdata->qtcodecname, 892,yofs+44,225,20, 0, 0, 0, 0, 0, "");
- uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime");
-#else /* libquicktime */
- if (!G.scene->r.qtcodecdata) G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), "QtCodecData");
- uiDefButI(block, MENU, B_SELECTCODEC, qtcodecs_pup(), 892,yofs, 112, 20, &qtcodec_idx, 0, 0, 0, 0, "Codec");
- /* make sure the codec stored in G.scene->r.qtcodecdata matches the selected
- * one, especially if it's not set.. */
- if (!G.scene->r.qtcodecdata->fourcc) {
- G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1);
- qt_init_codecdata(G.scene->r.qtcodecdata);
- }
-
- yofs -= 22;
- uiDefBlockBut(block, qtcodec_menu, NULL, "Codec Settings |>> ", 892,yofs, 227, 20, "Edit Codec settings for QuickTime");
- yofs +=22;
-
-#endif /* libquicktime */
-#endif /* WITH_QUICKTIME */
- } else {
-#ifdef _WIN32
- glColor3f(0.65, 0.65, 0.7);
- glRecti(892,yofs+46,892+225,yofs+45+20);
- if(G.scene->r.avicodecdata == NULL)
- uiDefBut(block, LABEL, 0, "Codec: not set.", 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
- else
- uiDefBut(block, LABEL, 0, avicodec_str(), 892,yofs+43,225,20, 0, 0, 0, 0, 0, "");
-#endif
- uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI");
- }
- } else {
- uiDefButS(block, NUM,0, "Quality:", 892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies");
- }
- uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
-
- uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 692,10,94,24, &G.scene->r.sfra,1.0,18000.0, 0, 0, "The start frame of the animation");
- uiDefButS(block, NUM,REDRAWSEQ,"End:", 790,10,95,24, &G.scene->r.efra,1.0,18000.0, 0, 0, "The end frame of the animation");
-
- uiDefBlockBut(block, framing_render_menu, NULL, "Game framing settings |>> ", 892, 169, 227, 20, "Display game framing settings");
-
- uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:", 892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:", 1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:", 892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
- uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:", 1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
-
- uiDefBut(block, BUT,B_PR_PAL, "PAL", 1146,170,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 54x51, 25 fps");
- uiDefBut(block, BUT,B_PR_NTSC, "NTSC", 1146,150,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x480, Aspect ratio - 10x11, 30 fps");
- uiDefBut(block, BUT,B_PR_PRESET, "Default", 1146,130,133,18, 0, 0, 0, 0, 0, "Same as PAL, with render settings (OSA, Shadows, Fields)");
- uiDefBut(block, BUT,B_PR_PRV, "Preview", 1146,110,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x512, Render size 50%");
- uiDefBut(block, BUT,B_PR_PC, "PC", 1146,90,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x480, Aspect ratio - 100x100");
- uiDefBut(block, BUT,B_PR_PAL169, "PAL 16:9",1146,70,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 64x45");
- uiDefBut(block, BUT,B_PR_PANO, "PANO", 1146,50,133,18, 0, 0, 0, 0, 0, "Standard panorama settings");
- uiDefBut(block, BUT,B_PR_FULL, "FULL", 1146,30,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1");
- uiDefButS(block, TOG|BIT|15, B_REDR, "Unified Renderer", 1146,10,133,18,
- &G.scene->r.mode, 0, 0, 0, 0,
- "Use the unified renderer.");
-
- uiDrawBlock(block);
-}
/* ********************* CONSTRAINT ***************************** */
@@ -7293,221 +4088,3 @@ static void do_constraintbuts(unsigned short event)
}
}
-/* ********************* GAME ***************************** */
-
-/* in editsca.c */
-
-/* ***************************<>******************************** */
-
-void drawbutspace_old(ScrArea *sa, void *spacedata)
-{
- SpaceButs *sbuts= curarea->spacedata.first;
- View2D *v2d= &sbuts->v2d;
- ID *id;
- Object *ob;
- float vec[2];
-
- if(curarea->headertype==0) {
- ID *id, *idfrom;
-
- buttons_active_id(&id, &idfrom);
- G.buts->lockpoin= id;
- }
-
- ob= OBACT;
-
-// myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin-0.6, v2d->cur.ymax+0.6);
- myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
-
- glShadeModel(GL_SMOOTH);
- glBegin(GL_QUADS);
- cpack(0x909090);
- vec[0]= v2d->cur.xmin;
- vec[1]= v2d->cur.ymax-15;
- glVertex2fv(vec);
- vec[0]= v2d->cur.xmax;
- glVertex2fv(vec);
- cpack(0x646464);
- vec[1]= v2d->cur.ymax;
- glVertex2fv(vec);
- vec[0]= v2d->cur.xmin;
- glVertex2fv(vec);
- glEnd();
- glShadeModel(GL_FLAT);
-
- cpack(0x909090);
- glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax-15);
-
- uiSetButLock(G.scene->id.lib!=0, "Can't edit library data");
- uiFreeBlocksWin(&curarea->uiblocks, curarea->win);
-
- switch(G.buts->mainb) {
- case BUTS_VIEW:
- viewbuts();
- break;
- case BUTS_LAMP:
- lampbuts();
- break;
- case BUTS_MAT:
- if(ob==0) return;
- if(ob->type>=OB_LAMP) return;
-
- matbuts();
- break;
- case BUTS_TEX:
- texbuts();
- break;
- case BUTS_ANIM:
- animbuts();
- break;
- case BUTS_WORLD:
- worldbuts();
- break;
- case BUTS_RENDER:
- renderbuts();
- break;
- case BUTS_GAME:
- gamebuts();
- break;
- case BUTS_FPAINT:
- fpaintbuts();
- break;
- case BUTS_RADIO:
- radiobuts();
- break;
- case BUTS_SOUND:
- soundbuts();
- break;
- case BUTS_CONSTRAINT:
- constraintbuts();
- break;
- case BUTS_SCRIPT:
- scriptbuts();
- break;
- case BUTS_EDIT:
- if(ob==0) return;
-
- common_editbuts();
-
- id= ob->data;
- if(id && id->lib) uiSetButLock(1, "Can't edit library data");
-
- if(ob->type==OB_MESH) meshbuts();
- else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
- curvebuts();
- if(ob->type==OB_FONT) fontbuts();
- }
- else if(ob->type==OB_CAMERA) camerabuts();
- else if(ob->type==OB_MBALL) mballbuts();
- else if(ob->type==OB_LATTICE) latticebuts();
- else if(ob->type==OB_IKA) ikabuts();
-#ifdef __NLA
- else if(ob->type==OB_ARMATURE) armaturebuts();
-#endif
-
- break;
- }
-
- uiClearButLock();
-
- test_butspace();
-
- curarea->win_swap= WIN_BACK_OK;
-}
-
-
-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;
- }
-}
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
new file mode 100644
index 00000000000..f57a844d128
--- /dev/null
+++ b/source/blender/src/buttons_editing.c
@@ -0,0 +1,2057 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <time.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef WIN32
+#include "BLI_winstuff.h"
+#endif
+
+#include "MEM_guardedalloc.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
+#include "DNA_ika_types.h"
+#include "DNA_image_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_material_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_radio_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_world_types.h"
+#include "DNA_packedFile_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_library.h"
+#include "BKE_packedFile.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "BSE_filesel.h"
+
+#include "BIF_gl.h"
+#include "BIF_editarmature.h"
+#include "BIF_editconstraint.h"
+#include "BIF_editdeform.h"
+#include "BIF_editfont.h"
+#include "BIF_editmesh.h"
+#include "BIF_editsound.h"
+#include "BIF_interface.h"
+#include "BIF_mywindow.h"
+#include "BIF_renderwin.h"
+#include "BIF_resources.h"
+#include "BIF_screen.h"
+#include "BIF_scrarea.h"
+#include "BIF_space.h"
+#include "BIF_toets.h"
+#include "BIF_toolbox.h"
+#include "BIF_previewrender.h"
+#include "BIF_butspace.h"
+
+#include "interface.h"
+#include "mydevice.h"
+#include "blendef.h"
+
+#include "BKE_anim.h"
+#include "BKE_armature.h"
+#include "BKE_constraint.h"
+#include "BKE_curve.h"
+#include "BKE_displist.h"
+#include "BKE_effect.h"
+#include "BKE_font.h"
+#include "BKE_ika.h"
+#include "BKE_image.h"
+#include "BKE_ipo.h"
+#include "BKE_lattice.h"
+#include "BKE_material.h"
+#include "BKE_mball.h"
+#include "BKE_mesh.h"
+#include "BKE_object.h"
+#include "BKE_sound.h"
+#include "BKE_texture.h"
+#include "BKE_utildefines.h"
+
+#include "BDR_drawobject.h"
+#include "BDR_editcurve.h"
+#include "BDR_editface.h"
+#include "BDR_editobject.h"
+#include "BDR_vpaint.h"
+
+#include "BSE_drawview.h"
+#include "BSE_editipo.h"
+#include "BSE_edit.h"
+#include "BSE_filesel.h"
+#include "BSE_headerbuttons.h"
+#include "BSE_trans_types.h"
+#include "BSE_view.h"
+#include "BSE_buttons.h"
+#include "BSE_seqaudio.h"
+
+#include "LOD_DependKludge.h"
+#include "LOD_decimation.h"
+
+#include "butspace.h" // own module
+
+int decim_faces=0;
+short degr= 90, step= 9, turn= 1, editbutflag= 1;
+float doublimit= 0.001;
+float editbutvweight=1;
+float extr_offs= 1.0, editbutweight=1.0, editbutsize=0.1, cumapsize= 1.0;
+
+
+
+
+/* *************************** MESH DECIMATE ******************************** */
+
+/* should be removed from this c file (ton) */
+
+static int decimate_count_tria(Object *ob)
+{
+ int tottria;
+ MFace *mface;
+ Mesh *me;
+ int a;
+
+ me= ob->data;
+
+ /* count number of trias, since decimator doesnt allow quads */
+ tottria= 0;
+ mface= me->mface;
+ for(a=0; a<me->totface; a++, mface++) {
+ if(mface->v4) tottria++;
+ if(mface->v3) tottria++;
+ }
+
+ return tottria;
+}
+
+static void decimate_faces(void)
+{
+ Object *ob;
+ Mesh *me;
+ MVert *mvert;
+ MFace *mface;
+ LOD_Decimation_Info lod;
+ float *vb=NULL;
+ float *vnb=NULL;
+ int *tib=NULL;
+ int a, tottria;
+
+ /* we assume the active object being decimated */
+ ob= OBACT;
+ if(ob==NULL || ob->type!=OB_MESH) return;
+ me= ob->data;
+
+ /* add warning for vertex col and tfaces */
+ if(me->tface || me->mcol) {
+ if(okee("This will remove UV coordinates and vertexcolors")==0) return;
+ if(me->tface) MEM_freeN(me->tface);
+ if(me->mcol) MEM_freeN(me->mcol);
+ me->tface= NULL;
+ me->mcol= NULL;
+ }
+
+ /* count number of trias, since decimator doesnt allow quads */
+ tottria= decimate_count_tria(ob);
+
+ if(tottria<3) {
+ error("You must have more than 3 input faces selected.");
+ return;
+ }
+ /* allocate and init */
+ lod.vertex_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "vertices");
+ lod.vertex_normal_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "normals");
+ lod.triangle_index_buffer= MEM_mallocN(3*sizeof(int)*tottria, "trias");
+ lod.vertex_num= me->totvert;
+ lod.face_num= tottria;
+
+ /* fill vertex buffer */
+ vb= lod.vertex_buffer;
+ vnb= lod.vertex_normal_buffer;
+ mvert= me->mvert;
+ for(a=0; a<me->totvert; a++, mvert++, vb+=3, vnb+=3) {
+ VECCOPY(vb, mvert->co);
+ VECCOPY(vnb, mvert->no);
+ Normalise(vnb);
+ }
+
+ /* fill index buffer */
+ mface= me->mface;
+ tib= lod.triangle_index_buffer;
+ for(a=0; a<me->totface; a++, mface++) {
+ if(mface->v4) {
+ tib[0]= mface->v1;
+ tib[1]= mface->v3;
+ tib[2]= mface->v4;
+ tib+= 3;
+ }
+ if(mface->v3) {
+ tib[0]= mface->v1;
+ tib[1]= mface->v2;
+ tib[2]= mface->v3;
+ tib+= 3;
+ }
+ }
+
+ if(LOD_LoadMesh(&lod) ) {
+ if( LOD_PreprocessMesh(&lod) ) {
+ DispList *dl;
+ DispListMesh *dlm;
+ MFaceInt *mfaceint;
+
+ /* we assume the decim_faces tells how much to reduce */
+
+ while(lod.face_num > decim_faces) {
+ if( LOD_CollapseEdge(&lod)==0) break;
+ }
+
+ /* ok, put back the stuff in a displist */
+ freedisplist(&(ob->disp));
+ dl= MEM_callocN(sizeof(DispList), "disp");
+ BLI_addtail(&ob->disp, dl);
+ dl->type= DL_MESH;
+ dlm=dl->mesh= MEM_callocN(sizeof(DispListMesh), "dispmesh");
+ dlm->mvert= MEM_callocN(lod.vertex_num*sizeof(MVert), "mvert");
+ dlm->mface= MEM_callocN(lod.face_num*sizeof(MFaceInt), "mface");
+ dlm->totvert= lod.vertex_num;
+ dlm->totface= lod.face_num;
+
+ mvert= dlm->mvert;
+ vb= lod.vertex_buffer;
+ for(a=0; a<lod.vertex_num; a++, vb+=3, mvert++) {
+ VECCOPY(mvert->co, vb);
+ }
+
+ mfaceint= dlm->mface;
+ tib= lod.triangle_index_buffer;
+ for(a=0; a<lod.face_num; a++, mfaceint++, tib+=3) {
+ mfaceint->v1= tib[0];
+ mfaceint->v2= tib[1];
+ mfaceint->v3= tib[2];
+ }
+ }
+ else error("No memory");
+
+ LOD_FreeDecimationData(&lod);
+ }
+ else error("No manifold Mesh");
+
+ MEM_freeN(lod.vertex_buffer);
+ MEM_freeN(lod.vertex_normal_buffer);
+ MEM_freeN(lod.triangle_index_buffer);
+
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+
+
+static void decimate_cancel(void)
+{
+ Object *ob;
+
+ ob= OBACT;
+ if(ob) {
+ freedisplist(&ob->disp);
+ makeDispList(ob);
+ }
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static void decimate_apply(void)
+{
+ Object *ob;
+ DispList *dl;
+ DispListMesh *dlm;
+ Mesh *me;
+ MFace *mface;
+ MFaceInt *mfaceint;
+ int a;
+
+ if(G.obedit) return;
+
+ ob= OBACT;
+ if(ob) {
+ dl= ob->disp.first;
+ if(dl && dl->mesh) {
+ dlm= dl->mesh;
+ me= ob->data;
+
+ // vertices
+ if(me->mvert) MEM_freeN(me->mvert);
+ me->mvert= dlm->mvert;
+ dlm->mvert= NULL;
+ me->totvert= dlm->totvert;
+
+ // faces
+ if(me->mface) MEM_freeN(me->mface);
+ me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface");
+ me->totface= dlm->totface;
+ mface= me->mface;
+ mfaceint= dlm->mface;
+ for(a=0; a<me->totface; a++, mface++, mfaceint++) {
+ mface->v1= mfaceint->v1;
+ mface->v2= mfaceint->v2;
+ mface->v3= mfaceint->v3;
+ test_index_mface(mface, 3);
+ }
+
+ freedisplist(&ob->disp);
+
+ G.obedit= ob;
+ make_editMesh();
+ load_editMesh();
+ free_editMesh();
+ G.obedit= NULL;
+ tex_space_mesh(me);
+ }
+ else error("Not a decimated Mesh");
+ }
+}
+
+/* *************************** MESH ******************************** */
+
+
+static void editing_panel_mesh_type(Object *ob, Mesh *me)
+{
+ uiBlock *block;
+ float val;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if( uiNewPanel(curarea, block, "Mesh", "Editing", 320, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,178,130,17, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_DIFF, "Degr:", 10,156,130,17, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf", 10,124,130,17, &me->flag, 0, 0, 0, 0, "Treats the active object as a Catmull-Clark Subdivision Surface");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:", 10,104,100,18, &me->subdiv, 0, 12, 0, 0, "Defines the level of subdivision to display in real time interactively");
+ uiDefButS(block, NUM, B_MAKEDISP, "", 110, 104, 30, 18, &me->subdivr, 0, 12, 0, 0, "Defines the level of subdivision to apply during rendering");
+
+ uiBlockSetCol(block, BUTSALMON);
+
+ if(me->msticky) val= 1.0; else val= 0.0;
+ uiDefBut(block, LABEL, 0, "Sticky", 10,57,70,20, 0, val, 0, 0, 0, "");
+ if(me->msticky==0) {
+ uiDefBut(block, BUT, B_MAKESTICKY, "Make", 60,59,63,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
+ }
+ else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 60,59,63,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
+
+ if(me->mcol) val= 1.0; else val= 0.0;
+ uiDefBut(block, LABEL, 0, "VertCol", 10,34,70,20, 0, val, 0, 0, 0, "");
+ if(me->mcol==0) {
+ uiDefBut(block, BUT, B_MAKEVERTCOL, "Make", 60,36,64,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
+ }
+ else uiDefBut(block, BUT, B_DELVERTCOL, "Delete", 60,36,64,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
+
+ if(me->tface) val= 1.0; else val= 0.0;
+ uiDefBut(block, LABEL, 0, "TexFace", 10,14,70,20, 0, val, 0, 0, 0, "");
+ if(me->tface==0) {
+ uiDefBut(block, BUT, B_MAKE_TFACES, "Make", 60,15,64,20, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
+ }
+ else uiDefBut(block, BUT, B_DEL_TFACES, "Delete", 60,15,64,20, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
+
+
+ /* decimator */
+ if(G.obedit==NULL) {
+ int tottria= decimate_count_tria(ob);
+ DispList *dl;
+
+ // wacko, wait for new displist system (ton)
+ if( (dl=ob->disp.first) && dl->mesh);
+ else decim_faces= tottria;
+
+ uiBlockSetCol(block, BUTPURPLE);
+ uiDefButI(block, NUMSLI,B_DECIM_FACES, "Decimator: ", 173,176,233,19, &decim_faces, 4.0, tottria, 10, 10, "Defines the number of triangular faces to decimate the active Mesh object to");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_DECIM_CANCEL, "Cancel", 290,156,116,18, 0, 0, 0, 0, 0, "Restores the Mesh to its original number of faces");
+ uiDefBut(block, BUT,B_DECIM_APPLY, "Apply", 173,156,115,18, 0, 0, 0, 0, 0, "Applies the decimation to the active Mesh object");
+ }
+
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefIDPoinBut(block, test_meshpoin_but, 0, "TexMesh: ", 174,120,234,19, &me->texcomesh, "Enter the name of a Meshblock");
+
+ if(me->key) {
+ uiDefButS(block, NUM, B_DIFF, "Slurph:", 174,75,100,19, &(me->key->slurph), -500.0, 500.0, 0, 0, "");
+ uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 174,55,100,19, &me->key->type, 0, 0, 0, 0, "");
+ }
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_SLOWERDRAW,"SlowerDraw", 174,35,100,19, 0, 0, 0, 0, 0, "Displays the active object with all possible edges shown");
+ uiDefBut(block, BUT, B_FASTERDRAW,"FasterDraw", 175,15,100,19, 0, 0, 0, 0, 0, "Displays the active object faster by omitting some edges when drawing");
+
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_DOCENTRE, "Centre", 275, 95, 133, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
+ uiDefBut(block, BUT,B_DOCENTRENEW, "Centre New", 275, 75, 133, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data");
+ uiDefBut(block, BUT,B_DOCENTRECURSOR, "Centre Cursor", 275, 55, 133, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|2, REDRAWVIEW3D, "Double Sided", 275,35,133,19, &me->flag, 0, 0, 0, 0, "Toggles selected faces as doublesided or single-sided");
+ uiDefButS(block, TOG|BIT|1, REDRAWVIEW3D, "No V.Normal Flip",275,15,133,19, &me->flag, 0, 0, 0, 0, "Disables flipping of vertexnormals during render");
+
+}
+
+
+
+/* *************************** FONT ******************************** */
+
+static short give_vfontnr(VFont *vfont)
+{
+ VFont *vf;
+ short nr= 1;
+
+ vf= G.main->vfont.first;
+ while(vf) {
+ if(vf==vfont) return nr;
+ nr++;
+ vf= vf->id.next;
+ }
+ return -1;
+}
+
+static VFont *give_vfontpointer(int nr) /* nr= button */
+{
+ VFont *vf;
+ short tel= 1;
+
+ vf= G.main->vfont.first;
+ while(vf) {
+ if(tel==nr) return vf;
+ tel++;
+ vf= vf->id.next;
+ }
+ return G.main->vfont.first;
+}
+
+static VFont *exist_vfont(char *str)
+{
+ VFont *vf;
+
+ vf= G.main->vfont.first;
+ while(vf) {
+ if(strcmp(vf->name, str)==0) return vf;
+ vf= vf->id.next;
+ }
+ return 0;
+}
+
+static char *give_vfontbutstr(void)
+{
+ VFont *vf;
+ int len= 0;
+ char *str, di[FILE_MAXDIR], fi[FILE_MAXFILE];
+
+ vf= G.main->vfont.first;
+ while(vf) {
+ strcpy(di, vf->name);
+ BLI_splitdirstring(di, fi);
+ len+= strlen(fi)+4;
+ vf= vf->id.next;
+ }
+
+ str= MEM_callocN(len+21, "vfontbutstr");
+ strcpy(str, "FONTS %t");
+ vf= G.main->vfont.first;
+ while(vf) {
+
+ if(vf->id.us==0) strcat(str, "|0 ");
+ else strcat(str, "| ");
+
+ strcpy(di, vf->name);
+ BLI_splitdirstring(di, fi);
+
+ strcat(str, fi);
+ vf= vf->id.next;
+ }
+ return str;
+}
+
+static void load_buts_vfont(char *name)
+{
+ VFont *vf;
+ Curve *cu;
+
+ if(OBACT && OBACT->type==OB_FONT) cu= OBACT->data;
+ else return;
+
+ vf= exist_vfont(name);
+ if(vf==0) {
+ vf= load_vfont(name);
+ if(vf==0) return;
+ }
+ else id_us_plus((ID *)vf);
+
+ if(cu->vfont) cu->vfont->id.us--;
+ cu->vfont= vf;
+
+ text_to_curve(OBACT, 0);
+ makeDispList(OBACT);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+}
+
+void do_fontbuts(unsigned short event)
+{
+ Curve *cu;
+ VFont *vf;
+ Object *ob;
+ ScrArea *sa;
+ char str[80];
+
+ ob= OBACT;
+
+ switch(event) {
+ case B_MAKEFONT:
+ text_to_curve(ob, 0);
+ makeDispList(ob);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_TOUPPER:
+ to_upper();
+ break;
+ case B_LOADFONT:
+ vf= give_vfontpointer(G.buts->texnr);
+ if(vf && vf->id.prev!=vf->id.next) strcpy(str, vf->name);
+ else strcpy(str, U.fontdir);
+
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+
+ activate_fileselect(FILE_SPECIAL, "SELECT FONT", str, load_buts_vfont);
+
+ break;
+ case B_PACKFONT:
+ if (ob) {
+ cu= ob->data;
+ if(cu && cu->vfont) {
+ if (cu->vfont->packedfile) {
+ if (G.fileflags & G_AUTOPACK) {
+ if (okee("Disable AutoPack ?")) {
+ G.fileflags &= ~G_AUTOPACK;
+ }
+ }
+
+ if ((G.fileflags & G_AUTOPACK) == 0) {
+ if (unpackVFont(cu->vfont, PF_ASK) == RET_OK) {
+ text_to_curve(ob, 0);
+ makeDispList(ob);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ }
+ } else {
+ cu->vfont->packedfile = newPackedFile(cu->vfont->name);
+ }
+ }
+ }
+ allqueue(REDRAWHEADERS, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ break;
+
+ case B_SETFONT:
+ if(ob) {
+ cu= ob->data;
+
+ vf= give_vfontpointer(G.buts->texnr);
+ if(vf) {
+ id_us_plus((ID *)vf);
+ cu->vfont->id.us--;
+ cu->vfont= vf;
+ text_to_curve(ob, 0);
+ makeDispList(ob);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ }
+ break;
+ case B_TEXTONCURVE:
+ if(ob) {
+ cu= ob->data;
+ if(cu->textoncurve && cu->textoncurve->type!=OB_CURVE) {
+ error("Only Curve Objects");
+ cu->textoncurve= 0;
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ text_to_curve(ob, 0);
+ makeDispList(ob);
+ }
+ }
+}
+
+
+
+static void editing_panel_font_type(Object *ob, Curve *cu)
+{
+ uiBlock *block;
+ char *strp;
+ static int packdummy = 0;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_font_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Font", "Editing", 640, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW,B_MAKEFONT, "Left", 484,139,53,18, &cu->spacemode, 0.0,0.0, 0, 0, "");
+ uiDefButS(block, ROW,B_MAKEFONT, "Middle", 604,139,61,18, &cu->spacemode, 0.0,1.0, 0, 0, "");
+ uiDefButS(block, ROW,B_MAKEFONT, "Right", 540,139,62,18, &cu->spacemode, 0.0,2.0, 0, 0, "");
+ uiDefButS(block, ROW,B_MAKEFONT, "Flush", 665,139,61,18, &cu->spacemode, 0.0,3.0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREY);
+
+ uiDefIDPoinBut(block, test_obpoin_but, B_TEXTONCURVE, "TextOnCurve:", 484,115,243,19, &cu->textoncurve, "");
+ uiDefBut(block, TEX,REDRAWVIEW3D, "Ob Family:", 484,85,243,19, cu->family, 0.0, 20.0, 0, 0, "");
+
+ uiDefButF(block, NUM,B_MAKEFONT, "Size:", 482,56,121,19, &cu->fsize, 0.1,10.0, 10, 0, "");
+ uiDefButF(block, NUM,B_MAKEFONT, "Linedist:", 605,56,121,19, &cu->linedist, 0.0,10.0, 10, 0, "");
+ uiDefButF(block, NUM,B_MAKEFONT, "Spacing:", 482,34,121,19, &cu->spacing, 0.0,10.0, 10, 0, "");
+ uiDefButF(block, NUM,B_MAKEFONT, "Y offset:", 605,34,121,19, &cu->yof, -50.0,50.0, 10, 0, "");
+ uiDefButF(block, NUM,B_MAKEFONT, "Shear:", 482,12,121,19, &cu->shear, -1.0,1.0, 10, 0, "");
+ uiDefButF(block, NUM,B_MAKEFONT, "X offset:", 605,12,121,19, &cu->xof, -50.0,50.0, 10, 0, "");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_TOUPPER, "ToUpper", 623,163,103,23, 0, 0, 0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREY);
+
+ G.buts->texnr= give_vfontnr(cu->vfont);
+
+ strp= give_vfontbutstr();
+
+ uiDefButS(block, MENU, B_SETFONT, strp, 484,191,220,20, &G.buts->texnr, 0, 0, 0, 0, "");
+
+ if (cu->vfont->packedfile) {
+ packdummy = 1;
+ } else {
+ packdummy = 0;
+ }
+
+ uiBlockSetCol(block, BUTYELLOW);
+ uiDefIconButI(block, TOG|BIT|0, B_PACKFONT, ICON_PACKAGE, 706,191,20,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Vectorfont");
+
+ MEM_freeN(strp);
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_LOADFONT, "Load Font", 484,163,103,23, 0, 0, 0, 0, 0, "");
+
+}
+
+/* *************************** CURVE ******************************** */
+
+
+void do_curvebuts(unsigned short event)
+{
+ extern Nurb *lastnu;
+ extern ListBase editNurb; /* from editcurve */
+ Object *ob;
+ Curve *cu;
+ Nurb *nu;
+
+ ob= OBACT;
+ if(ob==0) return;
+
+ switch(event) {
+
+ case B_CONVERTPOLY:
+ case B_CONVERTBEZ:
+ case B_CONVERTBSPL:
+ case B_CONVERTCARD:
+ case B_CONVERTNURB:
+ if(G.obedit) {
+ setsplinetype(event-B_CONVERTPOLY);
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ break;
+ case B_UNIFU:
+ case B_ENDPU:
+ case B_BEZU:
+ case B_UNIFV:
+ case B_ENDPV:
+ case B_BEZV:
+ if(G.obedit) {
+ nu= editNurb.first;
+ while(nu) {
+ if(isNurbsel(nu)) {
+ if((nu->type & 7)==CU_NURBS) {
+ if(event<B_UNIFV) {
+ nu->flagu &= 1;
+ nu->flagu += ((event-B_UNIFU)<<1);
+ makeknots(nu, 1, nu->flagu>>1);
+ }
+ else if(nu->pntsv>1) {
+ nu->flagv &= 1;
+ nu->flagv += ((event-B_UNIFV)<<1);
+ makeknots(nu, 2, nu->flagv>>1);
+ }
+ }
+ }
+ nu= nu->next;
+ }
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ break;
+ case B_SETWEIGHT:
+ if(G.obedit) {
+ weightflagNurb(1, editbutweight, 0);
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ break;
+ case B_SETW1:
+ editbutweight= 1.0;
+ scrarea_queue_winredraw(curarea);
+ break;
+ case B_SETW2:
+ editbutweight= sqrt(2.0)/4.0;
+ scrarea_queue_winredraw(curarea);
+ break;
+ case B_SETW3:
+ editbutweight= 0.25;
+ scrarea_queue_winredraw(curarea);
+ break;
+ case B_SETW4:
+ editbutweight= sqrt(0.5);
+ scrarea_queue_winredraw(curarea);
+ break;
+ case B_SETORDER:
+ if(G.obedit) {
+ nu= lastnu;
+ if(nu && (nu->type & 7)==CU_NURBS ) {
+ if(nu->orderu>nu->pntsu) {
+ nu->orderu= nu->pntsu;
+ scrarea_queue_winredraw(curarea);
+ }
+ makeknots(nu, 1, nu->flagu>>1);
+ if(nu->orderv>nu->pntsv) {
+ nu->orderv= nu->pntsv;
+ scrarea_queue_winredraw(curarea);
+ }
+ makeknots(nu, 2, nu->flagv>>1);
+ }
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ break;
+ case B_MAKEDISP:
+ if(ob->type==OB_FONT) text_to_curve(ob, 0);
+ makeDispList(ob);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
+ break;
+
+ case B_SUBDIVCURVE:
+ subdivideNurb();
+ break;
+ case B_SPINNURB:
+ /* bad bad bad!!! use brackets!!! In case you wondered:
+ {==,!=} goes before & goes before || */
+ if( (G.obedit==0) ||
+ (G.obedit->type!=OB_SURF) ||
+ ((G.obedit->lay & G.vd->lay) == 0) ) return;
+ spinNurb(0, 0);
+ countall();
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_CU3D: /* allow 3D curve */
+ if(G.obedit) {
+ cu= G.obedit->data;
+ nu= editNurb.first;
+ while(nu) {
+ nu->type &= ~CU_2D;
+ if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
+ test2DNurb(nu);
+ nu= nu->next;
+ }
+ }
+ if(ob->type==OB_CURVE) {
+ cu= ob->data;
+ nu= cu->nurb.first;
+ while(nu) {
+ nu->type &= ~CU_2D;
+ if((cu->flag & CU_3D)==0) nu->type |= CU_2D;
+ test2DNurb(nu);
+ nu= nu->next;
+ }
+ }
+ break;
+ case B_SETRESOLU:
+ if(ob->type==OB_CURVE) {
+ cu= ob->data;
+ if(ob==G.obedit) nu= editNurb.first;
+ else nu= cu->nurb.first;
+
+ while(nu) {
+ nu->resolu= cu->resolu;
+ nu= nu->next;
+ }
+ }
+ else if(ob->type==OB_FONT) text_to_curve(ob, 0);
+
+ makeDispList(ob);
+ allqueue(REDRAWVIEW3D, 0);
+
+ break;
+ }
+}
+
+static void editing_panel_curve_tools(Object *ob, Curve *cu)
+{
+ Nurb *nu;
+ extern ListBase editNurb; /* from editcurve */
+ extern Nurb *lastnu;
+ uiBlock *block;
+ short *sp;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Curve Tools", "Editing", 640, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTSALMON);
+ if(ob->type==OB_CURVE) {
+ uiDefBut(block, LABEL, 0, "Convert", 463,173,72, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 467,152,72, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 467,132,72, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_CONVERTBSPL,"Bspline", 467,112,72, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_CONVERTCARD,"Cardinal", 467,92,72, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 467,72,72, 18, 0, 0, 0, 0, 0, "");
+ }
+ uiDefBut(block, LABEL, 0, "Make Knots",562,173,102, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_UNIFU,"Uniform U", 565,152,102, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_ENDPU,"Endpoint U", 565,132,102, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_BEZU,"Bezier U", 565,112,102, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_UNIFV,"V", 670,152,50, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_ENDPV,"V", 670,132,50, 18, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_BEZV,"V", 670,112,50, 18, 0, 0, 0, 0, 0, "");
+
+ uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 465,11,95,49, 0, 0, 0, 0, 0, "");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM,0,"Weight:", 564,36,102,22, &editbutweight, 0.01, 10.0, 10, 0, "");
+ uiDefBut(block, BUT,B_SETW1,"1.0", 669,36,50,22, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4",564,11,57,20, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_SETW3,"0.25", 621,11,43,20, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, BUT,B_SETW4,"sqrt(0.5)",664,11,57,20, 0, 0, 0, 0, 0, "");
+
+ if(ob==G.obedit) {
+ nu= lastnu;
+ if(nu==NULL) nu= editNurb.first;
+ if(nu) {
+ sp= &(nu->orderu);
+ uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,91,102, 18, sp, 2.0, 6.0, 0, 0, "");
+ sp= &(nu->orderv);
+ uiDefButS(block, NUM, B_SETORDER, "V:", 670,91,50, 18, sp, 2.0, 6.0, 0, 0, "");
+ sp= &(nu->resolu);
+ uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 18, sp, 1.0, 128.0, 0, 0, "");
+ sp= &(nu->resolv);
+ uiDefButS(block, NUM, B_MAKEDISP, "V:", 670,70,50, 18, sp, 1.0, 128.0, 0, 0, "");
+ }
+ }
+
+
+}
+
+static void editing_panel_curve_tools1(Object *ob, Curve *cu)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools1", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Curve Tools1", "Editing", 960, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTSALMON);
+
+ uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "");
+ if(ob->type==OB_SURF) {
+ uiDefBut(block, BUT, B_SPINNURB, "Spin", 400,160,150,20, 0, 0, 0, 0, 0, "");
+ }
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, BUT,B_HIDE, "Hide", 400,120,150,18, 0, 0, 0, 0, 0, "Hides selected faces");
+ uiDefBut(block, BUT,B_REVEAL, "Reveal", 400,100,150,18, 0, 0, 0, 0, 0, "Reveals selected faces");
+ uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 400,80,150,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
+
+ uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &editbutsize, 0.001, 1.0, 10, 0, "");
+}
+
+/* for curve, surf and font! */
+static void editing_panel_curve_type(Object *ob, Curve *cu)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Curve and Surface", "Editing", 320, 0, 318, 204)==0) return;
+
+ uiDefButS(block, TOG|BIT|5, 0, "UV Orco", 543,160,130,18, &cu->flag, 0, 0, 0, 0, "");
+ if(ob->type==OB_SURF)
+ uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip", 543,140,130,18, &cu->flag, 0, 0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_DOCENTRE, "Centre", 543, 115, 140, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
+ uiDefBut(block, BUT,B_DOCENTRENEW, "Centre New", 543, 95, 140, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data");
+ uiDefBut(block, BUT,B_DOCENTRECURSOR, "Centre Cursor", 543, 75, 140, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location");
+
+ if(ob->type==OB_SURF) {
+ if(cu->key) {
+ uiBlockSetCol(block, BUTGREEN);
+ /* uiDefButS(block, NUM, B_DIFF, "Slurph:", 543,25,140,19, &(cu->key->slurph), -500.0, 500.0,0,0); ,""*/
+ uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 543,45,140,19, &cu->key->type, 0, 0, 0, 0, "");
+ }
+ }
+
+ if(ob->type!=OB_SURF) {
+
+ if(ob->type==OB_CURVE) {
+ static float prlen;
+ char str[32];
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_RECALCPATH, "PathLen:", 543,50,140,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath", 543,30,70,19 , &cu->flag, 0, 0, 0, 0, "");
+ uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow",613,30,70,19, &cu->flag, 0, 0, 0, 0, "");
+ uiBlockSetCol(block, BUTGREY);
+ sprintf(str, "%.4f", prlen);
+ uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 543,10,70,19, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, str, 613,10,70,19, 0, 1.0, 0, 0, 0, "");
+ }
+ uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 752,163,132,21, &cu->resolu, 1.0, 128.0, 0, 0, "");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_SETRESOLU, "Set", 887,163,29,21, 0, 0, 0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_MAKEDISP, "BevResol:", 753,30,163,18, &cu->bevresol, 0.0, 10.0, 0, 0, "");
+
+ uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:", 753,10,163,18, &cu->bevobj, "");
+ uiDefButF(block, NUM, B_MAKEDISP, "Width:", 753,90,163,18, &cu->width, 0.0, 2.0, 1, 0, "");
+ uiDefButF(block, NUM, B_MAKEDISP, "Ext1:", 753,70,163,18, &cu->ext1, 0.0, 5.0, 10, 0, "");
+ uiDefButF(block, NUM, B_MAKEDISP, "Ext2:", 753,50,163,18, &cu->ext2, 0.0, 2.0, 1, 0, "");
+ uiBlockSetCol(block, BUTBLUE);
+
+ uiDefButS(block, TOG|BIT|0, B_CU3D, "3D", 867,130,47,18, &cu->flag, 0, 0, 0, 0, "");
+ uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front", 810,130,55,18, &cu->flag, 0, 0, 0, 0, "");
+ uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 753,130,53,18, &cu->flag, 0, 0, 0, 0, "");
+
+
+ }
+
+}
+
+
+/* *************************** CAMERA ******************************** */
+
+
+static void editing_panel_camera_type(Object *ob, Camera *cam)
+{
+ uiBlock *block;
+ float grid=0.0;
+
+ if(G.vd) grid= G.vd->grid;
+ if(grid<1.0) grid= 1.0;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
+
+
+ uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
+ uiDefButF(block, NUM,REDRAWVIEW3D, "ClipSta:", 470,147,160,20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view");
+ uiDefButF(block, NUM,REDRAWVIEW3D, "ClipEnd:", 470,125,160,20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view");
+ uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,49,61,40, &cam->type, 0, 0, 0, 0, "Render orthogonally");
+
+ uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,69,97,20, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
+ uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist", 533,49,97,20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
+
+ if(G.special1 & G_HOLO) {
+ uiBlockSetCol(block, BUTGREY);
+ if(cam->netend==0.0) cam->netend= EFRA;
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Anim len", 670,80,100,20, &cam->netend, 1.0, 2500.0, 0, 0, "");
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Path len:", 670,160,100,20, &cam->hololen, 0.1, 25.0, 10, 0, "");
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Shear fac:", 670,140,100,20, &cam->hololen1, 0.1, 5.0, 10, 0, "");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Holo 1", 670,120,100,20, &cam->flag, 0.0, 0.0, 0, 0, "");
+ uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Holo 2", 670,100,100,20, &cam->flag, 0.0, 0.0, 0, 0, "");
+
+ }
+
+}
+
+/* *************************** MBALL ******************************** */
+
+void do_mballbuts(unsigned short event)
+{
+ switch(event) {
+ case B_RECALCMBALL:
+ makeDispList(OBACT);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ }
+}
+
+static void editing_panel_mball_type(Object *ob, MetaBall *mb)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mball_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "MetaBall", "Editing", 320, 0, 318, 204)==0) return;
+
+ if (ob==find_basis_mball(ob)) {
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 0, 0, "");
+ uiDefButF(block, NUMSLI, 0, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 0, 0, "");
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTBLUE);
+ uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, "");
+ uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "");
+ uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "");
+ uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "");
+ uiBlockSetCol(block, BUTGREY);
+ }
+
+}
+
+static void editing_panel_mball_tools(Object *ob, MetaBall *mb)
+{
+ extern MetaElem *lastelem;
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mball_tools", UI_EMBOSSX, UI_HELV, curarea->win);
+ if( uiNewPanel(curarea, block, "MetaBall tools", "Editing", 640, 0, 318, 204)==0) return;
+
+ if(ob==G.obedit && lastelem) {
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, "");
+ if(lastelem->type!=MB_BALL)
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, "");
+ if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, "");
+
+ if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
+ uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, "");
+
+ uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "");
+ uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "");
+ uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "");
+ uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "");
+ uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "");
+ }
+
+}
+
+
+/* *************************** LATTICE ******************************** */
+
+void do_latticebuts(unsigned short event)
+{
+ Object *ob;
+ Lattice *lt;
+
+ ob= OBACT;
+ if(ob->type!=OB_LATTICE) return;
+
+ switch(event) {
+ case B_RESIZELAT:
+ if(ob) {
+ if(ob==G.obedit) resizelattice(editLatt);
+ else resizelattice(ob->data);
+ }
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_DRAWLAT:
+ if(ob==G.obedit) calc_lattverts_ext();
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_LATTCHANGED:
+
+ lt= ob->data;
+ if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
+
+ make_displists_by_parent(ob);
+
+ allqueue(REDRAWVIEW3D, 0);
+
+ break;
+ }
+}
+
+static void editing_panel_lattice_type(Object *ob, Lattice *lt)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_lattice_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Latice", "Editing", 320, 0, 318, 204)==0) return;
+
+
+ uiSetButLock(lt->key!=0, "Not with VertexKeys");
+ uiSetButLock(ob==G.obedit, "Unable to perform function in EditMode");
+ uiDefButS(block, NUM, B_RESIZELAT, "U:", 470,178,100,19, &lt->pntsu, 1.0, 64.0, 0, 0, "");
+ uiDefButS(block, NUM, B_RESIZELAT, "V:", 470,158,100,19, &lt->pntsv, 1.0, 64.0, 0, 0, "");
+ uiDefButS(block, NUM, B_RESIZELAT, "W:", 470,138,100,19, &lt->pntsw, 1.0, 64.0, 0, 0, "");
+ uiClearButLock();
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_LINEAR, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_BSPLINE, 0, 0, "");
+
+ uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 158, 40, 19, &lt->typev, 2.0, (float)KEY_LINEAR, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 158, 40, 19, &lt->typev, 2.0, (float)KEY_CARDINAL, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 158, 40, 19, &lt->typev, 2.0, (float)KEY_BSPLINE, 0, 0, "");
+
+ uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 138, 40, 19, &lt->typew, 3.0, (float)KEY_LINEAR, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 138, 40, 19, &lt->typew, 3.0, (float)KEY_CARDINAL, 0, 0, "");
+ uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 138, 40, 19, &lt->typew, 3.0, (float)KEY_BSPLINE, 0, 0, "");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_RESIZELAT, "Make Regular", 470,101,99,32, 0, 0, 0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|1, B_LATTCHANGED, "Outside", 571,101,120,31, &lt->flag, 0, 0, 0, 0, "");
+
+ if(lt->key) {
+ uiDefButS(block, NUM, B_DIFF, "Slurph:", 470,60,120,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, "");
+ uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 470,40,120,19, &lt->key->type, 0, 0, 0, 0, "");
+ }
+
+}
+
+/* *************************** ARMATURE ******************************** */
+
+
+
+static int editbone_to_parnr (EditBone *bone)
+{
+ EditBone *ebone;
+ int index;
+
+ for (ebone=G.edbo.first, index=0; ebone; ebone=ebone->next, index++){
+ if (ebone==bone)
+ return index;
+ }
+
+ return -1;
+}
+
+
+
+static void attach_bone_to_parent(EditBone *bone)
+{
+ EditBone *curbone;
+
+ if (bone->flag & BONE_IK_TOPARENT) {
+
+ /* See if there are any other bones that refer to the same parent and disconnect them */
+ for (curbone = G.edbo.first; curbone; curbone=curbone->next){
+ if (curbone!=bone){
+ if (curbone->parent && (curbone->parent == bone->parent) && (curbone->flag & BONE_IK_TOPARENT))
+ curbone->flag &= ~BONE_IK_TOPARENT;
+ }
+ }
+
+ /* Attach this bone to its parent */
+ VECCOPY(bone->head, bone->parent->tail);
+ }
+
+}
+
+static void attach_bone_to_parent_cb(void *bonev, void *arg2_unused)
+{
+ EditBone *curBone= bonev;
+ attach_bone_to_parent(curBone);
+}
+
+static void parnr_to_editbone(EditBone *bone)
+{
+ if (bone->parNr == -1){
+ bone->parent = NULL;
+ bone->flag &= ~BONE_IK_TOPARENT;
+ }
+ else{
+ bone->parent = BLI_findlink(&G.edbo, bone->parNr);
+ attach_bone_to_parent(bone);
+ }
+}
+
+static void parnr_to_editbone_cb(void *bonev, void *arg2_unused)
+{
+ EditBone *curBone= bonev;
+ parnr_to_editbone(curBone);
+}
+
+
+static void build_bonestring (char *string, EditBone *bone){
+ EditBone *curBone;
+ EditBone *pBone;
+ int skip=0;
+ int index;
+
+ sprintf (string, "Parent%%t| %%x%d", -1); /* That space is there for a reason */
+
+ for (curBone = G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
+ /* Make sure this is a valid child */
+ if (curBone != bone){
+ skip=0;
+ for (pBone=curBone->parent; pBone; pBone=pBone->parent){
+ if (pBone==bone){
+ skip=1;
+ break;
+ }
+ }
+
+ if (skip)
+ continue;
+
+ sprintf (string, "%s|%s%%x%d", string, curBone->name, index);
+ }
+ }
+}
+
+static void validate_editbonebutton(EditBone *eBone){
+ EditBone *prev;
+ bAction *act=NULL;
+ bActionChannel *chan;
+ Base *base;
+
+ /* Separate the bone from the G.edbo */
+ prev=eBone->prev;
+ BLI_remlink (&G.edbo, eBone);
+
+ /* Validate the name */
+ unique_editbone_name (eBone->name);
+
+ /* Re-insert the bone */
+ if (prev)
+ BLI_insertlink(&G.edbo, prev, eBone);
+ else
+ BLI_addhead (&G.edbo, eBone);
+
+ /* Rename channel if necessary */
+ if (G.obedit)
+ act = G.obedit->action;
+
+ if (act && !act->id.lib){
+ // Find the appropriate channel
+ for (chan = act->chanbase.first; chan; chan=chan->next){
+ if (!strcmp (chan->name, eBone->oldname)){
+ strcpy (chan->name, eBone->name);
+ }
+ }
+ allqueue(REDRAWACTION, 0);
+ }
+
+ /* Update the parenting info of any users */
+ /* Yes, I know this is the worst thing you have ever seen. */
+
+ for (base = G.scene->base.first; base; base=base->next){
+ Object *ob = base->object;
+
+ /* See if an object is parented to this armature */
+ if (ob->parent && ob->partype==PARBONE && (ob->parent->type==OB_ARMATURE) && (ob->parent->data == G.obedit->data)){
+ if (!strcmp(ob->parsubstr, eBone->oldname))
+ strcpy(ob->parsubstr, eBone->name);
+ }
+ }
+
+ exit_editmode(0); /* To ensure new names make it to the edit armature */
+
+}
+
+static void validate_editbonebutton_cb(void *bonev, void *arg2_unused)
+{
+ EditBone *curBone= bonev;
+ validate_editbonebutton(curBone);
+}
+
+
+static void editing_panel_armature_type(Object *ob, bArmature *arm)
+{
+ uiBlock *block;
+ int bx=148, by=100;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_armature_type", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Armature", "Editing", 320, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButI(block, TOG|BIT|ARM_RESTPOSBIT,REDRAWVIEW3D, "Rest Pos", bx,by,97,20, &arm->flag, 0, 0, 0, 0, "Disable all animation for this object");
+ uiDefButI(block, TOG|BIT|ARM_DRAWAXESBIT,REDRAWVIEW3D, "Draw Axes", bx,by-46,97,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
+ uiDefButI(block, TOG|BIT|ARM_DRAWNAMESBIT,REDRAWVIEW3D, "Draw Names", bx,by-69,97,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
+ uiDefButI(block, TOG|BIT|ARM_DRAWXRAYBIT,REDRAWVIEW3D, "X-Ray", bx,by-92,97,20, &arm->flag, 0, 0, 0, 0, "Draw armature in front of shaded objects");
+
+
+
+}
+
+static void editing_panel_armature_bones(Object *ob, bArmature *arm)
+{
+ uiBlock *block;
+ EditBone *curBone;
+ uiBut *but;
+ char *boneString=NULL;
+ int bx=148, by=180;
+ int index;
+
+ /* Draw the bone name block */
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_armature_bones", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Armature Bones", "Editing", 640, 0, 318, 204)==0) return;
+
+ /* this is a variable height panel, newpanel doesnt force new size on existing panels */
+ /* so first we make it default height */
+ uiNewPanelHeight(block, 204);
+
+
+ uiDefBut(block, LABEL, 0, "Selected Bones", bx,by,158,18, 0, 0, 0, 0, 0, "");
+ by-=20;
+ for (curBone=G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
+ if (curBone->flag & (BONE_SELECTED)) {
+
+ /* Hide in posemode flag */
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButI(block, TOG|BIT|BONE_HIDDENBIT, REDRAWVIEW3D, "Hide", bx-55,by,45,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in posemode");
+
+ /* Bone naming button */
+ uiBlockSetCol(block, BUTGREY);
+ strcpy (curBone->oldname, curBone->name);
+ but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", bx-10,by,117,18, &curBone->name, 0, 24, 0, 0, "Change the bone name");
+ uiButSetFunc(but, validate_editbonebutton_cb, curBone, NULL);
+
+ uiDefBut(block, LABEL, 0, "child of", bx+107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
+
+ boneString = malloc((BLI_countlist(&G.edbo) * 64)+64);
+ build_bonestring (boneString, curBone);
+
+ curBone->parNr = editbone_to_parnr(curBone->parent);
+ but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, bx+180,by,120,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent");
+ uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL);
+
+ free(boneString);
+
+ /* IK to parent flag */
+ if (curBone->parent){
+ uiBlockSetCol(block, BUTGREEN);
+ but=uiDefButI(block, TOG|BIT|BONE_IK_TOPARENTBIT, REDRAWVIEW3D, "IK", bx+300,by,32,18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "IK link to parent");
+ uiButSetFunc(but, attach_bone_to_parent_cb, curBone, NULL);
+ }
+
+ /* Dist and weight buttons */
+ uiBlockSetCol(block, BUTGREY);
+ but=uiDefButS(block, MENU, REDRAWVIEW3D,
+ "Skinnable %x0|"
+ "Unskinnable %x1|"
+ "Head %x2|"
+ "Neck %x3|"
+ "Back %x4|"
+ "Shoulder %x5|"
+ "Arm %x6|"
+ "Hand %x7|"
+ "Finger %x8|"
+ "Thumb %x9|"
+ "Pelvis %x10|"
+ "Leg %x11|"
+ "Foot %x12|"
+ "Toe %x13|"
+ "Tentacle %x14",
+ bx-10,by-19,117,18,
+ &curBone->boneclass,
+ 0.0, 0.0, 0.0, 0.0,
+ "Classification of armature element");
+
+ /* Dist and weight buttons */
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM,REDRAWVIEW3D, "Dist:", bx+110, by-19,
+ 105, 18, &curBone->dist, 0.0, 1000.0, 10.0, 0.0,
+ "Bone deformation distance");
+ uiDefButF(block, NUM,REDRAWVIEW3D, "Weight:", bx+223, by-19,
+ 110, 18, &curBone->weight, 0.0F, 1000.0F,
+ 10.0F, 0.0F, "Bone deformation weight");
+
+ by-=42;
+ }
+ }
+
+ if(by<0) {
+ uiNewPanelHeight(block, 204 - by);
+ }
+
+}
+
+
+/* *************************** MESH ******************************** */
+
+
+
+void do_meshbuts(unsigned short event)
+{
+ void decimate_faces(void);
+ void decimate_cancel(void);
+ void decimate_apply(void);
+ Object *ob;
+ Mesh *me;
+ float fac;
+ short randfac;
+
+ ob= OBACT;
+ if(ob && ob->type==OB_MESH) {
+
+ me= get_mesh(ob);
+ if(me==0) return;
+
+ switch(event) {
+ case B_AUTOVGROUP:
+ if (!get_armature(ob->parent)){
+ error ("Mesh must be the child of an armature");
+ break;
+ }
+ /* Verify that there are vertex groups for bones in armature */
+ /* Remove selected vertices from all defgroups */
+ /* Perform assignment for selected vertices */
+
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_NEWVGROUP:
+ add_defgroup (G.obedit);
+ scrarea_queue_winredraw(curarea);
+ break;
+ case B_DELVGROUP:
+ del_defgroup (G.obedit);
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_ASSIGNVGROUP:
+ assign_verts_defgroup ();
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_REMOVEVGROUP:
+ remove_verts_defgroup (0);
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_SELVGROUP:
+ sel_verts_defgroup(1);
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_DESELVGROUP:
+ sel_verts_defgroup(0);
+ allqueue (REDRAWVIEW3D, 1);
+ break;
+ case B_DELSTICKY:
+
+ if(me->msticky) MEM_freeN(me->msticky);
+ me->msticky= 0;
+ allqueue(REDRAWBUTSEDIT, 0);
+ break;
+ case B_MAKESTICKY:
+ make_sticky();
+ break;
+ case B_MAKEVERTCOL:
+ make_vertexcol();
+ break;
+ case B_DELVERTCOL:
+ if(me->mcol) MEM_freeN(me->mcol);
+ me->mcol= 0;
+ G.f &= ~G_VERTEXPAINT;
+ freedisplist(&(ob->disp));
+ allqueue(REDRAWBUTSEDIT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+
+ case B_MAKE_TFACES:
+ make_tfaces(me);
+ allqueue(REDRAWBUTSEDIT, 0);
+ break;
+
+ case B_DEL_TFACES:
+ if(me->tface) MEM_freeN(me->tface);
+ me->tface= 0;
+ G.f &= ~G_FACESELECT;
+ allqueue(REDRAWBUTSEDIT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIMAGE, 0);
+ break;
+
+ case B_FLIPNORM:
+ if(G.obedit) {
+ flip_editnormals();
+ }
+ else flipnorm_mesh( get_mesh(ob) );
+
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+
+ case B_DECIM_FACES:
+ decimate_faces();
+ break;
+ case B_DECIM_CANCEL:
+ decimate_cancel();
+ break;
+ case B_DECIM_APPLY:
+ decimate_apply();
+ break;
+
+ case B_SLOWERDRAW:
+ slowerdraw();
+ break;
+ case B_FASTERDRAW:
+ fasterdraw();
+ break;
+ }
+ }
+
+ if(G.obedit==0 || (G.obedit->type!=OB_MESH)) return;
+
+ switch(event) {
+ case B_SPIN:
+ if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 0);
+ break;
+ case B_SPINDUP:
+ if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 1);
+ break;
+ case B_EXTR:
+ G.f |= G_DISABLE_OK;
+ if( select_area(SPACE_VIEW3D)) extrude_mesh();
+ G.f -= G_DISABLE_OK;
+ break;
+ case B_SCREW:
+ if( select_area(SPACE_VIEW3D)) screw_mesh(step, turn);
+ break;
+ case B_EXTREP:
+ if( select_area(SPACE_VIEW3D)) extrude_repeat_mesh(step, extr_offs);
+ break;
+ case B_SPLIT:
+ G.f |= G_DISABLE_OK;
+ split_mesh();
+ G.f -= G_DISABLE_OK;
+ break;
+ case B_REMDOUB:
+ notice("Removed: %d", removedoublesflag(1, doublimit));
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_SUBDIV:
+ waitcursor(1);
+ subdivideflag(1, 0.0, editbutflag & B_BEAUTY);
+ countall();
+ waitcursor(0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_FRACSUBDIV:
+ randfac= 10;
+ if(button(&randfac, 1, 100, "Rand fac:")==0) return;
+ waitcursor(1);
+ fac= -( (float)randfac )/100;
+ subdivideflag(1, fac, editbutflag & B_BEAUTY);
+ countall();
+ waitcursor(0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_XSORT:
+ if( select_area(SPACE_VIEW3D)) xsortvert_flag(1);
+ break;
+ case B_HASH:
+ hashvert_flag(1);
+ break;
+ case B_TOSPHERE:
+ vertices_to_sphere();
+ break;
+ case B_VERTEXNOISE:
+ vertexnoise();
+ break;
+ case B_VERTEXSMOOTH:
+ vertexsmooth();
+ break;
+ }
+ /* WATCH IT: previous events only in editmode! */
+}
+
+static void editing_panel_mesh_tools(Object *ob, Mesh *me)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_tools", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Mesh Tools", "Editing", 640, 0, 318, 204)==0) return;
+
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|2, 0, "Beauty", 477,195,80,19, &editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_SPLIT,"Split", 477,175,80,19, 0, 0, 0, 0, 0, "Separates selected faces from unselected faces");
+ uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 477,155,80,19, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape");
+ uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 477,135,80,19, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters");
+
+ uiDefBut(block, BUT,B_FRACSUBDIV, "Fract Subd", 557,195,80,19, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor");
+ uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 557,175,80,19, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate");
+ uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 557,155,80,19, 0, 0, 0, 0, 0, "Flattens angles of selected faces");
+ uiDefBut(block, BUT,B_XSORT,"Xsort", 557,135,80,19, 0, 0, 0, 0, 0, "Sorts selected vertice data in the X direction");
+
+ uiDefBut(block, BUT,B_HASH,"Hash", 637,195,80,19, 0, 0, 0, 0, 0, "Randomizes selected vertice sequence data");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_DIFF, "Limit:", 637,175,80,19, &doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 637,155,80,19, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices");
+ uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 637,135,80,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals");
+
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_EXTR,"Extrude", 477,100,249,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices");
+ uiDefBut(block, BUT,B_SPINDUP,"Spin Dupe", 639,75,87,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport");
+ uiDefBut(block, BUT,B_SPIN, "Spin", 558,75,78,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport");
+ uiDefBut(block, BUT,B_SCREW,"Screw", 477,75,79,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition
+ uiDefBut(block, BUT,B_EXTREP, "Extrude Dupe", 477,15,128,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_DIFF, "Degr:", 477,55,78,19, &degr,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves");
+ uiDefButS(block, NUM, B_DIFF, "Steps:", 558,55,78,19, &step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices");
+ uiDefButS(block, NUM, B_DIFF, "Turns:", 639,55,86,19, &turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns");
+ uiDefButS(block, TOG|BIT|0, B_DIFF, "Clockwise", 639,35,86,19, &editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'");
+ uiDefButS(block, TOG|BIT|1, B_DIFF, "Keep Original", 477,35,156,19, &editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools");
+ uiDefButF(block, NUM, B_DIFF, "Offset:", 608,15,117,19, &extr_offs, 0.01, 10.0, 100, 0, "Sets the distance between each copy for 'Extrude Dupe'");
+
+
+}
+
+static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
+{
+ unique_vertexgroup_name((bDeformGroup*)datav, OBACT);
+}
+
+
+
+static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
+{
+ uiBlock *block;
+
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_tools1", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Mesh Tools 1", "Editing", 960, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_DOCENTRE, "Centre", 1091, 200, 100, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
+
+
+ uiDefBut(block, BUT,B_HIDE, "Hide", 1091,152,77,18, 0, 0, 0, 0, 0, "Hides selected faces");
+ uiDefBut(block, BUT,B_REVEAL, "Reveal", 1171,152,86,18, 0, 0, 0, 0, 0, "Reveals selected faces");
+ uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 1091,129,166,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 1090, 90, 164, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
+ uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals", 1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
+ uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
+ uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
+ uiDefButI(block, TOG|BIT|11, 0, "All edges", 1090,10,164,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
+
+
+ /* Draw Vertex grouping buttons mostly if we're in editmode */
+ {
+ uiBut *but;
+ int defCount;
+ bDeformGroup *defGroup;
+ char *s, *menustr;
+ bDeformGroup *dg;
+ int min, by=210, index;
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, LABEL,0,"Vertex Groups", 940,by-=19,113,18, 0, 0, 0, 0, 0, "");
+
+ defCount=BLI_countlist(&ob->defbase);
+
+ if (!defCount) min=0;
+ else min=1;
+
+ s= menustr = MEM_callocN((32 * defCount)+20, "menustr");
+
+ for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
+ int cnt= sprintf (s, "%s%%x%d|", dg->name, index);
+
+ if (cnt>0) s+= cnt;
+ }
+
+ by-=22;
+ if (defCount) uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr, 940, by,18,18, &ob->actdef, min, defCount, 0, 0, "Browses available vertex groups");
+
+ MEM_freeN (menustr);
+
+ if (ob->actdef){
+ defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
+ but= uiDefBut(block, TEX,REDRAWBUTSEDIT,"", 958,by,93-18,18, defGroup->name, 0, 32, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
+ uiButSetFunc(but, verify_vertexgroup_name_func, defGroup, NULL);
+ }
+
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Weight:", 940, by-=22, 93, 18, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
+
+ if (G.obedit && G.obedit==ob){
+
+ uiBlockSetCol(block, BUTSALMON);
+ /* uiDefBut(block, BUT,B_AUTOVGROUP,"Auto Weight", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Automatically assigns deformation groups"); */
+ uiDefBut(block, BUT,B_NEWVGROUP,"New", 940,by-=22,45,18, 0, 0, 0, 0, 0, "Creates a new vertex group");
+ uiDefBut(block, BUT,B_DELVGROUP,"Delete", 988,by,45,18, 0, 0, 0, 0, 0, "Removes the current vertex group");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_ASSIGNVGROUP,"Assign", 940,by-=22,93,18, 0, 0, 0, 0, 0, "Assigns selected vertices to the current vertex group");
+ uiDefBut(block, BUT,B_REMOVEVGROUP,"Remove", 940,by-=22,93,18, 0, 0, 0, 0, 0, "Removes selected vertices from the current vertex group");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, BUT,B_SELVGROUP,"Select", 940,by-=22,93,18, 0, 0, 0, 0, 0, "Selects vertices belonging to the current vertex group");
+ uiDefBut(block, BUT,B_DESELVGROUP,"Deselect", 940,by-=22,93,18, 0, 0, 0, 0, 0, "Deselects vertices belonging to the current vertex group");
+ }
+ }
+
+}
+
+
+static void editing_panel_materials(Object *ob)
+{
+ uiBlock *block;
+ int *poin;
+ float min;
+ Material *ma;
+ char str[64];
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_materials", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Materials", "Editing", 0, 0, 318, 204)==0) return;
+
+ /* to be sure */
+ if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL);
+ else return;
+
+
+ if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
+ else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
+ else poin= &( ((Curve *)ob->data)->texflag );
+ uiDefButI(block, TOG|BIT|0, B_AUTOTEX, "AutoTexSpace", 143,180,130,19, poin, 0, 0, 0, 0, "Adjusts active object's texture space automatically when transforming object");
+
+ sprintf(str,"%d Mat:", ob->totcol);
+ if(ob->totcol) min= 1.0; else min= 0.0;
+ ma= give_current_material(ob, ob->actcol);
+
+ if(ma) {
+ uiDefButF(block, COL, 0, "", 291,123,24,30, &(ma->r), 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, ma->id.name+2, 318,146, 103, 30, 0, 0, 0, 0, 0, "");
+ }
+ uiDefButC(block, NUM, B_REDR, str, 318,123,103,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
+ uiDefBut(block, BUT,B_MATWICH, "?", 423,123,31,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT,B_MATNEW, "New", 292,101,80,21, 0, 0, 0, 0, 0, "Adds a new Material index");
+ uiDefBut(block, BUT,B_MATDEL, "Delete", 374,101,80,21, 0, 0, 0, 0, 0, "Deletes this Material index");
+ uiDefBut(block, BUT,B_MATASS, "Assign", 291,47,162,26, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, BUT,B_MATSEL, "Select", 292,76,79,22, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
+ uiDefBut(block, BUT,B_MATDESEL, "Deselect", 373,76,79,21, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
+
+ uiDefBut(block, BUT,B_SETSMOOTH, "Set Smooth", 291,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
+ uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 373,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
+
+}
+
+/* *************************** FACE/PAINT *************************** */
+
+void do_fpaintbuts(unsigned short event)
+{
+ Mesh *me;
+ Object *ob;
+ extern TFace *lasttface; /* caches info on tface bookkeeping ?*/
+
+ ob= OBACT;
+ if(ob==0) return;
+
+ switch(event) {
+
+ case B_VPGAMMA:
+ vpaint_dogamma();
+ break;
+ case B_COPY_TF_MODE:
+ case B_COPY_TF_UV:
+ case B_COPY_TF_COL:
+ case B_COPY_TF_TEX:
+ me= get_mesh(ob);
+ if(me && me->tface) {
+/* extern TFace *lasttface; */
+ TFace *tface= me->tface;
+ int a= me->totface;
+
+ set_lasttface();
+ if(lasttface) {
+
+ while(a--) {
+ if(tface!=lasttface && (tface->flag & TF_SELECT)) {
+ if(event==B_COPY_TF_MODE) {
+ tface->mode= lasttface->mode;
+ tface->transp= lasttface->transp;
+ }
+ else if(event==B_COPY_TF_UV) {
+ memcpy(tface->uv, lasttface->uv, sizeof(tface->uv));
+ tface->tpage= lasttface->tpage;
+ tface->tile= lasttface->tile;
+
+ if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES;
+ else tface->mode &= ~TF_TILES;
+
+ }
+ else if(event==B_COPY_TF_TEX) {
+ tface->tpage= lasttface->tpage;
+ tface->tile= lasttface->tile;
+
+ if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES;
+ else tface->mode &= ~TF_TILES;
+ }
+ else if(event==B_COPY_TF_COL) memcpy(tface->col, lasttface->col, sizeof(tface->col));
+ }
+ tface++;
+ }
+ }
+ do_shared_vertexcol(me);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIMAGE, 0);
+ }
+ break;
+ case B_SET_VCOL:
+ clear_vpaint_selectedfaces();
+ break;
+ case B_REDR_3D_IMA:
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIMAGE, 0);
+ break;
+ case B_ASSIGNMESH:
+
+ test_object_materials(ob->data);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ break;
+
+ case B_TFACE_HALO:
+ set_lasttface();
+ if(lasttface) {
+ lasttface->mode &= ~TF_BILLBOARD2;
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ break;
+
+ case B_TFACE_BILLB:
+ set_lasttface();
+ if(lasttface) {
+ lasttface->mode &= ~TF_BILLBOARD;
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ break;
+ }
+}
+
+
+/* -------------------- MODE: vpaint faceselect ------------------- */
+
+static void editing_panel_mesh_paint(void)
+{
+ extern VPaint Gvp; /* from vpaint */
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTGREY);
+
+ uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
+ uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
+ uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+ uiDefButF(block, NUMSLI, 0, "Opacity ", 979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
+ uiDefButF(block, NUMSLI, 0, "Size ", 979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
+
+ uiDefButF(block, COL, B_VPCOLSLI, "", 1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, "");
+
+ uiDefButS(block, ROW, B_DIFF, "Mix", 1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
+ uiDefButS(block, ROW, B_DIFF, "Add", 1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
+ uiDefButS(block, ROW, B_DIFF, "Sub", 1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
+ uiDefButS(block, ROW, B_DIFF, "Mul", 1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
+ uiDefButS(block, ROW, B_DIFF, "Filter", 1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|1, 0, "Area", 980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
+ uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
+ uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_VPGAMMA, "Set", 980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
+ uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 980,5,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
+
+}
+
+
+static void editing_panel_mesh_texface(void)
+{
+ uiBlock *block;
+ extern TFace *lasttface;
+
+ block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_texface", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Texture face", "Editing", 640, 0, 318, 204)==0) return;
+
+ set_lasttface(); // checks for ob type
+ if(lasttface) {
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|2, B_REDR_3D_IMA, "Tex", 600,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face with texture");
+ uiDefButS(block, TOG|BIT|7, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use tilemode for face");
+ uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Light", 720,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use light for face");
+ uiDefButS(block, TOG|BIT|10, REDRAWVIEW3D, "Invisible",780,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Make face invisible");
+ uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Collision", 840,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use face for collision detection");
+
+ uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "Shared", 600,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Blend vertex colours across face when vertices are shared");
+ uiDefButS(block, TOG|BIT|9, REDRAWVIEW3D, "Twoside", 660,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face twosided");
+ uiDefButS(block, TOG|BIT|11, REDRAWVIEW3D, "ObColor",720,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colours");
+
+ uiDefButS(block, TOG|BIT|8, B_TFACE_HALO, "Halo", 600,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Screen aligned billboard");
+ uiDefButS(block, TOG|BIT|12, B_TFACE_BILLB, "Billboard",660,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
+ uiDefButS(block, TOG|BIT|13, REDRAWVIEW3D, "Shadow", 720,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Face is used for shadow");
+ uiDefButS(block, TOG|BIT|14, REDRAWVIEW3D, "Text", 780,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Enable bitmap text on face");
+
+ uiBlockSetCol(block, BUTPURPLE);
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,100,60,19, &lasttface->transp, 2.0, 0.0, 0, 0, "Render colour of textured face as colour");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,100,60,19, &lasttface->transp, 2.0, 1.0, 0, 0, "Render face transparent and add colour of face");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,100,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
+ /* uiDefButC(block, ROW, REDRAWVIEW3D, "Sub", 780,100,60,19, &lasttface->transp, 2.0, 3.0, 0, 0); ,""*/
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode");
+ uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex", 721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures");
+ uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol", 809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours");
+ }
+
+}
+
+
+/* this is a mode context sensitive system */
+
+void editing_panels()
+{
+ Object *ob;
+ Curve *cu;
+ MetaBall *mb;
+ Lattice *lt;
+ bArmature *arm;
+ Camera *cam;
+
+ ob= OBACT;
+ if(ob==NULL) return;
+
+ switch(ob->type) {
+ case OB_MESH:
+ editing_panel_materials(ob); // no editmode!
+ editing_panel_mesh_type(ob, ob->data); // no editmode!
+ /* modes */
+ if(G.obedit) {
+ editing_panel_mesh_tools(ob, ob->data); // no editmode!
+ editing_panel_mesh_tools1(ob, ob->data); // no editmode!
+ }
+ else if(G.f & G_FACESELECT) {
+ editing_panel_mesh_texface();
+ }
+ else if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT) ) {
+ editing_panel_mesh_paint();
+ }
+ break;
+
+ case OB_CURVE:
+ case OB_SURF:
+ cu= ob->data;
+ editing_panel_materials(ob); // no editmode!
+ editing_panel_curve_type(ob, cu);
+ if(G.obedit) {
+ editing_panel_curve_tools(ob, cu);
+ editing_panel_curve_tools1(ob, cu);
+ }
+ break;
+
+ case OB_MBALL:
+ mb= ob->data;
+ editing_panel_materials(ob); // no editmode!
+ editing_panel_mball_type(ob, mb);
+ if(G.obedit) {
+ editing_panel_mball_tools(ob, mb);
+ }
+ break;
+
+ case OB_FONT:
+ cu= ob->data;
+ editing_panel_materials(ob); // no editmode!
+ editing_panel_curve_type(ob, cu);
+ editing_panel_font_type(ob, cu);
+ break;
+
+ case OB_LATTICE:
+ lt= ob->data;
+ editing_panel_lattice_type(ob, lt);
+ break;
+
+ case OB_CAMERA:
+ cam= ob->data;
+ editing_panel_camera_type(ob, cam);
+ break;
+
+ case OB_ARMATURE:
+ arm= ob->data;
+ editing_panel_armature_type(ob, arm);
+ if(G.obedit) {
+ editing_panel_armature_bones(ob, arm);
+ }
+ break;
+ }
+
+}
diff --git a/source/blender/src/editsca.c b/source/blender/src/buttons_logic.c
index 397eeff92ed..79d353d5945 100644
--- a/source/blender/src/editsca.c
+++ b/source/blender/src/buttons_logic.c
@@ -1,5 +1,5 @@
/**
- * $Id$
+ * $Id:
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -78,7 +78,6 @@
#include "BIF_interface.h"
#include "BIF_butspace.h"
#include "BIF_screen.h"
-#include "BIF_editsca.h"
#include "BIF_keyval.h"
#include "BIF_editsound.h"
@@ -89,24 +88,8 @@
#include "mydevice.h"
#include "interface.h"
#include "nla.h" /* For __NLA : Important, do not remove */
+#include "butspace.h" // own module
-#define B_DIFF 1
-#define B_ADD_PROP 2701
-#define B_CHANGE_PROP 2702
-
-#define B_ADD_SENS 2703
-#define B_CHANGE_SENS 2704
-#define B_DEL_SENS 2705
-
-#define B_ADD_CONT 2706
-#define B_CHANGE_CONT 2707
-#define B_DEL_CONT 2708
-
-#define B_ADD_ACT 2709
-#define B_CHANGE_ACT 2710
-#define B_DEL_ACT 2711
-
-#define B_SOUNDACT_BROWSE 2712
/* internals */
@@ -352,7 +335,7 @@ static void sca_move_actuator(void *datav, void *data2_unused)
}
}
-void do_gamebuts(unsigned short event)
+void do_logic_buts(unsigned short event)
{
bProperty *prop;
bSensor *sens;
@@ -2289,7 +2272,7 @@ static uiBlock *actuator_menu(void *arg_unused)
/* never used, see CVS 1.120 for the code */
/* static uiBlock *freecamera_menu(void) */
-void gamebuts(void)
+void logic_buts(void)
{
ID **idar;
Object *ob;
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
new file mode 100644
index 00000000000..7448df3d6ff
--- /dev/null
+++ b/source/blender/src/buttons_object.c
@@ -0,0 +1,903 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <time.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef WIN32
+#include "BLI_winstuff.h"
+#endif
+
+#include "MEM_guardedalloc.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_library.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "BSE_filesel.h"
+
+#include "BIF_gl.h"
+#include "BIF_graphics.h"
+#include "BIF_keyval.h"
+#include "BIF_mainqueue.h"
+#include "BIF_resources.h"
+#include "BIF_screen.h"
+#include "BIF_mywindow.h"
+#include "BIF_space.h"
+#include "BIF_glutil.h"
+#include "BIF_interface.h"
+#include "BIF_toolbox.h"
+#include "BIF_editmesh.h"
+#include "BDR_editcurve.h"
+#include "BDR_editface.h"
+#include "BDR_drawobject.h"
+#include "BIF_butspace.h"
+
+#include "interface.h"
+#include "mydevice.h"
+#include "blendef.h"
+
+/* -----includes for this file specific----- */
+
+
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
+#include "DNA_ika_types.h"
+#include "DNA_image_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_material_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_radio_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_world_types.h"
+
+#include "BKE_anim.h"
+#include "BKE_armature.h"
+#include "BKE_constraint.h"
+#include "BKE_curve.h"
+#include "BKE_displist.h"
+#include "BKE_effect.h"
+#include "BKE_font.h"
+#include "BKE_ika.h"
+#include "BKE_image.h"
+#include "BKE_ipo.h"
+#include "BKE_lattice.h"
+#include "BKE_material.h"
+#include "BKE_mball.h"
+#include "BKE_mesh.h"
+#include "BKE_object.h"
+#include "BKE_sound.h"
+#include "BKE_texture.h"
+#include "BKE_utildefines.h"
+
+#include "BSE_editipo.h"
+#include "BDR_editobject.h"
+
+#include "butspace.h" // own module
+
+float hspeed=0.1, prspeed=0.0, prlen=0.0;
+
+
+
+/* ************************************* */
+
+#include "BLI_editVert.h"
+extern ListBase editNurb;
+
+void do_common_editbuts(unsigned short event) // old name
+{
+ EditVlak *evl;
+ Base *base;
+ Object *ob;
+ Mesh *me;
+ Nurb *nu;
+ Curve *cu;
+ MFace *mface;
+ BezTriple *bezt;
+ BPoint *bp;
+ unsigned int local;
+ int a, bit, index= -1;
+
+ switch(event) {
+
+ case B_MATWICH:
+ if(G.obedit && G.obedit->actcol>0) {
+ if(G.obedit->type == OB_MESH) {
+ evl= G.edvl.first;
+ while(evl) {
+ if( vlakselectedAND(evl, 1) ) {
+ if(index== -1) index= evl->mat_nr;
+ else if(index!=evl->mat_nr) {
+ error("Mixed colors");
+ return;
+ }
+ }
+ evl= evl->next;
+ }
+ }
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ nu= editNurb.first;
+ while(nu) {
+ if( isNurbsel(nu) ) {
+ if(index== -1) index= nu->mat_nr;
+ else if(index!=nu->mat_nr) {
+ error("Mixed colors");
+ return;
+ }
+ }
+ nu= nu->next;
+ }
+ }
+ if(index>=0) {
+ G.obedit->actcol= index+1;
+ scrarea_queue_winredraw(curarea);
+ }
+ }
+ break;
+ case B_MATNEW:
+ new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
+ scrarea_queue_winredraw(curarea);
+ allqueue(REDRAWVIEW3D_Z, 0);
+ break;
+ case B_MATDEL:
+ delete_material_index();
+ scrarea_queue_winredraw(curarea);
+ allqueue(REDRAWVIEW3D_Z, 0);
+ break;
+ case B_MATASS:
+ if(G.obedit && G.obedit->actcol>0) {
+ if(G.obedit->type == OB_MESH) {
+ evl= G.edvl.first;
+ while(evl) {
+ if( vlakselectedAND(evl, 1) )
+ evl->mat_nr= G.obedit->actcol-1;
+ evl= evl->next;
+ }
+ allqueue(REDRAWVIEW3D_Z, 0);
+ makeDispList(G.obedit);
+ }
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ nu= editNurb.first;
+ while(nu) {
+ if( isNurbsel(nu) )
+ nu->mat_nr= G.obedit->actcol-1;
+ nu= nu->next;
+ }
+ }
+ }
+ break;
+ case B_MATSEL:
+ case B_MATDESEL:
+ if(G.obedit) {
+ if(G.obedit->type == OB_MESH) {
+ evl= G.edvl.first;
+ while(evl) {
+ if(evl->mat_nr== G.obedit->actcol-1) {
+ if(event==B_MATSEL) {
+ if(evl->v1->h==0) evl->v1->f |= 1;
+ if(evl->v2->h==0) evl->v2->f |= 1;
+ if(evl->v3->h==0) evl->v3->f |= 1;
+ if(evl->v4 && evl->v4->h==0) evl->v4->f |= 1;
+ }
+ else {
+ if(evl->v1->h==0) evl->v1->f &= ~1;
+ if(evl->v2->h==0) evl->v2->f &= ~1;
+ if(evl->v3->h==0) evl->v3->f &= ~1;
+ if(evl->v4 && evl->v4->h==0) evl->v4->f &= ~1;
+ }
+ }
+ evl= evl->next;
+ }
+ tekenvertices_ext( event==B_MATSEL );
+ }
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ nu= editNurb.first;
+ while(nu) {
+ if(nu->mat_nr==G.obedit->actcol-1) {
+ if(nu->bezt) {
+ a= nu->pntsu;
+ bezt= nu->bezt;
+ while(a--) {
+ if(bezt->hide==0) {
+ if(event==B_MATSEL) {
+ bezt->f1 |= 1;
+ bezt->f2 |= 1;
+ bezt->f3 |= 1;
+ }
+ else {
+ bezt->f1 &= ~1;
+ bezt->f2 &= ~1;
+ bezt->f3 &= ~1;
+ }
+ }
+ bezt++;
+ }
+ }
+ else if(nu->bp) {
+ a= nu->pntsu*nu->pntsv;
+ bp= nu->bp;
+ while(a--) {
+ if(bp->hide==0) {
+ if(event==B_MATSEL) bp->f1 |= 1;
+ else bp->f1 &= ~1;
+ }
+ bp++;
+ }
+ }
+ }
+ nu= nu->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ }
+ break;
+ case B_HIDE:
+ if(G.obedit) {
+ if(G.obedit->type == OB_MESH) hide_mesh(0);
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
+ }
+ break;
+ case B_REVEAL:
+ if(G.obedit) {
+ if(G.obedit->type == OB_MESH) reveal_mesh();
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
+ }
+ else if(G.f & G_FACESELECT) reveal_tface();
+
+ break;
+ case B_SELSWAP:
+ if(G.obedit) {
+ if(G.obedit->type == OB_MESH) selectswap_mesh();
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
+ }
+ break;
+ case B_AUTOTEX:
+ ob= OBACT;
+ if(ob && G.obedit==0) {
+ if(ob->type==OB_MESH) tex_space_mesh(ob->data);
+ else if(ob->type==OB_MBALL) ;
+ else tex_space_curve(ob->data);
+ }
+ break;
+ case B_DOCENTRE:
+ docentre();
+ break;
+ case B_DOCENTRENEW:
+ docentre_new();
+ break;
+ case B_DOCENTRECURSOR:
+ docentre_cursor();
+ break;
+ case B_SETSMOOTH:
+ case B_SETSOLID:
+ if(G.obedit) {
+ if(G.obedit->type == OB_MESH) {
+ evl= G.edvl.first;
+ while(evl) {
+ if( vlakselectedAND(evl, 1) ) {
+ if(event==B_SETSMOOTH) evl->flag |= ME_SMOOTH;
+ else evl->flag &= ~ME_SMOOTH;
+ }
+ evl= evl->next;
+ }
+
+ makeDispList(G.obedit);
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ else {
+ nu= editNurb.first;
+ while(nu) {
+ if(isNurbsel(nu)) {
+ if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
+ else nu->flag &= ~ME_SMOOTH;
+ }
+ nu= nu->next;
+ }
+
+ }
+ }
+ else {
+ base= FIRSTBASE;
+ while(base) {
+ if(TESTBASELIB(base)) {
+ if(base->object->type==OB_MESH) {
+ me= base->object->data;
+ mface= me->mface;
+ for(a=0; a<me->totface; a++, mface++) {
+ if(event==B_SETSMOOTH) mface->flag |= ME_SMOOTH;
+ else mface->flag &= ~ME_SMOOTH;
+ }
+
+ makeDispList(base->object);
+ }
+ else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
+ cu= base->object->data;
+ nu= cu->nurb.first;
+ while(nu) {
+ if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
+ else nu->flag &= ~ME_SMOOTH;
+ nu= nu->next;
+ }
+ }
+ }
+ base= base->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ break;
+
+ default:
+ if(event>=B_OBLAY && event<=B_OBLAY+31) {
+ local= BASACT->lay & 0xFF000000;
+ BASACT->lay -= local;
+ if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) {
+ bit= event-B_OBLAY;
+ BASACT->lay= 1<<bit;
+ scrarea_queue_winredraw(curarea);
+ }
+ BASACT->lay += local;
+ /* optimal redraw */
+ if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
+ else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
+ else allqueue(REDRAWVIEW3D, 0);
+
+ OBACT->lay= BASACT->lay;
+ }
+ }
+
+}
+
+void object_panel_draw(Object *ob)
+{
+ ID *id;
+ uiBlock *block;
+ int xco, a, dx, dy;
+
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Draw", "Object", 320, 0, 318, 204)==0) return;
+
+ /* LAYERS */
+ xco= 151;
+ dx= 32;
+ dy= 30;
+ for(a=0; a<10; a++) {
+ /* the (a+10) evaluates correctly because of
+ precedence... brackets aren't a bad idea though */
+ uiDefButI(block, TOG|BIT|(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+ uiDefButI(block, TOG|BIT|a, B_OBLAY+a, "",(short)(xco+a*(dx/2)), (short)(180+dy/2), (short)(dx/2), (short)(1+dy/2), &(BASACT->lay), 0, 0, 0, 0, "");
+ if(a==4) xco+= 5;
+ }
+
+ id= ob->data;
+ if(id && id->lib) uiSetButLock(1, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, LABEL, 0, "Drawtype", 28,200,100,18, 0, 0, 0, 0, 0, "");
+ uiDefButC(block, MENU, REDRAWVIEW3D, "Drawtype%t|Bounds %x1|Wire %x2|Solid %x3|Shaded %x4",
+ 28,180,100,18, &ob->dt, 0, 0, 0, 0, "Sets the drawing type of the active object");
+ uiDefBut(block, LABEL, 0, "Draw Extra", 28,160,100,18, 0, 0, 0, 0, 0, "");
+ uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Bounds", 28, 140, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
+ uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder",
+ 28, 120, 100, 18, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
+ uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Wire", 28, 100, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
+ uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Axis", 28, 80, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis");
+ uiDefButC(block, TOG|BIT|2, REDRAWVIEW3D, "TexSpace", 28, 60, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space");
+ uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "Name", 28, 40, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name");
+
+ uiBlockSetCol(block, BUTGREY);
+
+ uiScalePanelBlock(block); // scales and centers
+ uiDrawBlock(block);
+
+}
+
+
+
+
+void do_object_panels(unsigned short event)
+{
+ Object *ob;
+ Base *base;
+ Effect *eff, *effn;
+ int type;
+
+ ob= OBACT;
+
+ switch(event) {
+
+ case B_RECALCPATH:
+ calc_curvepath(OBACT);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_MUL_IPO:
+ scale_editipo();
+ allqueue(REDRAWBUTSOBJECT, 0);
+ break;
+ case B_AUTOTIMEOFS:
+ auto_timeoffs();
+ break;
+ case B_FRAMEMAP:
+ G.scene->r.framelen= G.scene->r.framapto;
+ G.scene->r.framelen/= G.scene->r.images;
+ break;
+ case B_NEWEFFECT:
+ if(ob) {
+ if (BLI_countlist(&ob->effect)==MAX_EFFECT)
+ error("Unable to add: effect limit reached");
+ else
+ copy_act_effect(ob);
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ break;
+ case B_DELEFFECT:
+ if(ob==0 || ob->type!=OB_MESH) break;
+ eff= ob->effect.first;
+ while(eff) {
+ effn= eff->next;
+ if(eff->flag & SELECT) {
+ BLI_remlink(&ob->effect, eff);
+ free_effect(eff);
+ break;
+ }
+ eff= effn;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_NEXTEFFECT:
+ if(ob==0 || ob->type!=OB_MESH) break;
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) {
+ if(eff->next) {
+ eff->flag &= ~SELECT;
+ eff->next->flag |= SELECT;
+ }
+ break;
+ }
+ eff= eff->next;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ break;
+ case B_PREVEFFECT:
+ if(ob==0 || ob->type!=OB_MESH) break;
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) {
+ if(eff->prev) {
+ eff->flag &= ~SELECT;
+ eff->prev->flag |= SELECT;
+ }
+ break;
+ }
+ eff= eff->next;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ break;
+ case B_CHANGEEFFECT:
+ if(ob==0 || ob->type!=OB_MESH) break;
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) {
+ if(eff->type!=eff->buttype) {
+ BLI_remlink(&ob->effect, eff);
+ type= eff->buttype;
+ free_effect(eff);
+ eff= add_effect(type);
+ BLI_addtail(&ob->effect, eff);
+ }
+ break;
+ }
+ eff= eff->next;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_CALCEFFECT:
+ if(ob==0 || ob->type!=OB_MESH) break;
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) {
+ if(eff->type==EFF_PARTICLE) build_particle_system(ob);
+ else if(eff->type==EFF_WAVE) object_wave(ob);
+ }
+ eff= eff->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ break;
+ case B_RECALCAL:
+ base= FIRSTBASE;
+ while(base) {
+ if(base->lay & G.vd->lay) {
+ ob= base->object;
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) {
+ if(eff->type==EFF_PARTICLE) build_particle_system(ob);
+ }
+ eff= eff->next;
+ }
+ }
+ base= base->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_SETSPEED:
+ set_speed_editipo(hspeed);
+ break;
+ case B_PRINTSPEED:
+ ob= OBACT;
+ if(ob) {
+ float vec[3];
+ CFRA++;
+ do_ob_ipo(ob);
+ where_is_object(ob);
+ VECCOPY(vec, ob->obmat[3]);
+ CFRA--;
+ do_ob_ipo(ob);
+ where_is_object(ob);
+ VecSubf(vec, vec, ob->obmat[3]);
+ prspeed= Normalise(vec);
+ scrarea_queue_winredraw(curarea);
+ }
+ break;
+ case B_PRINTLEN:
+ ob= OBACT;
+ if(ob && ob->type==OB_CURVE) {
+ Curve *cu=ob->data;
+
+ if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
+ scrarea_queue_winredraw(curarea);
+ }
+ break;
+ case B_RELKEY:
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWIPO, 0);
+ break;
+
+ default:
+ if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
+ ob= OBACT;
+ if(ob) {
+ int a=B_SELEFFECT;
+
+ eff= ob->effect.first;
+ while(eff) {
+ if(event==a) eff->flag |= SELECT;
+ else eff->flag &= ~SELECT;
+
+ a++;
+ eff= eff->next;
+ }
+ allqueue(REDRAWBUTSOBJECT, 0);
+ }
+ }
+ }
+
+}
+
+void object_panel_effects(Object *ob)
+{
+ Effect *eff;
+ uiBlock *block;
+ int a;
+ short x, y;
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_effects", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Effects", "Object", 640, 0, 418, 204)==0) return;
+
+ uiBlockSetCol(block, BUTSALMON);
+
+ /* EFFECTS */
+
+ if (ob->type == OB_MESH) {
+ uiDefBut(block, BUT, B_NEWEFFECT, "NEW Effect", 550,187,124,27, 0, 0, 0, 0, 0, "Create a new effect");
+ uiDefBut(block, BUT, B_DELEFFECT, "Delete", 676,187,62,27, 0, 0, 0, 0, 0, "Delete the effect");
+ }
+
+ uiBlockSetCol(block, BUTGREY);
+
+ /* select effs */
+ eff= ob->effect.first;
+ a= 0;
+ while(eff) {
+
+ x= 15 * a + 550;
+ y= 172; // - 12*( abs(a/10) ) ;
+ uiDefButS(block, TOG|BIT|0, B_SELEFFECT+a, "", x, y, 15, 12, &eff->flag, 0, 0, 0, 0, "");
+
+ a++;
+ if(a==MAX_EFFECT) break;
+ eff= eff->next;
+ }
+
+ eff= ob->effect.first;
+ while(eff) {
+ if(eff->flag & SELECT) break;
+ eff= eff->next;
+ }
+
+ if(eff) {
+ uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Start building the effect");
+
+ if(eff->type==EFF_BUILD) {
+ BuildEff *bld;
+
+ bld= (BuildEff *)eff;
+
+ uiDefButF(block, NUM, 0, "Len:", 649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the building requires");
+ uiDefButF(block, NUM, 0, "Sfra:", 746,138,94,22, &bld->sfra, 1.0, 9000.0, 100, 0, "Specify the startframe of the effect");
+ }
+ else if(eff->type==EFF_WAVE) {
+ WaveEff *wav;
+
+ wav= (WaveEff *)eff;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X", 782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis");
+ uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y", 840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis");
+ uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl", 890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave efefct");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_CALCEFFECT, "Sta x:", 550,135,113,24, &wav->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Sta y:", 665,135,104,24, &wav->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis");
+
+ uiDefButF(block, NUMSLI, B_CALCEFFECT, "Speed:", 550,100,216,20, &wav->speed, -2.0, 2.0, 0, 0, "Specify the wave speed");
+ uiDefButF(block, NUMSLI, B_CALCEFFECT, "Heigth:", 550,80,216,20, &wav->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave");
+ uiDefButF(block, NUMSLI, B_CALCEFFECT, "Width:", 550,60,216,20, &wav->width, 0.0, 5.0, 0, 0, "Specify the width of the wave");
+ uiDefButF(block, NUMSLI, B_CALCEFFECT, "Narrow:", 550,40,216,20, &wav->narrow, 0.0, 10.0, 0, 0, "Specify how narrow the wave follows");
+
+ uiDefButF(block, NUM, B_CALCEFFECT, "Time sta:", 780,100,219,20, &wav->timeoffs, -1000.0, 1000.0, 100, 0, "Specify startingframe of the wave");
+
+ uiDefButF(block, NUM, B_CALCEFFECT, "Lifetime:", 780,80,219,20, &wav->lifetime, -1000.0, 1000.0, 100, 0, "Specify the lifespan of the wave");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Damptime:", 780,60,219,20, &wav->damp, -1000.0, 1000.0, 100, 0, "Specify the dampingtime of the wave");
+
+ }
+ else if(eff->type==EFF_PARTICLE) {
+ PartEff *paf;
+
+ paf= (PartEff *)eff;
+
+ uiDefBut(block, BUT, B_RECALCAL, "RecalcAll", 741,187,67,27, 0, 0, 0, 0, 0, "Update the particle system");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Static", 825,187,67,27, &paf->flag, 0, 0, 0, 0, "Make static particles");
+ uiBlockSetCol(block, BUTGREY);
+
+ uiDefButI(block, NUM, B_CALCEFFECT, "Tot:", 550,146,91,20, &paf->totpart, 1.0, 100000.0, 0, 0, "Set the total number of particles");
+ if(paf->flag & PAF_STATIC) {
+ uiDefButS(block, NUM, REDRAWVIEW3D, "Step:", 644,146,84,20, &paf->staticstep, 1.0, 100.0, 10, 0, "");
+ }
+ else {
+ uiDefButF(block, NUM, B_CALCEFFECT, "Sta:", 644,146,84,20, &paf->sta, -250.0, 9000.0, 100, 0, "Specify the startframe");
+ uiDefButF(block, NUM, B_CALCEFFECT, "End:", 731,146,97,20, &paf->end, 1.0, 9000.0, 100, 0, "Specify the endframe");
+ }
+ uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,146,88,20, &paf->lifetime, 1.0, 9000.0, 100, 0, "Specify the life span of the particles");
+ uiDefButI(block, NUM, B_CALCEFFECT, "Keys:", 922,146,80,20, &paf->totkey, 1.0, 32.0, 0, 0, "Specify the number of key positions");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, NUM, B_REDR, "CurMul:", 550,124,91,20, &paf->curmult, 0.0, 3.0, 0, 0, "Multiply the particles");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_CALCEFFECT, "Mat:", 644,124,84,20, paf->mat+paf->curmult, 1.0, 8.0, 0, 0, "Specify the material used for the particles");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Mult:", 730,124,98,20, paf->mult+paf->curmult, 0.0, 1.0, 10, 0, "Probability \"dying\" particle spawns a new one.");
+ uiDefButS(block, NUM, B_CALCEFFECT, "Child:", 922,124,80,20, paf->child+paf->curmult, 1.0, 600.0, 100, 0, "Specify the number of children of a particle that multiply itself");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,124,89,20, paf->life+paf->curmult, 1.0, 600.0, 100, 0, "Specify the lifespan of the next generation particles");
+
+ uiDefButF(block, NUM, B_CALCEFFECT, "Randlife:", 550,96,96,20, &paf->randlife, 0.0, 2.0, 10, 0, "Give the particlelife a random variation");
+ uiDefButI(block, NUM, B_CALCEFFECT, "Seed:", 652,96,80,20, &paf->seed, 0.0, 255.0, 0, 0, "Set an offset in the random table");
+
+ uiDefButF(block, NUM, B_DIFF, "VectSize", 885,96,116,20, &paf->vectsize, 0.0, 1.0, 10, 0, "Set the speed for Vect");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Face", 735,96,46,20, &paf->flag, 0, 0, 0, 0, "Emit particles also from faces");
+ uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "Bspline", 782,96,54,20, &paf->flag, 0, 0, 0, 0, "Use B spline formula for particle interpolation");
+ uiDefButS(block, TOG, REDRAWVIEW3D, "Vect", 837,96,45,20, &paf->stype, 0, 0, 0, 0, "Give the particles a rotation direction");
+
+ uiBlockSetCol(block, BUTPURPLE);
+ uiDefButF(block, NUM, B_CALCEFFECT, "Norm:", 550,67,96,20, &paf->normfac, -2.0, 2.0, 10, 0, "Let the mesh give the particle a starting speed");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Ob:", 649,67,86,20, &paf->obfac, -1.0, 1.0, 10, 0, "Let the object give the particle a starting speed");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Rand:", 738,67,86,20, &paf->randfac, 0.0, 2.0, 10, 0, "Give the startingspeed a random variation");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Tex:", 826,67,85,20, &paf->texfac, 0.0, 2.0, 10, 0, "Let the texture give the particle a starting speed");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Damp:", 913,67,89,20, &paf->damp, 0.0, 1.0, 10, 0, "Specify the damping factor");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_CALCEFFECT, "X:", 550,31,72,20, paf->force, -1.0, 1.0, 1, 0, "Specify the X axis of a continues force");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 624,31,78,20, paf->force+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a continues force");
+ uiDefBut(block, LABEL, 0, "Force:", 550,9,72,20, 0, 1.0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 623,9,79,20, paf->force+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a continues force");
+
+ uiDefBut(block, LABEL, 0, "Texture:", 722,9,74,20, 0, 1.0, 0, 0, 0, "");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_CALCEFFECT, "Int", 875,9,32,43, &paf->texmap, 14.0, 0.0, 0, 0, "Use texture intensity as a factor for texture force");
+ uiDefButS(block, ROW, B_CALCEFFECT, "RGB", 911,31,45,20, &paf->texmap, 14.0, 1.0, 0, 0, "Use RGB values as a factor for particle speed");
+ uiDefButS(block, ROW, B_CALCEFFECT, "Grad", 958,31,44,20, &paf->texmap, 14.0, 2.0, 0, 0, "Use texture gradient as a factor for particle speed");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_CALCEFFECT, "Nabla:", 911,9,91,20, &paf->nabla, 0.0001, 1.0, 1, 0, "Specify the dimension of the area for gradient calculation");
+ uiDefButF(block, NUM, B_CALCEFFECT, "X:", 722,31,74,20, paf->defvec, -1.0, 1.0, 1, 0, "Specify the X axis of a force, determined by the texture");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 798,31,74,20, paf->defvec+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a force, determined by the texture");
+ uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 797,9,75,20, paf->defvec+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a force, determined by the texture");
+
+ }
+ }
+
+ uiScalePanelBlock(block); // scales and centers
+ uiDrawBlock(block);
+}
+
+static void object_panel_anim(Object *ob)
+{
+ uiBlock *block;
+ char str[32];
+
+ block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButC(block, ROW,REDRAWVIEW3D,"TrackX", 27,190,58,17, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 85,190,19,17, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 104,190,19,17, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"-X", 124,190,24,17, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"-Y", 150,190,24,17, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"-Z", 177,190,24,17, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"UpX", 226,190,45,17, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 274,190,20,17, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
+ uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 297,190,19,17, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Draw Key", 25,160,70,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
+ uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Draw Key Sel", 97,160,81,20, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
+ uiDefButS(block, TOG|BIT|4, 0, "SlowPar", 261,160,56,20, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
+ uiDefButC(block, TOG|BIT|7, REDRAWVIEW3D, "Powertrack", 180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
+
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "DupliFrames", 24,128,88,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
+ uiDefButC(block, TOG|BIT|4, REDRAWVIEW3D, "DupliVerts", 114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rot", 200,128,31,20, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
+ uiDefButC(block, TOG|BIT|6, REDRAWVIEW3D, "No Speed", 234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,105,141,18, &ob->dupsta, 1.0, 1500.0, 0, 0, "Specify startframe for Dupliframes");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,83,140,19, &ob->dupend, 1.0, 2500.0, 0, 0, "Specify endframe for Dupliframes");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 169,104,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 169,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButC(block, TOG|BIT|2, REDRAWALL, "Offs Ob", 23,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
+ uiDefButC(block, TOG|BIT|6, REDRAWALL, "Offs Par", 82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
+ uiDefButC(block, TOG|BIT|7, REDRAWALL, "Offs Particle", 141,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
+
+ uiBlockSetCol(block, BUTGREY);
+ sprintf(str, "%.4f", prspeed);
+ uiDefBut(block, LABEL, 0, str, 247,40,63,31, 0, 1.0, 0, 0, 0, "");
+ uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 246,17,67,31, 0, 0, 0, 0, 0, "Print objectspeed");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 23,17,114,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames");
+ uiBlockSetCol(block, BUTSALMON);
+ 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;
+ }
+ }
+
+ uiBlockSetCol(block, BUTGREY);
+
+ 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, "");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_MUL_IPO, "SET", 1220,79,50,62, 0, 0, 0, 0, 0, "");
+
+
+ /* SPEED BUTTON */
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_DIFF, "Speed:", 1020,23,164,28, &hspeed, 0.0, 180.0, 1, 0, "");
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_SETSPEED, "SET", 1185,23,83,29, 0, 0, 0, 0, 0, "");
+
+#endif
+
+
+ uiScalePanelBlock(block); // scales and centers
+ uiDrawBlock(block);
+}
+
+void object_panels()
+{
+ Object *ob;
+
+ /* check context here */
+ ob= OBACT;
+ if(ob) {
+ object_panel_anim(ob);
+ object_panel_draw(ob);
+ if(ob->type==OB_MESH)
+ object_panel_effects(ob);
+ }
+}
+
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 19384c78cae..3b29a00d0c7 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -84,6 +84,8 @@
#include "BIF_writeimage.h"
#include "BIF_writeavicodec.h"
+#include "butspace.h" // own module
+
#ifdef WITH_QUICKTIME
#include "quicktime_export.h"
#endif
@@ -644,8 +646,7 @@ static void render_panel_output()
block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSSX, UI_HELV, curarea->win);
- uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204);
- if( uiIsPanelClosed(block) ) return; // does draw when closed
+ if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
uiDefBut(block, TEX,0,"", 30, 170, 268, 19,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
uiDefBut(block, BUT,B_FS_PIC," ", 8, 170, 20, 19, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name");
@@ -701,9 +702,6 @@ static void render_panel_output()
"The gamma value for blending oversampled images (1.0 = no correction).");
}
}
-
- uiScalePanelBlock(block); // scales and centers
- uiDrawBlock(block);
}
static void render_panel_render()
@@ -712,8 +710,7 @@ static void render_panel_render()
block= uiNewBlock(&curarea->uiblocks, "render_panel_render", UI_EMBOSSX, UI_HELV, curarea->win);
- uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204);
- if( uiIsPanelClosed(block) ) return; // does draw when closed
+ if(uiNewPanel(curarea, block, "Render", "Render", 320, 0, 318, 204)==0) return;
uiBlockSetCol(block, BUTSALMON);
@@ -757,8 +754,6 @@ static void render_panel_render()
uiDefButS(block, TOG|BIT|2,0, "Gamma", 626,11,58,24, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
- uiScalePanelBlock(block); // scales and centers
- uiDrawBlock(block);
}
static void render_panel_anim()
@@ -767,8 +762,7 @@ static void render_panel_anim()
block= uiNewBlock(&curarea->uiblocks, "render_panel_anim", UI_EMBOSSX, UI_HELV, curarea->win);
- uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204);
- if( uiIsPanelClosed(block) ) return; // does draw when closed
+ if(uiNewPanel(curarea, block, "Anim", "Render", 640, 0, 318, 204)==0) return;
uiBlockSetCol(block, BUTSALMON);
@@ -786,8 +780,6 @@ static void render_panel_anim()
uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 692,10,94,24, &G.scene->r.sfra,1.0,18000.0, 0, 0, "The start frame of the animation");
uiDefButS(block, NUM,REDRAWSEQ,"End:", 790,10,95,24, &G.scene->r.efra,1.0,18000.0, 0, 0, "The end frame of the animation");
- uiScalePanelBlock(block); // scales and centers
- uiDrawBlock(block);
}
static void render_panel_format()
@@ -797,8 +789,7 @@ static void render_panel_format()
block= uiNewBlock(&curarea->uiblocks, "render_panel_format", UI_EMBOSSX, UI_HELV, curarea->win);
- uiNewPanel(curarea, block, "Format", "Render", 960, 0, 318, 204);
- if( uiIsPanelClosed(block) ) return; // does draw when closed
+ if(uiNewPanel(curarea, block, "Format", "Render", 960, 0, 318, 204)==0) return;
uiDefBlockBut(block, framing_render_menu, NULL, "Game framing settings |>> ", 892, 169, 227, 20, "Display game framing settings");
@@ -891,9 +882,6 @@ static void render_panel_format()
uiDefBut(block, BUT,B_PR_FULL, "FULL", 1146,30,100,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1");
uiDefButS(block, TOG|BIT|15, B_REDR, "Unified Renderer", 1146,10,100,18, &G.scene->r.mode, 0, 0, 0, 0, "Use the unified renderer.");
-
- uiScalePanelBlock(block); // scales and centers
- uiDrawBlock(block);
}
@@ -906,3 +894,41 @@ void render_panels()
render_panel_format();
}
+
+/* --------------------------------------------- */
+
+void anim_panels()
+{
+ uiBlock *block;
+
+
+ block= uiNewBlock(&curarea->uiblocks, "anim_panels", UI_EMBOSSX, UI_HELV, curarea->win);
+
+ uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 320,17,93,27,&G.scene->r.sfra,1.0,18000.0, 0, 0, "Specify the start frame of the animation");
+ uiDefButS(block, NUM,REDRAWSEQ,"End:", 416,17,95,27,&G.scene->r.efra,1.0,18000.0, 0, 0, "Specify the end frame of the animation");
+
+ uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old map value in frames");
+ uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify new map value in frames");
+
+ uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 320,47,93,19, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|1, B_SOUND_CHANGED, "Sync", 416,47,95,19, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio");
+
+
+ uiDrawBlock(block);
+
+
+}
+
+/* --------------------------------------------- */
+
+void sound_panels()
+{
+
+
+
+}
+
+
+
diff --git a/source/blender/src/buttons_script.c b/source/blender/src/buttons_script.c
new file mode 100644
index 00000000000..834b1083d4e
--- /dev/null
+++ b/source/blender/src/buttons_script.c
@@ -0,0 +1,82 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <time.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef WIN32
+#include "BLI_winstuff.h"
+#endif
+
+#include "MEM_guardedalloc.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_library.h"
+
+#include "BLI_blenlib.h"
+
+#include "BSE_filesel.h"
+
+#include "BIF_gl.h"
+#include "BIF_graphics.h"
+#include "BIF_keyval.h"
+#include "BIF_mainqueue.h"
+#include "BIF_resources.h"
+#include "BIF_screen.h"
+#include "BIF_mywindow.h"
+#include "BIF_space.h"
+#include "BIF_glutil.h"
+#include "BIF_interface.h"
+#include "BIF_toolbox.h"
+
+#include "BIF_butspace.h"
+
+#include "interface.h"
+#include "mydevice.h"
+#include "blendef.h"
+
+
+void script_panels()
+{
+
+
+}
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
new file mode 100644
index 00000000000..53824014b46
--- /dev/null
+++ b/source/blender/src/buttons_shading.c
@@ -0,0 +1,85 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <time.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef WIN32
+#include "BLI_winstuff.h"
+#endif
+
+#include "MEM_guardedalloc.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_library.h"
+
+#include "BLI_blenlib.h"
+
+#include "BSE_filesel.h"
+
+#include "BIF_gl.h"
+#include "BIF_graphics.h"
+#include "BIF_keyval.h"
+#include "BIF_mainqueue.h"
+#include "BIF_resources.h"
+#include "BIF_screen.h"
+#include "BIF_mywindow.h"
+#include "BIF_space.h"
+#include "BIF_glutil.h"
+#include "BIF_interface.h"
+#include "BIF_toolbox.h"
+
+#include "BIF_butspace.h"
+
+#include "interface.h"
+#include "mydevice.h"
+#include "blendef.h"
+
+/* -----includes for this file specific----- */
+
+#include "butspace.h" // own module
+
+void shading_panels()
+{
+
+
+}
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 90a15fc6d1a..d0a428408be 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -110,12 +110,10 @@ extern float centre[3], centroid[3]; /* Originally defined in editobject.c */
/* Local Function Prototypes */
static void editbones_to_armature (ListBase *bones, Object *ob);
-static int editbone_to_parnr (EditBone *bone);
-static void validate_editbonebutton(EditBone *bone);
static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist);
static int select_bonechildren_by_name (struct Bone *bone, char *name, int select);
-static void build_bonestring (char *string, struct EditBone *bone);
+
static void draw_boneverti (float x, float y, float z, float size, int flag);
static void draw_bone (int armflag, int boneflag, unsigned int id, char *name, float length);
static void draw_bonechildren (struct Bone *bone, int flag, unsigned int *index);
@@ -124,7 +122,6 @@ static void make_boneList(struct ListBase* list, struct ListBase *bones, struct
static void make_bone_menu_children (struct Bone *bone, char *str, int *index);
static void delete_bone(struct EditBone* exBone);
static void clear_armature_children (struct Bone *bone, struct bPose *pose, char mode);
-static void parnr_to_editbone(EditBone *bone);
static int count_bones (struct bArmature *arm, int flagmask, int allbones);
@@ -134,11 +131,10 @@ static void deselect_bonechildren (struct Bone *bone, int mode);
static void selectconnected_posebonechildren (struct Bone *bone);
static int editbone_name_exists (char* name);
-static void unique_editbone_name (char* name);
+
static void *get_nearest_bone (int findunsel);
static EditBone * get_nearest_editbonepoint (int findunsel, int *selmask);
-static void attach_bone_to_parent(EditBone *bone);
static Bone *get_first_selected_bonechildren (Bone *bone);
@@ -1703,251 +1699,6 @@ static void add_bone_input (Object *ob)
}
-static void validate_editbonebutton_cb(void *bonev, void *arg2_unused)
-{
- EditBone *curBone= bonev;
- validate_editbonebutton(curBone);
-}
-static void parnr_to_editbone_cb(void *bonev, void *arg2_unused)
-{
- EditBone *curBone= bonev;
- parnr_to_editbone(curBone);
-}
-static void attach_bone_to_parent_cb(void *bonev, void *arg2_unused)
-{
- EditBone *curBone= bonev;
- attach_bone_to_parent(curBone);
-}
-
-void armaturebuts(void)
-{
- bArmature *arm=NULL;
- Object *ob=NULL;
- uiBlock *block=NULL;
- char str[64];
- int bx=148, by=100;
- EditBone *curBone;
- uiBut *but;
- char *boneString=NULL;
- int index;
-
- ob= OBACT;
- if (ob==NULL) return;
-
- sprintf(str, "editbuttonswin %d", curarea->win);
- block= uiNewBlock (&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- arm= ob->data;
- if (arm==NULL) return;
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButI(block, TOG|BIT|ARM_RESTPOSBIT,REDRAWVIEW3D, "Rest Pos", bx,by,97,20, &arm->flag, 0, 0, 0, 0, "Disable all animation for this object");
- uiDefButI(block, TOG|BIT|ARM_DRAWAXESBIT,REDRAWVIEW3D, "Draw Axes", bx,by-46,97,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
- uiDefButI(block, TOG|BIT|ARM_DRAWNAMESBIT,REDRAWVIEW3D, "Draw Names", bx,by-69,97,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
- uiDefButI(block, TOG|BIT|ARM_DRAWXRAYBIT,REDRAWVIEW3D, "X-Ray", bx,by-92,97,20, &arm->flag, 0, 0, 0, 0, "Draw armature in front of shaded objects");
-
- uiBlockSetCol(block, BUTGREY);
-
- /* Draw the bone name block */
-
- bx+=400; by=200;
-
- if (G.obedit==ob){
- uiDefBut(block, LABEL, 0, "Selected Bones", bx,by,128,18, 0, 0, 0, 0, 0, "");
- by-=20;
- for (curBone=G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
- if (curBone->flag & (BONE_SELECTED)){
-
- /* Hide in posemode flag */
- uiBlockSetCol(block, BUTGREEN);
- uiDefButI(block, TOG|BIT|BONE_HIDDENBIT, REDRAWVIEW3D, "Hide", bx-50,by,48,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in posemode");
-
- /* Bone naming button */
- uiBlockSetCol(block, BUTGREY);
- strcpy (curBone->oldname, curBone->name);
- but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", bx,by,97,18, &curBone->name, 0, 24, 0, 0, "Change the bone name");
- uiButSetFunc(but, validate_editbonebutton_cb, curBone, NULL);
-
- uiDefBut(block, LABEL, 0, "child of", bx+106,by,100,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- boneString = malloc((BLI_countlist(&G.edbo) * 64)+64);
- build_bonestring (boneString, curBone);
-
- curBone->parNr = editbone_to_parnr(curBone->parent);
- but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, bx+164,by,97,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent");
- uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL);
-
- free(boneString);
-
- /* IK to parent flag */
- if (curBone->parent){
- uiBlockSetCol(block, BUTGREEN);
- but=uiDefButI(block, TOG|BIT|BONE_IK_TOPARENTBIT, REDRAWVIEW3D, "IK", bx+275,by,32,18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "IK link to parent");
- uiButSetFunc(but, attach_bone_to_parent_cb, curBone, NULL);
- }
-
- /* Dist and weight buttons */
- uiBlockSetCol(block, BUTGREY);
- but=uiDefButS(block, MENU, REDRAWVIEW3D,
- "Skinnable %x0|"
- "Unskinnable %x1|"
- "Head %x2|"
- "Neck %x3|"
- "Back %x4|"
- "Shoulder %x5|"
- "Arm %x6|"
- "Hand %x7|"
- "Finger %x8|"
- "Thumb %x9|"
- "Pelvis %x10|"
- "Leg %x11|"
- "Foot %x12|"
- "Toe %x13|"
- "Tentacle %x14",
- bx+320,by,97,18,
- &curBone->boneclass,
- 0.0, 0.0, 0.0, 0.0,
- "Classification of armature element");
-
- /* Dist and weight buttons */
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM,REDRAWVIEW3D, "Dist:", bx+425, by,
- 110, 18, &curBone->dist, 0.0, 1000.0, 10.0, 0.0,
- "Bone deformation distance");
- uiDefButF(block, NUM,REDRAWVIEW3D, "Weight:", bx+543, by,
- 110, 18, &curBone->weight, 0.0F, 1000.0F,
- 10.0F, 0.0F, "Bone deformation weight");
-
- by-=19;
- }
- }
- }
-
- uiDrawBlock (block);
-
-}
-
-static int editbone_to_parnr (EditBone *bone)
-{
- EditBone *ebone;
- int index;
-
- for (ebone=G.edbo.first, index=0; ebone; ebone=ebone->next, index++){
- if (ebone==bone)
- return index;
- }
-
- return -1;
-}
-
-static void parnr_to_editbone(EditBone *bone)
-{
- if (bone->parNr == -1){
- bone->parent = NULL;
- bone->flag &= ~BONE_IK_TOPARENT;
- }
- else{
- bone->parent = BLI_findlink(&G.edbo, bone->parNr);
- attach_bone_to_parent(bone);
- }
-}
-
-static void attach_bone_to_parent(EditBone *bone)
-{
- EditBone *curbone;
-
- if (bone->flag & BONE_IK_TOPARENT) {
-
- /* See if there are any other bones that refer to the same parent and disconnect them */
- for (curbone = G.edbo.first; curbone; curbone=curbone->next){
- if (curbone!=bone){
- if (curbone->parent && (curbone->parent == bone->parent) && (curbone->flag & BONE_IK_TOPARENT))
- curbone->flag &= ~BONE_IK_TOPARENT;
- }
- }
-
- /* Attach this bone to its parent */
- VECCOPY(bone->head, bone->parent->tail);
- }
-
-}
-
-static void build_bonestring (char *string, EditBone *bone){
- EditBone *curBone;
- EditBone *pBone;
- int skip=0;
- int index;
-
- sprintf (string, "Parent%%t| %%x%d", -1); /* That space is there for a reason */
-
- for (curBone = G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
- /* Make sure this is a valid child */
- if (curBone != bone){
- skip=0;
- for (pBone=curBone->parent; pBone; pBone=pBone->parent){
- if (pBone==bone){
- skip=1;
- break;
- }
- }
-
- if (skip)
- continue;
-
- sprintf (string, "%s|%s%%x%d", string, curBone->name, index);
- }
- }
-}
-
-static void validate_editbonebutton(EditBone *eBone){
- EditBone *prev;
- bAction *act=NULL;
- bActionChannel *chan;
- Base *base;
-
- /* Separate the bone from the G.edbo */
- prev=eBone->prev;
- BLI_remlink (&G.edbo, eBone);
-
- /* Validate the name */
- unique_editbone_name (eBone->name);
-
- /* Re-insert the bone */
- if (prev)
- BLI_insertlink(&G.edbo, prev, eBone);
- else
- BLI_addhead (&G.edbo, eBone);
-
- /* Rename channel if necessary */
- if (G.obedit)
- act = G.obedit->action;
-
- if (act && !act->id.lib){
- // Find the appropriate channel
- for (chan = act->chanbase.first; chan; chan=chan->next){
- if (!strcmp (chan->name, eBone->oldname)){
- strcpy (chan->name, eBone->name);
- }
- }
- allqueue(REDRAWACTION, 0);
- }
-
- /* Update the parenting info of any users */
- /* Yes, I know this is the worst thing you have ever seen. */
-
- for (base = G.scene->base.first; base; base=base->next){
- Object *ob = base->object;
-
- /* See if an object is parented to this armature */
- if (ob->parent && ob->partype==PARBONE && (ob->parent->type==OB_ARMATURE) && (ob->parent->data == G.obedit->data)){
- if (!strcmp(ob->parsubstr, eBone->oldname))
- strcpy(ob->parsubstr, eBone->name);
- }
- }
-
- exit_editmode(0); /* To ensure new names make it to the edit armature */
-
-}
void deselectall_armature(void)
/* Actually, it toggles selection, deselecting
@@ -2098,7 +1849,7 @@ static int editbone_name_exists (char *name){
}
-static void unique_editbone_name (char *name){
+void unique_editbone_name (char *name){
char tempname[64];
int number;
char *dot;
diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c
index 2ac25d1283d..574e55b03e5 100644
--- a/source/blender/src/editconstraint.c
+++ b/source/blender/src/editconstraint.c
@@ -41,6 +41,7 @@
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index cb8b120fcb6..d1b520260d9 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -106,6 +106,7 @@ void set_lasttface()
int a;
lasttface= 0;
+ if(OBACT==NULL || OBACT->type!=OB_MESH) return;
me= get_mesh(OBACT);
if(me==0 || me->tface==0) return;
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index f870173004a..ac7992dfc03 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -3762,7 +3762,7 @@ void common_insertkey()
}
}
}
- else if(G.buts->mainb==CONTEXT_TYPES) {
+ else if(G.buts->mainb==CONTEXT_EDITING) {
ob= OBACT;
if(ob && ob->type==OB_CAMERA) {
id= G.buts->lockpoin;
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 20434766fd1..37edc66a74b 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -916,7 +916,7 @@ static ScrArea *screen_find_area_for_pt(bScreen *sc, short *mval)
void screenmain(void)
{
- int has_input= 0; /* was one, why! (ton) */
+ int has_input= 1;
int firsttime = 1;
window_make_active(mainwin);
@@ -1165,7 +1165,13 @@ void setprefsize(int stax, int stay, int sizx, int sizy)
if(sizy<256) sizy= 256;
if(stax+sizx>scrwidth) sizx= scrwidth-stax;
+
if(stay+sizy>scrheight) sizy= scrheight-stay;
+
+#ifdef __APPLE__
+ if(stay+sizy>scrheight-22) sizy= scrheight-22-stay; // 22 = topbar
+#endif
+
if(sizx<320 || sizy<256) {
printf("ERROR: illegal prefsize\n");
return;
diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c
index cf29efd71b8..e4fa0429d28 100644
--- a/source/blender/src/ghostwinlay.c
+++ b/source/blender/src/ghostwinlay.c
@@ -229,6 +229,10 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
int scr_w, scr_h;
winlay_get_screensize(&scr_w, &scr_h);
+ if(G.f & G_DEBUG) {
+ printf("screen size %d %d\n", scr_w, scr_h);
+ printf("win start %d %d size %d %d\n", posx, posy, sizex, sizey);
+ }
posy= (scr_h-posy-sizey);
/* create a fullscreen window on unix by default*/
@@ -241,7 +245,7 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
inital_state= GHOST_kWindowStateFullScreen;
else
inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
-#else
+#else // APPLE
inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
#endif
#endif
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
index c612a56a950..b9b34f30c6e 100644
--- a/source/blender/src/header_buttonswin.c
+++ b/source/blender/src/header_buttonswin.c
@@ -69,6 +69,8 @@
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_space.h"
+#include "BIF_butspace.h"
+
#include "BKE_armature.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -252,7 +254,7 @@ void buttons_active_id(ID **id, ID **idfrom)
*id= (ID *)ob;
}
}
- else if(G.buts->mainb==CONTEXT_TYPES || G.buts->mainb==CONTEXT_EDITING) {
+ else if(G.buts->mainb==CONTEXT_EDITING) {
if(ob && ob->data) {
*id= ob->data;
}
@@ -352,11 +354,10 @@ static uiBlock *sbuts_context_menu(void *arg_unused)
/* should be branches from tree */
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCENE_DEHLT, "Scene|F10", 0, yco-=22, 100, 20, &G.buts->mainb, 0.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_EDIT, "Editing|F9", 0, yco-=22, 100, 20, &G.buts->mainb, 4.0, 0.0, 0, 0, "");
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_OBJECT, "Object|F8", 0, yco-=22, 100, 20, &G.buts->mainb, 1.0, 0.0, 0, 0, "");
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_BBOX, "Types|F7", 0, yco-=22, 100, 20, &G.buts->mainb, 2.0, 0.0, 0, 0, "");
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCRIPT, "Script|F6", 0, yco-=22, 100, 20, &G.buts->mainb, 5.0, 0.0, 0, 0, "");
+ uiDefIconTextButS(block, BUTM, B_REDR, ICON_OBJECT, "Object|F6", 0, yco-=22, 100, 20, &G.buts->mainb, 1.0, 0.0, 0, 0, "");
+ uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCRIPT, "Script", 0, yco-=22, 100, 20, &G.buts->mainb, 5.0, 0.0, 0, 0, "");
+ uiDefIconTextButS(block, BUTM, B_REDR, ICON_GAME, "Logic", 0, yco-=22, 100, 20, &G.buts->mainb, 6.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_MATERIAL_DEHLT, "Shading|F5", 0, yco-=22, 100, 20, &G.buts->mainb, 3.0, 0.0, 0, 0, "");
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_GAME, "Logic|F4", 0, yco-=22, 100, 20, &G.buts->mainb, 6.0, 0.0, 0, 0, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
@@ -369,6 +370,7 @@ static uiBlock *sbuts_context_menu(void *arg_unused)
return block;
}
+
void buts_buttons(void)
{
ID *id, *idfrom;
@@ -413,18 +415,17 @@ void buts_buttons(void)
}
/* select the context to be drawn, per contex/tab the actual context is tested */
+ uiBlockSetEmboss(block, UI_EMBOSSX); // normal
switch(G.buts->mainb) {
case CONTEXT_SCENE:
- uiDefIconButC(block, ROW, B_REDR, ICON_SCENE, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_RENDER, 0, 0, "Display buttons (F10)");
- uiDefIconButC(block, ROW, B_BUTSPREVIEW,ICON_WORLD, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_WORLD, 0, 0, "World buttons");
+ uiDefIconButC(block, ROW, B_REDR, ICON_SCENE, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_RENDER, 0, 0, "Render buttons ");
+ uiDefIconButC(block, ROW, B_REDR, ICON_ANIM, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_ANIM, 0, 0, "Anim/playback buttons");
+ uiDefIconButC(block, ROW, B_REDR, ICON_SOUND, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_SOUND, 0, 0, "Sound block buttons");
break;
case CONTEXT_OBJECT:
break;
- case CONTEXT_TYPES:
-
- break;
case CONTEXT_SHADING:
uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_LAMP, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_LAMP, 0, 0, "Lamp buttons");
uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL, xco+=XIC, t_base, XIC, YIC, &(G.buts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_MAT, 0, 0, "Material buttons");
@@ -445,19 +446,6 @@ void buts_buttons(void)
}
#if 0
- xco+= 2*XIC;
- uiDefIconButS(block, ROW, B_REDR, ICON_EYE, xco+=XIC, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_VIEW, 0, 0, "View buttons");
-
- uiDefIconButS(block, ROW, B_REDR, ICON_ANIM, xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_ANIM, 0, 0, "Animation buttons (F7)");
- uiDefIconButS(block, ROW, B_REDR, ICON_GAME, xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_GAME, 0, 0, "Realtime buttons (F8)");
- uiDefIconButS(block, ROW, B_REDR, ICON_EDIT, xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_EDIT, 0, 0, "Edit buttons (F9)");
- uiDefIconButS(block, ROW, B_REDR, ICON_CONSTRAINT,xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_CONSTRAINT, 0, 0, "Constraint buttons");
- uiDefIconButS(block, ROW, B_REDR, ICON_SPEAKER,xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_SOUND, 0, 0, "Sound buttons");
- uiDefIconButS(block, ROW, B_REDR, ICON_PAINT,xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_FPAINT, 0, 0, "Paint buttons");
- uiDefIconButS(block, ROW, B_REDR, ICON_SCRIPT,xco+=30, t_base, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_SCRIPT, 0, 0, "Script buttons");
- uiDefIconButS(block, ROW, B_REDR, ICON_SCENE, xco+=30, t_base, 50, YIC, &(G.buts->mainb), 1.0, (float)BUTS_RENDER, 0, 0, "Display buttons (F10)");
- xco+= 80;
-
uiBlockSetCol(block, BUTGREY);
uiBlockSetEmboss(block, UI_EMBOSSX);
@@ -621,10 +609,6 @@ void buts_buttons(void)
xco+= 80;
#endif
- // memory for finding which texture you'd like to see
- G.buts->mainbo= G.buts->mainb;
- G.buts->tabo= G.buts->tab[G.buts->mainb];
-
/* always do as last */
uiDrawBlock(block);
curarea->headbutlen= xco;
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 7d5b3caf66f..65432429fde 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -148,6 +148,7 @@
#include "BIF_usiblender.h"
#include "BIF_previewrender.h"
#include "BIF_writeimage.h"
+#include "BIF_butspace.h"
#include "BSE_edit.h"
#include "BSE_filesel.h"
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index e04518c2c55..6ea39293b7b 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -2816,6 +2816,7 @@ static void ui_warp_pointer(short x, short y)
#endif
}
+#if 0
static int ui_do_but_MENUo(uiBut *but)
{
uiBlock *block;
@@ -2956,6 +2957,7 @@ static int ui_do_but_MENUo(uiBut *but)
return event;
}
+#endif
static int ui_do_but_MENU(uiBut *but)
{
@@ -4193,8 +4195,10 @@ static void setup_file(uiBlock *block)
else {
but= block->buttons.first;
while(but) {
- if(but->rt[3]==1)
- fprintf(fp,"%d,%d,%d,%d %s %s\n", (int)but->x1, (int)but->y1, (int)( but->x2-but->x1), (int)(but->y2-but->y1), but->str, but->tip);
+ // if(but->rt[3]==1) {
+ ui_check_but(but);
+ fprintf(fp,"%d,%d,%d,%d %s %s\n", (int)but->x1, (int)but->y1, (int)( but->x2-but->x1), (int)(but->y2-but->y1), but->str, but->tip);
+ // }
but= but->next;
}
fclose(fp);
@@ -5251,6 +5255,9 @@ void uiFreeBlock(uiBlock *block)
ui_free_but(but);
}
+ if(block->panel) block->panel->active= 0;
+
+
MEM_freeN(block);
UIbuttip= NULL;
}
@@ -5349,6 +5356,7 @@ static void ui_check_but(uiBut *but)
switch( but->type ) {
case MENU:
+ case ICONTEXTROW:
if(but->x2 - but->x1 > 24) {
value= ui_get_but_val(but);
@@ -5404,8 +5412,10 @@ static void ui_check_but(uiBut *but)
}
- if(but->drawstr[0])
+ if(but->drawstr[0]) {
but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr, (U.transopts & TR_BUTTONS));
+ // here should be check for less space for icon offsets...
+ }
else
but->strwidth= 0;
@@ -5414,32 +5424,45 @@ static void ui_check_but(uiBut *but)
but->x2= (but->x1+but->strwidth+6);
}
- /* calc but->ofs, to draw the string shorter if too long */
- but->ofs= 0;
- while(but->strwidth > (int)(but->x2-but->x1-7) ) {
- but->ofs++;
-
- if(but->drawstr[but->ofs])
- but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS));
- else but->strwidth= 0;
-
- /* textbut exception */
- if(but->pos != -1) {
- pos= but->pos+strlen(but->str);
- if(pos-1 < but->ofs) {
- pos= but->ofs-pos+1;
- but->ofs -= pos;
- if(but->ofs<0) {
- but->ofs= 0;
- pos--;
+ if(but->strwidth==0) but->drawstr[0]= 0;
+ else {
+
+ /* calc but->ofs, to draw the string shorter if too long */
+ but->ofs= 0;
+ while(but->strwidth > (int)(but->x2-but->x1-7) ) {
+ but->ofs++;
+
+ if(but->drawstr[but->ofs])
+ but->strwidth= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & TR_BUTTONS));
+ else but->strwidth= 0;
+
+ /* textbut exception */
+ if(but->pos != -1) {
+ pos= but->pos+strlen(but->str);
+ if(pos-1 < but->ofs) {
+ pos= but->ofs-pos+1;
+ but->ofs -= pos;
+ if(but->ofs<0) {
+ but->ofs= 0;
+ pos--;
+ }
+ but->drawstr[ strlen(but->drawstr)-pos ]= 0;
}
- but->drawstr[ strlen(but->drawstr)-pos ]= 0;
}
+
+ if(but->strwidth < 10) break;
}
- if(but->strwidth < 10) break;
+ /* fix for buttons that better not have text cut off to the right */
+ if(but->ofs) {
+ if ELEM4(but->type, NUM, TEX, NUMSLI, HSVSLI); // only these cut off right
+ else {
+ but->drawstr[ strlen(but->drawstr)-but->ofs ]= 0;
+ but->ofs= 0;
+ }
+ }
}
-
+
/* test for min and max, icon sliders, etc */
switch( but->type ) {
@@ -5466,7 +5489,6 @@ static void ui_check_but(uiBut *but)
case ICONTEXTROW:
value= ui_get_but_val(but);
- ui_set_name_menu(but, (int)value);
but->iconadd= (int)value- (int)(but->min);
break;
}
@@ -6058,35 +6080,56 @@ short pupmenu_col(char *instr, int maxrow)
/* ofsx/ofsy only used for new panel definitions */
-void uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey)
+/* return 1 if visible (create buttons!) */
+int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey)
{
- Panel *pa;
+ Panel *pa, *palign;
/* check if Panel exists, then use that one */
pa= sa->panels.first;
while(pa) {
if( strncmp(pa->panelname, panelname, UI_MAX_NAME_STR)==0) {
if( strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0) {
- block->panel= pa;
- return;
+ break;
}
}
pa= pa->next;
}
- /* new panel */
- pa= MEM_callocN(sizeof(Panel), "new panel");
- BLI_addtail(&sa->panels, pa);
- strncpy(pa->panelname, panelname, UI_MAX_NAME_STR);
- strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
-
- pa->ofsx= ofsx & ~(PNL_GRID-1);
- pa->ofsy= ofsy & ~(PNL_GRID-1);
- pa->sizex= sizex;
- pa->sizey= sizey;
-
+ if(pa==NULL) {
+
+ /* new panel */
+ pa= MEM_callocN(sizeof(Panel), "new panel");
+ BLI_addtail(&sa->panels, pa);
+ strncpy(pa->panelname, panelname, UI_MAX_NAME_STR);
+ strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
+
+ pa->ofsx= ofsx & ~(PNL_GRID-1);
+ pa->ofsy= ofsy & ~(PNL_GRID-1);
+ pa->sizex= sizex;
+ pa->sizey= sizey;
+
+ /* pre align, for good sorting later on */
+ if(sa->spacetype==SPACE_BUTS && pa->prev) {
+ SpaceButs *sbuts= sa->spacedata.first;
+
+ palign= pa->prev;
+ if(sbuts->align==BUT_VERTICAL) {
+ pa->ofsy= palign->ofsy - pa->sizey - PNL_HEADER;
+ }
+ else if(sbuts->align==BUT_HORIZONTAL) {
+ pa->ofsx= palign->ofsx + palign->sizex;
+ }
+ }
+ }
+
block->panel= pa;
+ pa->active= 1;
+ if(block->panel->paneltab) return 0;
+ if(block->panel->flag & PNL_CLOSED) return 0;
+
+ return 1;
}
void uiFreePanels(ListBase *lb)
@@ -6099,6 +6142,16 @@ void uiFreePanels(ListBase *lb)
}
}
+void uiNewPanelHeight(uiBlock *block, int sizey)
+{
+ if(sizey<64) sizey= 64;
+
+ if(block->panel) {
+ block->panel->ofsy+= (block->panel->sizey - sizey);
+ block->panel->sizey= sizey;
+ }
+}
+
static int panel_has_tabs(Panel *panel)
{
Panel *pa= curarea->panels.first;
@@ -6116,7 +6169,7 @@ void uiScalePanelBlock(uiBlock *block)
{
uiBut *but;
float facx= 1.0, facy= 1.0;
- int centrex= 0, tabsy;
+ int centrex= 0, topy=0, tabsy;
if(block->panel==NULL) return;
@@ -6129,16 +6182,17 @@ void uiScalePanelBlock(uiBlock *block)
else centrex= (block->panel->sizex-( block->maxx-block->minx ) - PNL_SAFETY)/2;
tabsy= PNL_HEADER*panel_has_tabs(block->panel);
- if( block->maxy-block->miny > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
+ if( (block->maxy-block->miny) > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
facy= (block->panel->sizey - (2*PNL_SAFETY) - tabsy)/( block->maxy-block->miny );
}
+ else topy= (block->panel->sizey- 2*PNL_SAFETY - tabsy) - ( block->maxy-block->miny ) ;
but= block->buttons.first;
while(but) {
but->x1= PNL_SAFETY+centrex+ facx*(but->x1-block->minx);
- but->y1= PNL_SAFETY+ facy*(but->y1-block->miny);
+ but->y1= PNL_SAFETY+topy + facy*(but->y1-block->miny);
but->x2= PNL_SAFETY+centrex+ facx*(but->x2-block->minx);
- but->y2= PNL_SAFETY+ facy*(but->y2-block->miny);
+ but->y2= PNL_SAFETY+topy + facy*(but->y2-block->miny);
if(facx!=1.0) ui_check_but(but); /* for strlen */
but= but->next;
}
@@ -6153,40 +6207,32 @@ void uiSetPanel_view2d(ScrArea *sa)
{
Panel *pa;
float minx=10000, maxx= -10000, miny=10000, maxy= -10000;
-
- if(sa->panels.first==NULL) return;
+ int done=0;
pa= sa->panels.first;
while(pa) {
- if(pa->ofsx < minx) minx= pa->ofsx;
- if(pa->ofsx+pa->sizex > maxx) maxx= pa->ofsx+pa->sizex;
- if(pa->ofsy < miny) miny= pa->ofsy;
- if(pa->ofsy+pa->sizey+PNL_HEADER > maxy) maxy= pa->ofsy+pa->sizey+PNL_HEADER;
-
+ if(pa->active) {
+ done= 1;
+ if(pa->ofsx < minx) minx= pa->ofsx;
+ if(pa->ofsx+pa->sizex > maxx) maxx= pa->ofsx+pa->sizex;
+ if(pa->ofsy < miny) miny= pa->ofsy;
+ if(pa->ofsy+pa->sizey+PNL_HEADER > maxy) maxy= pa->ofsy+pa->sizey+PNL_HEADER;
+ }
pa= pa->next;
}
-
- G.v2d->tot.xmin= minx-PNL_DIST;
- G.v2d->tot.xmax= maxx+PNL_DIST;
- G.v2d->tot.ymin= miny-PNL_DIST;
- G.v2d->tot.ymax= maxy+PNL_DIST;
-
-
-}
-
-int uiIsPanelClosed(uiBlock *block)
-{
- if(block->panel && block->panel->paneltab) {
- /* needed for min max */
- uiBoundsBlock(block, 0);
- return 1;
+ if(done) {
+ G.v2d->tot.xmin= minx-PNL_DIST;
+ G.v2d->tot.xmax= maxx+PNL_DIST;
+ G.v2d->tot.ymin= miny-PNL_DIST;
+ G.v2d->tot.ymax= maxy+PNL_DIST;
}
- else if(block->panel && (block->panel->flag & PNL_CLOSED)) {
- /* draw does bounds too */
- uiDrawBlock(block);
- return 1;
+ else {
+ G.v2d->tot.xmin= 0;
+ G.v2d->tot.xmax= 1280;
+ G.v2d->tot.ymin= 0;
+ G.v2d->tot.ymax= 228;
}
- return 0;
+
}
static void ui_panel_push(uiBlock *block)
@@ -6258,7 +6304,7 @@ static void ui_draw_panel_tabs(uiBlock *block)
/* count */
pa= curarea->panels.first;
while(pa) {
- if(pa!=panel) {
+ if(pa->active) {
if(pa->paneltab==panel) nr++;
}
pa= pa->next;
@@ -6272,7 +6318,8 @@ static void ui_draw_panel_tabs(uiBlock *block)
width= (panel->sizex - 2*PNL_SAFETY)/nr;
pa= curarea->panels.first;
while(pa) {
- if(pa==panel) {
+ if(pa->active==0);
+ else if(pa==panel) {
/* active tab */
uiSetRoundBox(12);
glColor3ub(160, 160, 167);
@@ -6407,137 +6454,121 @@ static int get_panel_real_ofsy(Panel *pa)
else return pa->ofsy;
}
+typedef struct PanelSort {
+ Panel *pa, *orig;
+} PanelSort;
-static Panel *find_highest_panel(ListBase *lb)
+static int find_leftmost_panel(const void *a1, const void *a2)
{
- Panel *pa, *patop=NULL;
- int top= -100000, extra;
+ const PanelSort *ps1=a1, *ps2=a2;
- pa= lb->first;
- while(pa) {
- /* sorting based at name to keep tabs in order too */
- extra= (pa->panelname[0]+pa->panelname[1] - 'A' - 'A')/4;
-
- if( pa->ofsy + pa->sizey + extra > top) {
- top= pa->ofsy + pa->sizey+extra;
- patop= pa;
- }
- pa= pa->next;
- }
-
- return patop;
+ if( ps1->pa->ofsx > ps2->pa->ofsx) return 1;
+ else if( ps1->pa->ofsx < ps2->pa->ofsx) return -1;
+ else if( ps1->pa->next == ps2->pa) return -1;
+ else if( ((long)ps1->pa) < ((long)ps2->pa)) return -1;
+ else if( ((long)ps1->pa) > ((long)ps2->pa)) return 1;
+
+ return 0;
}
-static Panel *find_leftmost_panel(ListBase *lb)
+
+static int find_highest_panel(const void *a1, const void *a2)
{
- Panel *pa, *paleft=NULL;
- int left= 100000, extra;
+ const PanelSort *ps1=a1, *ps2=a2;
- pa= lb->first;
- while(pa) {
- /* sorting based at name to keep tabs in order too */
- extra= (pa->panelname[0]+pa->panelname[1] - 'A' - 'A')/4;
-
- if( pa->ofsx + extra < left) {
- left= pa->ofsx + extra;
- paleft= pa;
- }
- pa= pa->next;
- }
- return paleft;
-
+ if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
+ else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
+ else if( ((long)ps1->pa) < ((long)ps2->pa)) return -1;
+ else if( ((long)ps1->pa) > ((long)ps2->pa)) return 1;
+
+ return 0;
}
-
-/* this also animates */
-static void ui_align_panel_step(ScrArea *sa, float fac)
+/* this doesnt draw */
+/* returns 1 when it did something */
+int uiAlignPanelStep(ScrArea *sa, float fac)
{
SpaceButs *sbuts= sa->spacedata.first;
- ListBase lb1= {NULL, NULL};
- Panel *pa, *panel, *next;
-
- /* find the desired positions of current panels first */
- /* sorting */
- while(sa->panels.first) {
- if(sbuts->align==BUT_VERTICAL)
- pa= find_highest_panel(&sa->panels);
- else
- pa= find_leftmost_panel(&sa->panels);
-
- if(pa==NULL) printf("panel sort error (crash!)\n");
- BLI_remlink(&sa->panels, pa);
- BLI_addtail(&lb1, pa);
+ Panel *pa;
+ PanelSort *ps, *panelsort, *psnext;
+ int a, tot=0, done;
+
+ if(sa->spacetype!=SPACE_BUTS) {
+ printf("align not supported yet here\n");
+ return 0;
+ }
+
+ /* count active, not tabbed Panels */
+ for(pa= sa->panels.first; pa; pa= pa->next) {
+ if(pa->active && pa->paneltab==NULL) tot++;
}
- /* put back sorted */
- sa->panels = lb1;
- /* make copy */
- duplicatelist(&lb1, &sa->panels);
+ if(tot==0) return 0;
- /* now we fill in lb1 panels the desired location */
- pa= lb1.first;
- /* but, we start with the first panel that's not a tab */
- while(pa) {
- if(pa->paneltab==NULL) break;
- pa= pa->next;
+ panelsort= MEM_callocN( tot*sizeof(PanelSort), "panelsort");
+
+ /* fill panelsort array */
+ ps= panelsort;
+ for(pa= sa->panels.first; pa; pa= pa->next) {
+ if(pa->active && pa->paneltab==NULL) {
+ ps->pa= MEM_dupallocN(pa);
+ ps->orig= pa;
+ ps++;
+ }
}
+ if(sbuts->align==BUT_VERTICAL)
+ qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
+ else
+ qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
+
+ /* now we fill in copied panels the desired location */
/* default startloc current view2d topleft corner */
- pa->ofsx= sbuts->v2d.tot.xmin+PNL_DIST;
- pa->ofsy= sbuts->v2d.tot.ymax-PNL_DIST- pa->sizey-PNL_HEADER;
-
- if(sbuts->align==BUT_VERTICAL) {
- next= pa->next;
- while(next) {
- if(next->paneltab==NULL) {
- next->ofsx = pa->ofsx;
- next->ofsy = get_panel_real_ofsy(pa) - pa->sizey-PNL_HEADER-PNL_DIST;
- pa= next;
- }
- next= next->next;
+ ps= panelsort;
+ ps->pa->ofsx= sbuts->v2d.tot.xmin;
+ ps->pa->ofsy= sbuts->v2d.tot.ymax- ps->pa->sizey-PNL_HEADER;
+ for(a=0 ; a<tot-1; a++, ps++) {
+ psnext= ps+1;
+
+ if(sbuts->align==BUT_VERTICAL) {
+ psnext->pa->ofsx = ps->pa->ofsx;
+ psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - ps->pa->sizey-PNL_HEADER-PNL_DIST;
}
- }
- else {
- next= pa->next;
- while(next) {
- if(next->paneltab==NULL) {
- next->ofsx = pa->ofsx + pa->sizex+PNL_DIST;
- next->ofsy = pa->ofsy;
- pa= next;
- }
- next= next->next;
+ else {
+ psnext->pa->ofsx = ps->pa->ofsx + ps->pa->sizex+PNL_DIST;
+ psnext->pa->ofsy = ps->pa->ofsy;
}
}
/* we interpolate */
- panel= sa->panels.first;
- pa= lb1.first;
- while(panel && pa) {
-
- if( (panel->flag & PNL_SELECT)==0) {
- panel->ofsx= floor(0.5 + fac*pa->ofsx + (1.0-fac)*panel->ofsx);
- panel->ofsy= floor(0.5 + fac*pa->ofsy + (1.0-fac)*panel->ofsy);
+ done= 0;
+ ps= panelsort;
+ for(a=0; a<tot; a++, ps++) {
+ if( (ps->pa->flag & PNL_SELECT)==0) {
+ if( (ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
+ ps->orig->ofsx= floor(0.5 + fac*ps->pa->ofsx + (1.0-fac)*ps->orig->ofsx);
+ ps->orig->ofsy= floor(0.5 + fac*ps->pa->ofsy + (1.0-fac)*ps->orig->ofsy);
+ done= 1;
+ }
}
- panel= panel->next;
- pa= pa->next;
}
-
- BLI_freelistN(&lb1);
-
+
/* copy locations to tabs */
- panel= sa->panels.first;
- while(panel) {
- if(panel->paneltab) {
- panel->ofsx= panel->paneltab->ofsx;
- panel->ofsy= panel->paneltab->ofsy;
+ for(pa= sa->panels.first; pa; pa= pa->next) {
+ if(pa->paneltab && pa->active) {
+ pa->ofsx= pa->paneltab->ofsx;
+ pa->ofsy= pa->paneltab->ofsy;
}
- panel= panel->next;
}
+
+ /* free panelsort array */
+ ps= panelsort;
+ for(a=0; a<tot; a++, ps++) {
+ MEM_freeN(ps->pa);
+ }
+ MEM_freeN(panelsort);
- /* warn: this re-allocs uiblocks! */
- scrarea_do_windraw(curarea);
- ui_redraw_select_panel(curarea);
- screen_swapbuffers();
+ return done;
}
@@ -6551,7 +6582,17 @@ void uiAnimatePanels(ScrArea *sa)
/* for max 1 second, interpolate positions */
while(TRUE) {
- ui_align_panel_step(sa, fac);
+ if( uiAlignPanelStep(sa, fac) ) {
+ /* warn: this re-allocs uiblocks! */
+ scrarea_do_windraw(curarea);
+ ui_redraw_select_panel(curarea);
+ screen_swapbuffers();
+ }
+ else {
+ addqueue(curarea->win, REDRAW,1 ); // because 'Animate' is also called as redraw
+ break;
+ }
+
if(result >= 1.0) break;
if(result==0.0) { // firsttime
@@ -6571,6 +6612,58 @@ void uiAnimatePanels(ScrArea *sa)
}
}
+/* only draws blocks with panels */
+void uiDrawBlocksPanels(ScrArea *sa, int re_align)
+{
+ uiBlock *block;
+ Panel *panot, *panew, *patest;
+
+ /* scaling contents */
+ block= sa->uiblocks.first;
+ while(block) {
+ if(block->panel) uiScalePanelBlock(block);
+ block= block->next;
+ }
+
+ /* consistancy; are panels not made, whilst they have tabs */
+ for(panot= sa->panels.first; panot; panot= panot->next) {
+ if(panot->active==0) { // not made
+
+ for(panew= sa->panels.first; panew; panew= panew->next) {
+ if(panew->active) {
+ if(panew->paneltab==panot) { // panew is tab in notmade pa
+ break;
+ }
+ }
+ }
+ /* now panew can become the new parent, check all other tabs */
+ if(panew) {
+ for(patest= sa->panels.first; patest; patest= patest->next) {
+ if(patest->paneltab == panot) {
+ patest->paneltab= panew;
+ }
+ }
+ panot->paneltab= panew;
+ panew->paneltab= NULL;
+ addqueue(sa->win, REDRAW, 1); // the buttons panew were not made
+ }
+ }
+ }
+
+ /* re-align */
+ if(re_align) uiAlignPanelStep(sa, 1.0);
+
+ /* draw */
+ block= sa->uiblocks.first;
+ while(block) {
+ if(block->panel) uiDrawBlock(block);
+ block= block->next;
+ }
+
+}
+
+
+
/* ------------ panel merging ---------------- */
static void check_panel_overlap(ScrArea *sa, Panel *panel)
@@ -6582,7 +6675,7 @@ static void check_panel_overlap(ScrArea *sa, Panel *panel)
while(pa) {
pa->flag &= ~PNL_OVERLAP;
if(panel && (pa != panel)) {
- if(pa->paneltab==NULL) {
+ if(pa->paneltab==NULL && pa->active) {
float safe= 0.2;
if(pa->flag & PNL_CLOSED) safe= 0.05;
@@ -6606,8 +6699,10 @@ static void test_add_new_tabs(ScrArea *sa)
pa= sa->panels.first;
while(pa) {
- if(pa->flag & PNL_SELECT) pasel= pa;
- if(pa->flag & PNL_OVERLAP) palap= pa;
+ if(pa->active) {
+ if(pa->flag & PNL_SELECT) pasel= pa;
+ if(pa->flag & PNL_OVERLAP) palap= pa;
+ }
pa= pa->next;
}
@@ -6661,6 +6756,11 @@ static void ui_drag_panel(uiBlock *block)
Panel *panel= block->panel;
short first=1, ofsx, ofsy, dx, dy, dxo=0, dyo=0, mval[2], mvalo[2];
+ if(curarea->spacetype!=SPACE_BUTS) {
+ printf("align not supported yet here\n");
+ return;
+ }
+
uiGetMouse(block->win, mvalo);
ofsx= block->panel->ofsx;
ofsy= block->panel->ofsy;
@@ -6671,10 +6771,14 @@ static void ui_drag_panel(uiBlock *block)
if( !(get_mbut() & L_MOUSE) ) break;
- uiGetMouse(mywinget(), mval);
- dx= (mval[0]-mvalo[0]) & ~(PNL_GRID-1);
- dy= (mval[1]-mvalo[1]) & ~(PNL_GRID-1);
-
+ /* first clip for window, no dragging outside */
+ getmouseco_areawin(mval);
+ if( mval[0]>0 && mval[0]<curarea->winx && mval[1]>0 && mval[1]<curarea->winy) {
+ uiGetMouse(mywinget(), mval);
+ dx= (mval[0]-mvalo[0]) & ~(PNL_GRID-1);
+ dy= (mval[1]-mvalo[1]) & ~(PNL_GRID-1);
+ }
+
if(dx!=dxo || dy!=dyo || first) {
dxo= dx; dyo= dy;
first= 0;
@@ -6684,13 +6788,12 @@ static void ui_drag_panel(uiBlock *block)
check_panel_overlap(curarea, panel);
+ if(sbuts->align) uiAlignPanelStep(curarea, 0.2);
+
/* warn: this re-allocs blocks! */
- if(sbuts->align==0) {
- scrarea_do_windraw(curarea);
- ui_redraw_select_panel(curarea);
- screen_swapbuffers();
- }
- else ui_align_panel_step(curarea, 0.2);
+ scrarea_do_windraw(curarea);
+ ui_redraw_select_panel(curarea);
+ screen_swapbuffers();
/* so, we find the new block */
block= curarea->uiblocks.first;
@@ -6831,8 +6934,13 @@ static void ui_do_panel(uiBlock *block, uiEvent *uevent)
SpaceButs *sbuts= curarea->spacedata.first;
Panel *pa;
+ if(curarea->spacetype!=SPACE_BUTS) {
+ printf("align not supported yet here\n");
+ return;
+ }
+
/* mouse coordinates in panel space! */
-
+
if(uevent->event==LEFTMOUSE && block->panel->paneltab==NULL) {
/* check if clicked in tabbed area */
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index b6c4d68b406..4195b33a8e5 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -76,6 +76,7 @@
#include "BIF_gl.h"
#include "BIF_screen.h"
#include "BIF_space.h" /* allqueue */
+#include "BIF_butspace.h"
#include "BIF_drawimage.h" /* rectwrite_part */
#include "BIF_mywindow.h"
#include "PIL_time.h"
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index f2a3436c249..4e37b3a9758 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -2168,11 +2168,23 @@ void extern_set_butspace(int fkey)
sbuts= sa->spacedata.first;
- if(fkey==F4KEY) sbuts->mainb= CONTEXT_LOGIC;
- else if(fkey==F5KEY) sbuts->mainb= CONTEXT_SHADING;
- else if(fkey==F6KEY) sbuts->mainb= CONTEXT_SCRIPT;
- else if(fkey==F7KEY) sbuts->mainb= CONTEXT_TYPES;
- else if(fkey==F8KEY) sbuts->mainb= CONTEXT_OBJECT;
+ if(fkey==F4KEY) {
+ sbuts->mainb= CONTEXT_SHADING;
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ }
+ else if(fkey==F5KEY) {
+ sbuts->mainb= CONTEXT_SHADING;
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ }
+ else if(fkey==F6KEY) {
+ sbuts->mainb= CONTEXT_SHADING;
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
+ }
+ else if(fkey==F7KEY) sbuts->mainb= CONTEXT_OBJECT;
+ else if(fkey==F8KEY) {
+ sbuts->mainb= CONTEXT_SHADING;
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
+ }
else if(fkey==F9KEY) sbuts->mainb= CONTEXT_EDITING;
else if(fkey==F10KEY) sbuts->mainb= CONTEXT_SCENE;
@@ -3169,6 +3181,8 @@ void allqueue(unsigned short event, short val)
case REDRAWBUTSALL:
if(sa->spacetype==SPACE_BUTS) {
+ buts= sa->spacedata.first;
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3182,6 +3196,7 @@ void allqueue(unsigned short event, short val)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
if(buts->mainb==CONTEXT_SCENE) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3191,15 +3206,7 @@ void allqueue(unsigned short event, short val)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
if(buts->mainb==CONTEXT_OBJECT) {
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
- case REDRAWBUTSTYPES:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_TYPES) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3209,6 +3216,7 @@ void allqueue(unsigned short event, short val)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
if(buts->mainb==CONTEXT_SHADING) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3218,6 +3226,7 @@ void allqueue(unsigned short event, short val)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
if(buts->mainb==CONTEXT_EDITING) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3227,6 +3236,7 @@ void allqueue(unsigned short event, short val)
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
if(buts->mainb==CONTEXT_SCRIPT) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}
@@ -3244,7 +3254,8 @@ void allqueue(unsigned short event, short val)
case REDRAWBUTSLAMP:
if(sa->spacetype==SPACE_BUTS) {
buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_SHADING || buts->mainb==CONTEXT_TYPES) {
+ if(buts->mainb==CONTEXT_SHADING) {
+ buts->re_align= 1;
scrarea_queue_winredraw(sa);
scrarea_queue_headredraw(sa);
}