diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-09 02:11:00 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-09 02:11:00 +0400 |
commit | 94cd746566eac365605813f0b7b9a5ed93eec271 (patch) | |
tree | 769ac60011f3058b1e0cc4810af1497a342fd676 /source/blender/editors/space_logic | |
parent | 5be1fd3592d78c21cafd86cfff69bd23578d77d9 (diff) |
Logic UI - lookup for properties (matt need your help to finish it)
I based this code on drawnode, so I hope this is the right way of doing this.
Working Sensors:
- keyboard
- property
Working Actuators:
- property (partly)
- ipo
- action
- shape action
- message
- random
Need help with:
- actuator sensor
- property actuator (for the second object)
- touch/ray/collision sensors + constraint actuator
(for the material lookup, not the property one)
maybe a doversion + changing the type to material work better here
(as we have in touch sensor)
+ added notifier for the game property.
Diffstat (limited to 'source/blender/editors/space_logic')
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 88 |
1 files changed, 68 insertions, 20 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 3b8ed083ad0..e554d869a4a 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3208,6 +3208,14 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) static void draw_sensor_actuator(uiLayout *layout, PointerRNA *ptr) { + /* -- couldnt make it work for actuators + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; + + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + uiItemPointerR(layout, ptr, "actuator", &settings_ptr, "actuators", "", 0); + */ + uiItemR(layout, ptr, "actuator", 0, NULL, 0); } @@ -3296,6 +3304,8 @@ static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr) static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; uiLayout *row, *col; row = uiLayoutRow(layout, 0); @@ -3315,9 +3325,13 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(col, 0); uiItemL(row, "Second Modifier:", 0); uiItemR(row, ptr, "second_modifier_key", UI_ITEM_R_EVENT, "", 0); - - uiItemR(layout, ptr, "target", 0, NULL, 0); - uiItemR(layout, ptr, "log", 0, NULL, 0); + + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, 0); + +// uiItemR(layout, ptr, "target", 0, NULL, 0); +// uiItemR(layout, ptr, "log", 0, NULL, 0); } static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr) @@ -3343,9 +3357,14 @@ static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr) static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; + uiLayout *row; uiItemR(layout, ptr, "evaluation_type", 0, NULL, 0); - uiItemR(layout, ptr, "property", 0, NULL, 0); + + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, 0); switch (RNA_enum_get(ptr, "evaluation_type")) { case SENS_PROP_INTERVAL: @@ -3556,8 +3575,12 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; uiLayout *row; + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "mode", 0, "", 0); uiItemR(row, ptr, "action", 0, NULL, 0); @@ -3565,7 +3588,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP)) - uiItemR(row, ptr, "property", 0, NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); else { uiItemR(row, ptr, "frame_start", 0, NULL, 0); @@ -3577,7 +3600,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "priority", 0, NULL, 0); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "frame_property", 0, NULL, 0); + uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR uiItemR(row, "stride_length", 0, NULL, 0); @@ -3809,8 +3832,13 @@ static void draw_actuator_game(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr) { + Object *ob; + PointerRNA settings_ptr; uiLayout *row, *subrow, *col; + ob = (Object *)ptr->id.data; + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "play_type", 0, "", 0); subrow= uiLayoutRow(row, 1); @@ -3823,7 +3851,7 @@ static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr) row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "play_type") == ACT_IPO_FROM_PROP)) - uiItemR(row, ptr, "property", 0, NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); else { uiItemR(row, ptr, "frame_start", 0, NULL, 0); @@ -3832,31 +3860,37 @@ static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "child", 0, NULL, 0); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "frame_property", 0, NULL, 0); + uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); } static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr) { + Object *ob; + PointerRNA settings_ptr; uiLayout *row; + ob = (Object *)ptr->id.data; + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + uiItemR(layout, ptr, "to_property", 0, NULL, 0); uiItemR(layout, ptr, "subject", 0, NULL, 0); - row= uiLayoutRow(layout, 0); + row= uiLayoutRow(layout, 1); uiItemR(row, ptr, "body_type", 0, NULL, 0); if(RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG) - uiItemR(row, ptr, "body_message", 0, NULL, 0); + uiItemR(row, ptr, "body_message", 0, "", 0); else // mode == ACT_MESG_PROP - uiItemR(row, ptr, "body_property", 0, NULL, 0); + uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", 0); } static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) { - uiLayout *split, *row, *col, *subcol; - Object *ob = (Object *)ptr->id.data; + Object *ob; PointerRNA settings_ptr; - + uiLayout *split, *row, *col, *subcol; + + ob = (Object *)ptr->id.data; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); uiItemR(layout, ptr, "mode", 0, NULL, 0); @@ -3957,10 +3991,14 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; uiLayout *row; uiItemR(layout, ptr, "mode", 0, NULL, 0); - uiItemR(layout, ptr, "prop_name", 0, NULL, 0); + + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, 0); switch(RNA_enum_get(ptr, "mode")) { @@ -3975,26 +4013,32 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) case ACT_PROP_COPY: row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "object", 0, NULL, 0); - uiItemR(row, ptr, "object_prop_name", 0, NULL, 0); + uiItemR(row, ptr, "object_property", 0, NULL, 0); } } static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr) { + Object *ob; + PointerRNA settings_ptr; uiLayout *row; + + ob = (Object *)ptr->id.data; + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "seed", 0, NULL, 0); uiItemR(row, ptr, "distribution", 0, NULL, 0); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "property", 0, NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); row = uiLayoutRow(layout, 0); switch (RNA_enum_get(ptr, "distribution")){ case ACT_RANDOM_BOOL_CONST: - uiItemR(row, ptr, "always_true", 0, NULL, 0); + uiItemR(row, ptr, "always_true", UI_ITEM_R_TOGGLE, NULL, 0); break; case ACT_RANDOM_BOOL_UNIFORM: @@ -4056,8 +4100,12 @@ static void draw_actuator_scene(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; + PointerRNA settings_ptr; uiLayout *row; + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "mode", 0, "", 0); uiItemR(row, ptr, "action", 0, NULL, 0); @@ -4065,7 +4113,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP)) - uiItemR(row, ptr, "property", 0, NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); else { uiItemR(row, ptr, "frame_start", 0, NULL, 0); @@ -4077,7 +4125,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "priority", 0, NULL, 0); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "frame_property", 0, NULL, 0); + uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR uiItemR(row, "stride_length", 0, NULL, 0); |