diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-11-26 06:58:31 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-11-26 06:58:31 +0300 |
commit | b8572527dfe3d7c1372d1c050bbd02550439dc0b (patch) | |
tree | 28a9c2a13f778fd91a29e62fc2f1eb77cea4628b | |
parent | ca6cc30368841e358021d53281c7299ea6a82f13 (diff) |
follow up of "Bugfix #23576" (Logic UI) - replacing hardcoded values by RNA_struct_is_a + making rna_sensor future proof
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index fa5397e669e..2fa93bcecdd 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include "RNA_define.h" +#include "RNA_access.h" #include "rna_internal.h" #include "DNA_constraint_types.h" @@ -360,9 +361,7 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *fre Object *ob= NULL; int totitem= 0; - /* hardcoded exceptions, for these cases code below needs to find the id.data */ - /* otherwise buttons never give all options for selected */ - if (ptr->type==&RNA_Actuator || ptr->type==&RNA_ArmatureActuator || ptr->type==&RNA_ShapeActionActuator) { + if (ptr->type==&RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){ ob = (Object *)ptr->id.data; } else { /* can't use ob from ptr->id.data because that enum is also used by operators */ diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 8f6cc4b875e..47a619f661a 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -26,6 +26,7 @@ #include "RNA_define.h" #include "RNA_enum_types.h" +#include "RNA_access.h" #include "rna_internal.h" @@ -115,7 +116,7 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free) Object *ob=NULL; int totitem= 0; - if (ptr->type == &RNA_Sensor) { + if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) { ob = (Object *)ptr->id.data; } else { /* can't use ob from ptr->id.data because that enum is also used by operators */ |