diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-09-16 21:43:09 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-09-16 21:43:09 +0400 |
commit | deebf4f8f0d79169a0e6c2a391670419b6492bfe (patch) | |
tree | 2a0aaf4042aa78e9d1d835f4544e07c6123e67a9 /source/blender/editors/space_logic | |
parent | 6b0679a3999d8e5abc60730f523879eadbedcd8f (diff) |
merge with 2.5/trunk at r23271
Diffstat (limited to 'source/blender/editors/space_logic')
-rw-r--r-- | source/blender/editors/space_logic/logic_buttons.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 112 | ||||
-rw-r--r-- | source/blender/editors/space_logic/space_logic.c | 7 |
3 files changed, 72 insertions, 57 deletions
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index 58c1eddb6c1..304c3601cdd 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -124,13 +124,9 @@ static int logic_properties(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); ARegion *ar= logic_has_buttons_region(sa); - if(ar) { - ar->flag ^= RGN_FLAG_HIDDEN; - ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */ - - ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa); - ED_area_tag_redraw(sa); - } + if(ar) + ED_region_toggle_hidden(C, ar); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 06bd95f060f..4afa56582a2 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -28,6 +28,7 @@ #include <string.h> #include <stdio.h> +#include <float.h> #include "DNA_actuator_types.h" #include "DNA_controller_types.h" @@ -73,18 +74,10 @@ #include "logic_intern.h" - -/* XXX */ -static int pupmenu() {return 1;} -/* XXX */ - #define MAX_RENDER_PASS 100 #define B_REDR 1 #define B_IDNAME 2 -#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 @@ -204,7 +197,7 @@ static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view } -static void sca_move_sensor(bContext *C, void *datav, void *data2_unused) +static void sca_move_sensor(bContext *C, void *datav, void *move_up) { Scene *scene= CTX_data_scene(C); bSensor *sens_to_delete= datav; @@ -212,7 +205,8 @@ static void sca_move_sensor(bContext *C, void *datav, void *data2_unused) Base *base; bSensor *sens, *tmp; - val= pupmenu("Move up%x1|Move down %x2"); + // val= pupmenu("Move up%x1|Move down %x2"); + val = move_up ? 1:2; if(val>0) { /* now find out which object has this ... */ @@ -255,7 +249,7 @@ static void sca_move_sensor(bContext *C, void *datav, void *data2_unused) } } -static void sca_move_controller(bContext *C, void *datav, void *data2_unused) +static void sca_move_controller(bContext *C, void *datav, void *move_up) { Scene *scene= CTX_data_scene(C); bController *controller_to_del= datav; @@ -263,7 +257,8 @@ static void sca_move_controller(bContext *C, void *datav, void *data2_unused) Base *base; bController *cont, *tmp; - val= pupmenu("Move up%x1|Move down %x2"); + //val= pupmenu("Move up%x1|Move down %x2"); + val = move_up ? 1:2; if(val>0) { /* now find out which object has this ... */ @@ -309,7 +304,7 @@ static void sca_move_controller(bContext *C, void *datav, void *data2_unused) } } -static void sca_move_actuator(bContext *C, void *datav, void *data2_unused) +static void sca_move_actuator(bContext *C, void *datav, void *move_up) { Scene *scene= CTX_data_scene(C); bActuator *actuator_to_move= datav; @@ -317,7 +312,8 @@ static void sca_move_actuator(bContext *C, void *datav, void *data2_unused) Base *base; bActuator *act, *tmp; - val= pupmenu("Move up%x1|Move down %x2"); + //val= pupmenu("Move up%x1|Move down %x2"); + val = move_up ? 1:2; if(val>0) { /* now find out which object has this ... */ @@ -363,7 +359,6 @@ static void sca_move_actuator(bContext *C, void *datav, void *data2_unused) void do_logic_buts(bContext *C, void *arg, int event) { - bProperty *prop; bSensor *sens; bController *cont; bActuator *act; @@ -385,25 +380,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_SETMAINACTOR: ob->gameflag &= ~(OB_SECTOR|OB_PROP); break; - - - case B_ADD_PROP: - prop= new_property(PROP_FLOAT); - make_unique_prop_names(C, prop->name); - BLI_addtail(&ob->prop, prop); - ED_undo_push(C, "Add property"); - break; -#if 0 // XXX Now done in python - case B_CHANGE_PROP: - prop= ob->prop.first; - while(prop) { - if(prop->type!=prop->otype) { - init_property(prop); - } - prop= prop->next; - } - break; -#endif + case B_ADD_SENS: for(ob=G.main->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDSENS) { @@ -1002,6 +979,7 @@ static void draw_default_sensor_header(bSensor *sens, uiBut *but; /* Pulsing and frequency */ + uiBlockBeginAlign(block); uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP, (short)(x + 10 + 0. * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19, &sens->pulse, 0.0, 0.0, 0, 0, @@ -1015,8 +993,10 @@ static void draw_default_sensor_header(bSensor *sens, (short)(x + 10 + 0.2 * (w-20)), (short)(y - 21), (short)(0.275 * (w-20)), 19, &sens->freq, 0.0, 10000.0, 0, 0, "Delay between repeated pulses (in logic tics, 0 = no delay)"); + uiBlockEndAlign(block); /* value or shift? */ + uiBlockBeginAlign(block); but= uiDefButS(block, TOG, 1, "Level", (short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19, &sens->level, 0.0, 0.0, 0, 0, @@ -1027,6 +1007,7 @@ static void draw_default_sensor_header(bSensor *sens, &sens->tap, 0.0, 0.0, 0, 0, "Trigger controllers only for an instant, even while the sensor remains true"); uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->tap)); + uiBlockEndAlign(block); uiDefButS(block, TOG, 1, "Inv", (short)(x + 10 + 0.85 * (w-20)), (short)(y - 21), (short)(0.15 * (w-20)), 19, @@ -1553,7 +1534,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco uiBlockBeginAlign(block); uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)"); if(pc->mode==0) - uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script"); + uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script"); else { uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, 63, 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used"); uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", (xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the module from disk for editing external modules without restarting"); @@ -1665,7 +1646,8 @@ char *get_state_name(Object *ob, short bit) static void check_state_mask(bContext *C, void *arg1_but, void *arg2_mask) { - int shift= 0; // XXX + wmWindow *win= CTX_wm_window(C); + int shift= win->eventstate->shift; unsigned int *cont_mask = arg2_mask; uiBut *but = arg1_but; @@ -1990,7 +1972,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh sa->sndnr = 0; if(sa->flag & ACT_SND_3D_SOUND) - ysize = 114; + ysize = 180; else ysize = 92; @@ -2003,24 +1985,31 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh /* reset this value, it is for handling the event */ sa->sndnr = 0; uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, ""); + uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19, "Load a sound file. Remember to set caching on for small sounds that are played often."); if(sa->sound) { char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4"; - uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, ""); + uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, ""); uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, ""); uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound"); uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound"); uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19, &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space."); if(sa->flag & ACT_SND_3D_SOUND) { - uiDefButF(block, NUM, 0, "Rolloff: ", xco+10, yco-110, wval, 19, &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0, "The rolloff factor defines the influence factor on volume depending on distance."); - uiDefButF(block, NUM, 0, "Reference distance: ", xco+wval+10, yco-110, wval, 19, &sa->sound3D.reference_distance, 0.0, 1000.0, 0.0, 0.0, "The reference distance is the distance where the sound has a gain of 1.0."); + uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19, &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0, "The minimum gain of the sound, no matter how far it is away."); + uiDefButF(block, NUM, 0, "Maximum Gain: ", xco+10, yco-132, wval, 19, &sa->sound3D.max_gain, 0.0, 1.0, 0.0, 0.0, "The maximum gain of the sound, no matter how near it is.."); + uiDefButF(block, NUM, 0, "Reference Distance: ", xco+10, yco-154, wval, 19, &sa->sound3D.reference_distance, 0.0, FLT_MAX, 0.0, 0.0, "The reference distance is the distance where the sound has a gain of 1.0."); + uiDefButF(block, NUM, 0, "Maximum Distance: ", xco+10, yco-176, wval, 19, &sa->sound3D.max_distance, 0.0, FLT_MAX, 0.0, 0.0, "The maximum distance at which you can hear the sound."); + uiDefButF(block, NUM, 0, "Rolloff: ", xco+wval+10, yco-110, wval, 19, &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0, "The rolloff factor defines the influence factor on volume depending on distance."); + uiDefButF(block, NUM, 0, "Cone Outer Gain: ", xco+wval+10, yco-132, wval, 19, &sa->sound3D.cone_outer_gain, 0.0, 1.0, 0.0, 0.0, "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value und the normal gain in the inner cone."); + uiDefButF(block, NUM, 0, "Cone Outer Angle: ", xco+wval+10, yco-154, wval, 19, &sa->sound3D.cone_outer_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the outer cone."); + uiDefButF(block, NUM, 0, "Cone Inner Angle: ", xco+wval+10, yco-176, wval, 19, &sa->sound3D.cone_inner_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the inner cone."); } } MEM_freeN(str); } else { - uiDefBut(block, LABEL, 0, "Use Sound window (F10) to load samples", xco, yco-24, width, 19, NULL, 0, 0, 0, 0, ""); + uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+10, yco-22, width-20, 19, "Load a sound file."); } yco-= ysize; @@ -3033,7 +3022,7 @@ void logic_buttons(bContext *C, ARegion *ar) /* start with the controller because we need to know which one is visible */ /* ******************************* */ - xco= 500; yco= 170; width= 300; + xco= 400; yco= 170; width= 300; uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, UI_UNIT_Y, ""); @@ -3142,9 +3131,17 @@ void logic_buttons(bContext *C, ARegion *ar) cpack(0x999999); glRecti(xco+22, yco, xco+width-22,yco+19); but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type"); - uiButSetFunc(but, sca_move_controller, cont, NULL); + //uiButSetFunc(but, sca_move_controller, cont, NULL); but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name"); - uiButSetFunc(but, sca_move_controller, cont, NULL); + //uiButSetFunc(but, sca_move_controller, cont, NULL); + + uiBlockBeginAlign(block); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); + uiButSetFunc(but, sca_move_controller, cont, (void *)TRUE); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); + uiButSetFunc(but, sca_move_controller, cont, (void *)FALSE); + uiBlockEndAlign(block); + ycoo= yco; } @@ -3165,7 +3162,7 @@ void logic_buttons(bContext *C, ARegion *ar) } /* ******************************* */ - xco= 10; yco= 170; width= 400; + xco= 10; yco= 170; width= 300; uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, UI_UNIT_Y, ""); @@ -3226,9 +3223,16 @@ void logic_buttons(bContext *C, ARegion *ar) set_col_sensor(sens->type, 1); glRecti(xco+22, yco, xco+width-22,yco+19); but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, ""); - uiButSetFunc(but, sca_move_sensor, sens, NULL); + //uiButSetFunc(but, sca_move_sensor, sens, NULL); but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, 31, 0, 0, ""); - uiButSetFunc(but, sca_move_sensor, sens, NULL); + //uiButSetFunc(but, sca_move_sensor, sens, NULL); + + uiBlockBeginAlign(block); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); + uiButSetFunc(but, sca_move_sensor, sens, (void *)TRUE); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); + uiButSetFunc(but, sca_move_sensor, sens, (void *)FALSE); + uiBlockEndAlign(block); } but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); @@ -3243,7 +3247,7 @@ void logic_buttons(bContext *C, ARegion *ar) } /* ******************************* */ - xco= 900; yco= 170; width= 400; + xco= 800; yco= 170; width= 300; uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, UI_UNIT_Y, ""); @@ -3299,9 +3303,17 @@ void logic_buttons(bContext *C, ARegion *ar) set_col_actuator(act->type, 1); glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19)); but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type"); - uiButSetFunc(but, sca_move_actuator, act, NULL); + // uiButSetFunc(but, sca_move_actuator, act, NULL); but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name"); - uiButSetFunc(but, sca_move_actuator, act, NULL); + // uiButSetFunc(but, sca_move_actuator, act, NULL); + + uiBlockBeginAlign(block); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); + uiButSetFunc(but, sca_move_actuator, act, (void *)TRUE); + but= uiDefIconBut(block, BUT, B_REDR, VICON_MOVE_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); + uiButSetFunc(but, sca_move_actuator, act, (void *)FALSE); + uiBlockEndAlign(block); + ycoo= yco; } diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 703b408aae6..3c46522bba2 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -102,6 +102,13 @@ static SpaceLink *logic_new(const bContext *C) slogic= MEM_callocN(sizeof(SpaceLogic), "initlogic"); slogic->spacetype= SPACE_LOGIC; + /* default options */ + slogic->scaflag = (BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) | + (BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) | + (BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK) | + (BUTS_SENS_STATE|BUTS_ACT_STATE); + + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for logic"); |