Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2010-05-09 02:11:00 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-09 02:11:00 +0400
commit94cd746566eac365605813f0b7b9a5ed93eec271 (patch)
tree769ac60011f3058b1e0cc4810af1497a342fd676 /source/blender/makesrna
parent5be1fd3592d78c21cafd86cfff69bd23578d77d9 (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/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c17
-rw-r--r--source/blender/makesrna/intern/rna_property.c11
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c2
3 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index cc1cd9b1e1d..43b09c84a12 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -383,8 +383,6 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *fre
if (ob->type==OB_ARMATURE) {
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE);
- } else {
- RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION);
}
}
@@ -400,6 +398,13 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *fre
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE);
+
+ if (ob != NULL) {
+ if (ob->type==OB_MESH){
+ RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SHAPEACTION);
+ }
+ }
+
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STATE);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY);
@@ -936,8 +941,7 @@ static void rna_def_property_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mode", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
- //XXX add magic property lookup
- prop= RNA_def_property(srna, "prop_name", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Property", "The name of the property");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -955,7 +959,7 @@ static void rna_def_property_actuator(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
//XXX add even magic'er property lookup (need to look for the property list of the target object)
- prop= RNA_def_property(srna, "object_prop_name", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "value");
RNA_def_property_ui_text(prop, "Property Name", "Copy this property");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1340,7 +1344,6 @@ static void rna_def_random_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator. Use Python for more freedom (choose 0 for not random)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
- //XXX add magic property lookup
prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "propname");
RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property");
@@ -1464,7 +1467,7 @@ static void rna_def_message_actuator(BlenderRNA *brna)
prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bodyType");
RNA_def_property_enum_items(prop, prop_body_type_items);
- RNA_def_property_ui_text(prop, "Body Type", "Toggle message type: either Text or a PropertyName");
+ RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName");
/* ACT_MESG_MESG */
prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index c65aa4ac725..7bcb58ea28d 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -30,6 +30,8 @@
#include "DNA_property_types.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
#include "BKE_property.h"
@@ -111,24 +113,29 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "Available as GameObject attributes in the game engine's python API");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, gameproperty_type_items);
RNA_def_property_ui_text(prop, "Type", "");
RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG);
RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* GameBooleanProperty */
srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
RNA_def_struct_ui_text(srna , "Game Boolean Property", "Game engine user defined Boolean property");
RNA_def_struct_sdna(srna, "bProperty");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "data", 1);
RNA_def_property_ui_text(prop, "Value", "Property value");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* GameIntProperty */
srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty");
@@ -139,6 +146,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "data");
RNA_def_property_ui_text(prop, "Value", "Property value");
RNA_def_property_range(prop, -10000, 10000);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* GameFloatProperty */
srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty");
@@ -150,6 +158,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Value", "Property value");
RNA_def_property_range(prop, -10000, 10000);
RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* GameTimerProperty */
srna= RNA_def_struct(brna, "GameTimerProperty", "GameProperty");
@@ -161,6 +170,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Value", "Property value");
RNA_def_property_range(prop, -10000, 10000);
RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* GameStringProperty */
srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty");
@@ -171,6 +181,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "poin");
RNA_def_property_string_maxlength(prop, MAX_PROPSTRING);
RNA_def_property_ui_text(prop, "Value", "Property value");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 3621d6bb6d0..45a660a0895 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -314,7 +314,7 @@ static void rna_def_touch_sensor(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_pointer_sdna(prop, NULL, "ma");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material");
+ RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}