Matt's lamp submenu.

And reorganized the #includes in editobject by "modules"
This commit is contained in:
2004-09-19 19:27:57 +00:00
parent 74cd2db337
commit c4a0a01a55
5 changed files with 148 additions and 39 deletions

View File

@@ -41,6 +41,7 @@ struct Material;
struct Base;
void add_object_draw(int type);
void add_objectLamp(short type);
void free_and_unlink_base(struct Base *base);
void delete_obj(int ok);
void make_track(void);

View File

@@ -113,6 +113,7 @@ void do_info_add_meshmenu(void *arg, int event);
void do_info_add_curvemenu(void *arg, int event);
void do_info_add_surfacemenu(void *arg, int event);
void do_info_add_metamenu(void *arg, int event);
void do_info_add_lampmenu(void *arg, int event);
void do_info_addmenu(void *arg, int event);
/* header_view3d.c */

View File

@@ -57,6 +57,8 @@
#include "IMB_imbuf_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
@@ -85,6 +87,10 @@
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BKE_constraint.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_utildefines.h"
#include "BKE_anim.h"
#include "BKE_blender.h"
#include "BKE_booleanops.h"
@@ -120,6 +126,7 @@
#include "BIF_space.h"
#include "BIF_toets.h"
#include "BIF_butspace.h"
#include "BIF_editconstraint.h"
#include "BIF_editdeform.h"
#include "BIF_editfont.h"
#include "BIF_editika.h"
@@ -152,13 +159,6 @@
#include "blendef.h"
#include "BKE_constraint.h"
#include "BIF_editconstraint.h"
#include "BKE_action.h"
#include "DNA_action_types.h"
#include "BKE_armature.h"
#include "DNA_armature_types.h"
#include "BIF_poseobject.h"
/* extern Lattice *copy_lattice(Lattice *lt); */
@@ -208,7 +208,24 @@ void add_object_draw(int type) /* for toolbox */
deselect_all_area_oops();
set_select_flag_oops();
allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
}
void add_objectLamp(short type)
{
Lamp *la;
/* this function also comes from an info window */
if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
if(G.obedit==0) {
add_object_draw(OB_LAMP);
base_init_from_view3d(BASACT, G.vd);
}
la = BASACT->object->data;
la->type = type;
allqueue(REDRAWALL, 0);
}
void free_and_unlink_base(Base *base)
@@ -4882,8 +4899,6 @@ static char *transform_mode_to_string(int mode)
't' -> Tilt
'w' -> Warp
'N' -> Shrink/Fatten
'V' -> Snap vertice
'e' -> Edge crease edit
*/
void transform(int mode)
{
@@ -8016,4 +8031,3 @@ void mirrormenu(void){
}
}

View File

@@ -1203,6 +1203,58 @@ static uiBlock *info_add_metamenu(void *arg_unused)
return block;
}
void do_info_add_lampmenu(void *arg, int event)
{
switch(event) {
case 0: /* lamp */
add_objectLamp(LA_LOCAL);
break;
case 1: /* sun */
add_objectLamp(LA_SUN);
break;
case 2: /* spot */
add_objectLamp(LA_SPOT);
break;
case 3: /* hemi */
add_objectLamp(LA_HEMI);
break;
case 4: /* area */
add_objectLamp(LA_AREA);
break;
case 5: /* YafRay photon lamp */
if (G.scene->r.renderer==R_YAFRAY)
add_objectLamp(LA_YF_PHOTON);
break;
default:
break;
}
allqueue(REDRAWINFO, 0);
}
static uiBlock *info_add_lampmenu(void *arg_unused)
{
/* static short tog=0; */
uiBlock *block;
short yco= 0;
block= uiNewBlock(&curarea->uiblocks, "add_lampmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_add_lampmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Sun|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Spot|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hemi|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Area|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
if (G.scene->r.renderer==R_YAFRAY)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Photon|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 5, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
return block;
}
void do_info_addmenu(void *arg, int event)
{
switch(event) {
@@ -1232,7 +1284,7 @@ void do_info_addmenu(void *arg, int event)
break;
case 7:
/* Lamp */
add_object_draw(OB_LAMP);
// add_object_draw(OB_LAMP);
break;
case 8:
/* Armature */
@@ -1264,10 +1316,15 @@ static uiBlock *info_addmenu(void *arg_unused)
uiDefIconTextBlockBut(block, info_add_metamenu, NULL, ICON_RIGHTARROW_THIN, "Meta", 0, yco-=20, 120, 19, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Empty", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 7, "");
// uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBlockBut(block, info_add_lampmenu, NULL, ICON_RIGHTARROW_THIN, "Lamp", 0, yco-=20, 120, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
/* armature needs 3d window to draw */
//uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 9, "");

View File

@@ -243,10 +243,9 @@ void tbox_setinfo(int x, int y)
if(addmode==0) {
switch(y) {
case 0: tbstr= "Mesh"; tbstr1= ">>"; keystr= ">>"; tbval=OB_MESH; break;
case 1: tbstr= "Curve"; tbstr1= ">>"; keystr= ">>"; tbval=OB_CURVE; ; break;
case 1: tbstr= "Curve"; tbstr1= ">>"; keystr= ">>"; tbval=OB_CURVE; break;
case 2: tbstr= "Surface"; tbstr1= ">>"; keystr= ">>"; tbval=OB_SURF; break;
case 3: tbstr= "Meta"; tbstr1= ">>"; keystr= ">>"; tbval=OB_MBALL;
break;
case 3: tbstr= "Meta"; tbstr1= ">>"; keystr= ">>"; tbval=OB_MBALL; break;
case 4: tbstr= "Text"; tbstr1= ""; keystr= ""; tbval=OB_FONT; tbfunc= add_primitiveFont; break;
case 5: tbstr= "Empty"; tbstr1= "A"; keystr= ""; tbval=OB_EMPTY; break;
case 6: tbstr= ""; tbstr1= ""; keystr= ""; tbval=0; break;
@@ -258,7 +257,7 @@ void tbox_setinfo(int x, int y)
case 12: tbstr= ""; tbstr1= ""; keystr= ""; tbval=0; break;
case 13: tbstr= ""; tbstr1= ""; keystr= ""; tbval=0; break;
}
if(tbstr1 && tbstr1[0]=='A') tbfunc= (void (*)(int) )add_object_draw;
if(tbstr1 && tbstr1[0]=='A') tbfunc= (void (*)(int))add_object_draw;
}
else if(addmode==OB_MESH) {
switch(y) {
@@ -1119,8 +1118,7 @@ short button(short *var, short min, short max, char *str)
if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10;
block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|
UI_BLOCK_ENTER_OK);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
x1=mval[0]-150;
y1=mval[1]-20;
@@ -1169,7 +1167,8 @@ short sbutton(char *var, float min, float max, char *str)
return 0;
}
short fbutton(float *var, float min, float max, float a1, float a2, char *str)
short fbutton(float *var, float min, float max, float a1, float a2,
char *str)
{
uiBlock *block;
ListBase listb={0, 0};
@@ -1317,7 +1316,8 @@ int do_clever_numbuts(char *name, int tot, int winevent)
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK);
/* WATCH IT: TEX BUTTON EXCEPTION */
/* WARNING: ONLY A SINGLE BIT-BUTTON POSSIBLE: WE WORK AT COPIED DATA! */
/* WARNING: ONLY A SINGLE BIT-BUTTON POSSIBLE: WE WORK AT COPIED DATA!
*/
uiDefBut(block, LABEL, 0, name, (short)(x1+15), (short)(y2-35), (short)(sizex-60), 19, 0, 1.0, 0.0, 0, 0, "");
@@ -1869,7 +1869,8 @@ static TBitem tb_view_dt[]= {
static TBitem tb_view_alignview[]= {
{ 0, "Centre View to Cursor|C", 'c', NULL},
{ 0, "Align Active Camera to View|Shift NumPad 0", TB_SHIFT|TB_PAD|'0', NULL},
{ 0, "Align Active Camera to View|Shift NumPad 0",
TB_SHIFT|TB_PAD|'0', NULL},
{ 0, "Align View to Selected|NumPad *", TB_PAD|'*', NULL},
{ -1, "", 0, tb_do_hotkey}};
@@ -2101,11 +2102,28 @@ static TBitem addmenu_meta[]= {
{ 0, "Meta Cube", 4, NULL},
{ -1, "", 0, do_info_add_metamenu}};
static TBitem addmenu_lamp[]= {
{ 0, "Lamp", 0, NULL},
{ 0, "Sun", 1, NULL},
{ 0, "Spot", 2, NULL},
{ 0, "Hemi", 3, NULL},
{ 0, "Area", 4, NULL},
{ -1, "", 0, do_info_add_lampmenu}};
static TBitem addmenu_YF_lamp[]= {
{ 0, "Lamp", 0, NULL},
{ 0, "Sun", 1, NULL},
{ 0, "Spot", 2, NULL},
{ 0, "Hemi", 3, NULL},
{ 0, "Area", 4, NULL},
{ 0, "Photon", 5, NULL},
{ -1, "", 0, do_info_add_lampmenu}};
static TBitem addmenu_armature[]= {
{ 0, "Bones", 8, NULL},
{ -1, "", 0, do_info_addmenu}};
static TBitem tb_add[]= {
{ 0, "Mesh", 0, addmenu_mesh},
{ 0, "Curve", 1, addmenu_curve},
@@ -2115,7 +2133,22 @@ static TBitem tb_add[]= {
{ 0, "Empty", 5, NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Camera", 6, NULL},
{ 0, "Lamp", 7, NULL},
{ 0, "Lamp", 7, addmenu_lamp},
{ 0, "SEPR", 0, NULL},
{ 0, "Armature", 8, NULL},
{ 0, "Lattice", 9, NULL},
{ -1, "", 0, do_info_addmenu}};
static TBitem tb_add_YF[]= {
{ 0, "Mesh", 0, addmenu_mesh},
{ 0, "Curve", 1, addmenu_curve},
{ 0, "Surface", 2, addmenu_surf},
{ 0, "Meta", 3, addmenu_meta},
{ 0, "Text", 4, NULL},
{ 0, "Empty", 5, NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Camera", 6, NULL},
{ 0, "Lamp", 7, addmenu_YF_lamp},
{ 0, "SEPR", 0, NULL},
{ 0, "Armature", 8, NULL},
{ 0, "Lattice", 9, NULL},
@@ -2200,7 +2233,11 @@ void toolbox_n(void)
if(curarea->spacetype==SPACE_VIEW3D) {
/* standard menu */
menu1= tb_object; str1= "Object";
if (G.scene->r.renderer==R_YAFRAY) {
menu2= tb_add_YF; str2= "Add";
} else {
menu2= tb_add; str2= "Add";
}
menu3= tb_object_select; str3= "Select";
menu4= tb_object_edit; str4= "Edit";
menu5= tb_transform; str5= "Transform";
@@ -2307,4 +2344,3 @@ void toolbox_n_add(void)
tb_mainy= -5;
toolbox_n();
}