diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-07 05:30:12 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-07 05:30:12 +0400 |
commit | 97687969266c5df6ec0d797692dd13576db4bf70 (patch) | |
tree | db11b90e94767a97431f490a8cd7905b0d81ac48 /source/blender | |
parent | 05e2e92611970689cd224715f594b817c69beae0 (diff) |
Logic UI: State Actuator done :) all actuators are there now. [and stubs update]
(it's a small commit, but couldn't help not doing it ;)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 34 |
2 files changed, 31 insertions, 9 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 9bc8a944fe1..91a0dd9ee4f 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -4170,7 +4170,11 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C) static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr) { - //XXXACTUATOR + uiLayout *split; + split = uiLayoutSplit(layout, 0.35, 0); + uiItemR(split, ptr, "operation", 0, NULL, 0); + + uiTemplateLayers(split, ptr, "state", NULL, NULL, 0); } static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index ab2999129c0..ff735d35ade 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -131,6 +131,27 @@ static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, f oa->forcerot[0] = 60.0f*oa->forcerot[1]; } +static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values) +{ + bActuator *act = (bActuator*)ptr->data; + bStateActuator *sa = act->data; + + int i, tot= 0; + + /* ensure we always have some state selected */ + for(i=0; i<OB_MAX_STATES; i++) + if(values[i]) + tot++; + + if(tot==0) + return; + + for(i=0; i<OB_MAX_STATES; i++) { + if(values[i]) sa->mask |= (1<<i); + else sa->mask &= ~(1<<i); + } +} + static EnumPropertyItem *rna_EditObjectActuator_mode_itemf(bContext *C, PointerRNA *ptr, int *free) { EnumPropertyItem *item= NULL; @@ -1597,14 +1618,11 @@ static void rna_def_state_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask"); RNA_def_property_update(prop, NC_LOGIC, NULL); -/* - XXX mask needs a template or to use RNA layer type - prop= RNA_def_property(srna, "mask", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_array(prop, 20); -*/ - prop= RNA_def_property(srna, "mask", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Mask", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "state", PROP_BOOLEAN, PROP_LAYER_MEMBER); + RNA_def_property_boolean_sdna(prop, NULL, "mask", 1); + RNA_def_property_array(prop, OB_MAX_STATES); + RNA_def_property_ui_text(prop, "State", ""); + RNA_def_property_boolean_funcs(prop, NULL, "rna_StateActuator_state_set"); } static void rna_def_armature_actuator(BlenderRNA *brna) |