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>2012-01-19 02:42:57 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-01-19 02:42:57 +0400
commitc69abe0965b8a2680070f8a5489161611acb243e (patch)
treea6eb251d5f1fdeb40b371062fce4668d0823b2bb /source/blender/makesrna/intern/rna_sensor.c
parent7162ca5be799ff6393b4ef46ceda2f378613c662 (diff)
patch [#29679] Expose connected logic bricks from python
it exposes sensor.controllers and controller.actuators this is how the data is exposed in blender. to have controller.sensors or actuator.controllers is not that straightforward
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 6459c145a3a..4413eee9395 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -61,6 +61,7 @@ EnumPropertyItem sensor_type_items[] ={
#ifdef RNA_RUNTIME
#include "BKE_sca.h"
+#include "DNA_controller_types.h"
static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
{
@@ -125,6 +126,19 @@ static void rna_Sensor_type_set(struct PointerRNA *ptr, int value)
}
/* Always keep in alphabetical order */
+
+static void rna_Sensor_controllers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ bSensor *sens = (bSensor *)ptr->data;
+ rna_iterator_array_begin(iter, sens->links, sizeof(bController *), (int)sens->totlinks, 0, NULL);
+}
+
+static int rna_Sensor_controllers_length(PointerRNA *ptr)
+{
+ bSensor *sens = (bSensor *)ptr->data;
+ return (int) sens->totlinks;
+}
+
EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *item= NULL;
@@ -327,6 +341,13 @@ static void rna_def_sensor(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+ prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
+ RNA_def_property_struct_type(prop, "Controller");
+ RNA_def_property_ui_text(prop, "Controllers", "The list containing the controllers connected to the sensor");
+ RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", "rna_Sensor_controllers_length", NULL, NULL, NULL);
+
+
RNA_api_sensor(srna);
}