diff options
Diffstat (limited to 'source/blender/editors/space_logic')
-rw-r--r-- | source/blender/editors/space_logic/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/editors/space_logic/SConscript | 7 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_buttons.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_ops.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 233 | ||||
-rw-r--r-- | source/blender/editors/space_logic/space_logic.c | 2 |
7 files changed, 95 insertions, 171 deletions
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index af2e8476511..349c003cf56 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -21,13 +21,15 @@ set(INC ../include ../interface - ../../blenfont ../../blenkernel ../../blenlib + ../../blentranslation + ../../gpu ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + ../../../../intern/glew-mx ) set(INC_SYS @@ -47,6 +49,8 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() +add_definitions(${GL_DEFINITIONS}) + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript index ae8e929a684..4b618710d1f 100644 --- a/source/blender/editors/space_logic/SConscript +++ b/source/blender/editors/space_logic/SConscript @@ -31,12 +31,14 @@ sources = env.Glob('*.c') incs = [ '#/intern/guardedalloc', - '#/extern/glew/include', + env['BF_GLEW_INC'], + '#/intern/glew-mx', '../include', '../interface', - '../../blenfont', '../../blenkernel', '../../blenlib', + '../../blentranslation', + '../../gpu', '../../imbuf', '../../makesdna', '../../makesrna', @@ -45,6 +47,7 @@ incs = [ incs = ' '.join(incs) defs = [] +defs += env['BF_GL_DEFINITIONS'] if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index 2c521532484..e0cbc1c9539 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -34,7 +34,6 @@ #include "BLI_utildefines.h" #include "BKE_context.h" -#include "BKE_screen.h" #include "ED_screen.h" @@ -124,12 +123,12 @@ static int cut_links_exec(bContext *C, wmOperator *op) for (block = ar->uiblocks.first; block; block = block->next) { but = block->buttons.first; while (but) { - if (but->type==LINK && but->link) { + if (but->type==UI_BTYPE_LINK && but->link) { for (line = but->link->lines.first; line; line = nline) { nline = line->next; if (cut_links_intersect(line, mcoords, i)) { - ui_delete_linkline(line, but); + ui_linkline_remove(line, but); } } } diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h index 38b122f64b6..13146621d1b 100644 --- a/source/blender/editors/space_logic/logic_intern.h +++ b/source/blender/editors/space_logic/logic_intern.h @@ -35,12 +35,8 @@ /* internal exports only */ struct bContext; struct ARegion; -struct ARegionType; struct ScrArea; -struct SpaceLogic; -struct Object; struct wmOperatorType; -struct Scene; /* space_logic.c */ struct ARegion *logic_has_buttons_region(struct ScrArea *sa); diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 62703ba517e..abcb767958f 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "BKE_context.h" #include "BKE_main.h" #include "BKE_sca.h" @@ -298,7 +300,7 @@ static int sensor_add_exec(bContext *C, wmOperator *op) BLI_strncpy(sens->name, sens_name, sizeof(sens->name)); } - make_unique_prop_names(C, sens->name); + BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); ob->scaflag |= OB_SHOWSENS; WM_event_add_notifier(C, NC_LOGIC, NULL); @@ -405,7 +407,8 @@ static int controller_add_exec(bContext *C, wmOperator *op) BLI_strncpy(cont->name, cont_name, sizeof(cont->name)); } - make_unique_prop_names(C, cont->name); + BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name)); + /* set the controller state mask from the current object state. * A controller is always in a single state, so select the lowest bit set * from the object state */ @@ -523,7 +526,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op) BLI_strncpy(act->name, act_name, sizeof(act->name)); } - make_unique_prop_names(C, act->name); + BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); ob->scaflag |= OB_SHOWACT; WM_event_add_notifier(C, NC_LOGIC, NULL); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index dd152022762..ccf8460e9a3 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -48,6 +48,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" #include "BKE_action.h" #include "BKE_context.h" @@ -56,7 +57,7 @@ #include "ED_util.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "UI_interface.h" #include "UI_view2d.h" @@ -94,91 +95,6 @@ /* proto */ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag); -static int vergname(const void *v1, const void *v2) -{ - char **x1, **x2; - - x1 = (char **)v1; - x2 = (char **)v2; - - return BLI_natstrcmp(*x1, *x2); -} - -void make_unique_prop_names(bContext *C, char *str) -{ - Object *ob; - bProperty *prop; - bSensor *sens; - bController *cont; - bActuator *act; - ID **idar; - short a, obcount, propcount=0, nr; - const char **names; - - /* this function is called by a Button, and gives the current - * stringpointer as an argument, this is the one that can change - */ - - idar= get_selected_and_linked_obs(C, &obcount, BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_CONT_SEL|BUTS_CONT_ACT); - - /* for each object, make properties and sca names unique */ - - /* count total names */ - for (a=0; a<obcount; a++) { - ob= (Object *)idar[a]; - propcount+= BLI_countlist(&ob->prop); - propcount+= BLI_countlist(&ob->sensors); - propcount+= BLI_countlist(&ob->controllers); - propcount+= BLI_countlist(&ob->actuators); - } - if (propcount==0) { - if (idar) MEM_freeN(idar); - return; - } - - /* make names array for sorting */ - names= MEM_callocN(propcount*sizeof(void *), "names"); - - /* count total names */ - nr= 0; - for (a=0; a<obcount; a++) { - ob= (Object *)idar[a]; - prop= ob->prop.first; - while (prop) { - names[nr++] = prop->name; - prop= prop->next; - } - sens= ob->sensors.first; - while (sens) { - names[nr++] = sens->name; - sens= sens->next; - } - cont= ob->controllers.first; - while (cont) { - names[nr++] = cont->name; - cont= cont->next; - } - act= ob->actuators.first; - while (act) { - names[nr++] = act->name; - act= act->next; - } - } - - qsort(names, propcount, sizeof(void *), vergname); - - /* now we check for double names, and change them */ - - for (nr=0; nr<propcount; nr++) { - if (names[nr]!=str && strcmp( names[nr], str )==0 ) { - BLI_newname(str, +1); - } - } - - MEM_freeN(idar); - MEM_freeN(names); -} - static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); @@ -210,7 +126,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) ob->scaflag &= ~OB_ADDSENS; sens= new_sensor(SENS_ALWAYS); BLI_addtail(&(ob->sensors), sens); - make_unique_prop_names(C, sens->name); + BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); ob->scaflag |= OB_SHOWSENS; } } @@ -252,7 +168,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) if (ob->scaflag & OB_ADDCONT) { ob->scaflag &= ~OB_ADDCONT; cont= new_controller(CONT_LOGIC_AND); - make_unique_prop_names(C, cont->name); + BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name)); ob->scaflag |= OB_SHOWCONT; BLI_addtail(&(ob->controllers), cont); /* set the controller state mask from the current object state. @@ -328,7 +244,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) if (ob->scaflag & OB_ADDACT) { ob->scaflag &= ~OB_ADDACT; act= new_actuator(ACT_OBJECT); - make_unique_prop_names(C, act->name); + BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); BLI_addtail(&(ob->actuators), act); ob->scaflag |= OB_SHOWACT; } @@ -761,17 +677,17 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int yco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_sensor_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_sensor_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -810,17 +726,17 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int yco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_controller_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_controller_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -859,17 +775,17 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) uiBlock *block; int xco=0; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP); - uiBlockSetButmFunc(block, do_actuator_menu, NULL); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); + UI_block_func_butmenu_set(block, do_actuator_menu, NULL); - uiDefBut(block, BUTM, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, SEPRLINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, BUTM, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, BUTM, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -892,26 +808,26 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c short yco = 12, xco = 0, stbit, offset; - block= uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block= UI_block_begin(C, ar, __func__, UI_EMBOSS); /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); for (offset=0; offset<15; offset += 5) { - uiBlockBeginAlign(block); + UI_block_align_begin(block); for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, TOG, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - uiButSetFunc(but, check_controller_state_mask, but, &(cont->state_mask)); + but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); + UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); } for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, TOG, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - uiButSetFunc(but, check_controller_state_mask, but, &(cont->state_mask)); + but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); + UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); } } - uiBlockEndAlign(block); + UI_block_align_end(block); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); + UI_block_direction_set(block, UI_DIR_UP); + UI_block_end(C, block); return block; } @@ -923,7 +839,7 @@ static bool is_sensor_linked(uiBlock *block, bSensor *sens) for (i=0; i<sens->totlinks; i++) { cont = sens->links[i]; - if (uiFindInlink(block, cont) != NULL) + if (UI_block_links_find_inlink(block, cont) != NULL) return 1; } return 0; @@ -987,7 +903,7 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) sub = uiLayoutRow(row, false); uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") || RNA_boolean_get(ptr, "use_pulse_false_level"))); - uiItemR(sub, ptr, "frequency", 0, IFACE_("Freq"), ICON_NONE); + uiItemR(sub, ptr, "tick_skip", 0, IFACE_("Skip"), ICON_NONE); row = uiLayoutRow(split, true); uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); @@ -1117,7 +1033,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) uiLayout *row, *col; row = uiLayoutRow(layout, false); - uiItemL(row, CTX_IFACE_(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE); + uiItemL(row, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE); col = uiLayoutColumn(row, false); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false); uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE); @@ -2189,12 +2105,15 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) } row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "self_terminated", 0, NULL, ICON_NONE); + col = uiLayoutColumn(row, false); + uiItemR(col, ptr, "self_terminated", 0, NULL, ICON_NONE); if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) { - uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE); - row = uiLayoutRow(layout, false); + col = uiLayoutColumn(row, false); + uiItemR(col, ptr, "update_period", 0, NULL, ICON_NONE); } row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "lock_z_velocity", 1, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE); if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) { uiLayoutSetActive(row, false); @@ -2353,9 +2272,9 @@ void logic_buttons(bContext *C, ARegion *ar) idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar); - block= uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS); - uiBlockSetHandleFunc(block, do_logic_buts, NULL); - uiBoundsBlock(block, U.widget_unit/2); + block= UI_block_begin(C, ar, uiblockstr, UI_EMBOSS); + UI_block_func_handle_set(block, do_logic_buts, NULL); + UI_block_bounds_set_normal(block, U.widget_unit/2); /* loop over all objects and set visible/linked flags for the logic bricks */ for (a=0; a<count; a++) { @@ -2401,7 +2320,7 @@ void logic_buttons(bContext *C, ARegion *ar) /* ****************** Controllers ****************** */ xco= 21 * U.widget_unit; yco= - U.widget_unit / 2; width= 15 * U.widget_unit; - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_GetStyle()); + layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); row = uiLayoutRow(layout, true); uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco - U.widget_unit / 2, yco, width, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ @@ -2431,7 +2350,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT); row = uiLayoutRow(split, true); - uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWCONT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2479,9 +2398,9 @@ void logic_buttons(bContext *C, ARegion *ar) col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } //col = uiLayoutColumn(split, true); @@ -2502,22 +2421,22 @@ void logic_buttons(bContext *C, ARegion *ar) col = uiLayoutColumn(subsplit, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } - uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); + UI_but_link_set(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = yco; /* ****************** Sensors ****************** */ xco= U.widget_unit / 2; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_GetStyle()); + layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); row = uiLayoutRow(layout, true); uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ @@ -2537,7 +2456,7 @@ void logic_buttons(bContext *C, ARegion *ar) if ((ob->scavisflag & OB_VIS_SENS) == 0) continue; row = uiLayoutRow(layout, true); - uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2575,23 +2494,23 @@ void logic_buttons(bContext *C, ARegion *ar) /* put link button to the right */ col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } /* use old-school uiButtons for links for now */ - uiSetButLink(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); + UI_but_link_set(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); } } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = MIN2(height, yco); /* ****************** Actuators ****************** */ xco= 40 * U.widget_unit; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_GetStyle()); + layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); row = uiLayoutRow(layout, true); uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ @@ -2613,7 +2532,7 @@ void logic_buttons(bContext *C, ARegion *ar) } row = uiLayoutRow(layout, true); - uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); + uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); uiLayoutSetContextPointer(row, "object", &object_ptr); @@ -2644,9 +2563,9 @@ void logic_buttons(bContext *C, ARegion *ar) /* put inlink button to the left */ col = uiLayoutColumn(split, false); uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); + but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); if (!RNA_boolean_get(&ptr, "active")) { - uiButSetFlag(but, UI_BUT_SCA_LINK_GREY); + UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); } col = uiLayoutColumn(split, true); @@ -2661,7 +2580,7 @@ void logic_buttons(bContext *C, ARegion *ar) } } } - uiBlockLayoutResolve(block, NULL, &yco); /* stores final height in yco */ + UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ height = MIN2(height, yco); UI_view2d_totRect_set(&ar->v2d, 57.5f * U.widget_unit, height - U.widget_unit); @@ -2669,10 +2588,10 @@ void logic_buttons(bContext *C, ARegion *ar) /* set the view */ UI_view2d_view_ortho(&ar->v2d); - uiComposeLinks(block); + UI_block_links_compose(block); - uiEndBlock(C, block); - uiDrawBlock(C, block); + UI_block_end(C, block); + UI_block_draw(C, block); /* restore view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 733cac7794e..34a5fee88eb 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -282,7 +282,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar) static void logic_buttons_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL, -1); + ED_region_panels(C, ar, NULL, -1, true); } /************************* header region **************************/ |