diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-06-16 12:29:40 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-06-16 12:29:40 +0400 |
commit | 6a70a6bee2803290c42821847597f43a0e084938 (patch) | |
tree | fa951c32753bc0805fc4aff0f4f28ab5db7e9fef /source/blender/editors/space_logic | |
parent | bc8e0c0f932f4d6ce2cd49029498c1965ee46a67 (diff) |
Logic UI: partial implementation of state per controller
Adding two rna properties: state and state_number
For scripting "state_number" (integer) makes more sense while "state" (boolean/array) may be needed for the UI.
So far the UI is only showing the state number (using Label). Still have to decide how is the better way to "change the state".
If we don't need "state" (as boolean) for the UI, we can have only the integer one and rename it to "state".
+ some cosmetic changes (renamed ob "states" to "visible states")
ps.: 2 goals == 2 commits... let's see if I can keep that ratio until the middle of July ...
Diffstat (limited to 'source/blender/editors/space_logic')
-rw-r--r-- | source/blender/editors/space_logic/logic_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 632331459cb..72697bfa8eb 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -484,7 +484,6 @@ static int actuator_add_exec(bContext *C, wmOperator *op) PropertyRNA *prop; const char *act_name; char name[32]; - //XXX RNA_string_get is not using maxlen, it's using UserPreferencesFilePaths_python_scripts_directory_get instead (what limits the string copy to 160 chars in this case and CRASHES Blender). int type= RNA_enum_get(op->ptr, "type"); act= new_actuator(type); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 226d326d68f..104bcc6286d 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3507,6 +3507,7 @@ void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C) static void draw_controller_header(uiLayout *layout, PointerRNA *ptr) { uiLayout *box, *row; + char name[3]; //XXX provisorly for state number box= uiLayoutBox(layout); row= uiLayoutRow(box, 0); @@ -3514,6 +3515,11 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "expanded", UI_ITEM_R_NO_BG, "", 0); uiItemR(row, ptr, "type", 0, "", 0); uiItemR(row, ptr, "name", 0, "", 0); + + /* XXX provisory: state number */ + sprintf(name, "%d", RNA_int_get(ptr, "state_number")); + uiItemL(row, name, 0); + uiItemR(row, ptr, "priority", 0, "", 0); uiItemO(row, "", ICON_X, "LOGIC_OT_controller_remove"); } @@ -4425,7 +4431,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) col= uiLayoutColumn(subsplit, 0); row= uiLayoutRow(col, 0); uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "all_states")==0); - uiTemplateLayers(row, &settings_ptr, "state", &settings_ptr, "used_state", 0); + uiTemplateLayers(row, &settings_ptr, "visible_state", &settings_ptr, "used_state", 0); row= uiLayoutRow(col, 0); uiTemplateLayers(row, &settings_ptr, "initial_state", &settings_ptr, "used_state", 0); |