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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
/* 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
|
||||
|
||||
/* -------------- event defines ------------ */
|
||||
/* 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
|
||||
|
||||
#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->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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
482
source/blender/include/butspace.h
Normal file
482
source/blender/include/butspace.h
Normal file
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2057
source/blender/src/buttons_editing.c
Normal file
2057
source/blender/src/buttons_editing.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
903
source/blender/src/buttons_object.c
Normal file
903
source/blender/src/buttons_object.c
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
82
source/blender/src/buttons_script.c
Normal file
82
source/blender/src/buttons_script.c
Normal file
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
85
source/blender/src/buttons_shading.c
Normal file
85
source/blender/src/buttons_shading.c
Normal file
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,17 +415,16 @@ 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");
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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->strwidth==0) but->drawstr[0]= 0;
|
||||
else {
|
||||
|
||||
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--;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
static Panel *find_leftmost_panel(ListBase *lb)
|
||||
{
|
||||
Panel *pa, *paleft=NULL;
|
||||
int left= 100000, extra;
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
|
||||
/* this also animates */
|
||||
static void ui_align_panel_step(ScrArea *sa, float fac)
|
||||
static int find_highest_panel(const void *a1, const void *a2)
|
||||
{
|
||||
const PanelSort *ps1=a1, *ps2=a2;
|
||||
|
||||
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 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;
|
||||
Panel *pa;
|
||||
PanelSort *ps, *panelsort, *psnext;
|
||||
int a, tot=0, done;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
/* put back sorted */
|
||||
sa->panels = lb1;
|
||||
|
||||
/* make copy */
|
||||
duplicatelist(&lb1, &sa->panels);
|
||||
|
||||
/* 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;
|
||||
if(sa->spacetype!=SPACE_BUTS) {
|
||||
printf("align not supported yet here\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
/* count active, not tabbed Panels */
|
||||
for(pa= sa->panels.first; pa; pa= pa->next) {
|
||||
if(pa->active && pa->paneltab==NULL) tot++;
|
||||
}
|
||||
|
||||
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;
|
||||
if(tot==0) return 0;
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
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 */
|
||||
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 {
|
||||
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 */
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user