[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33326] trunk/blender/source/blender/ makesrna/intern: follow up of "Bugfix #23576" (Logic UI) - replacing hardcoded values by RNA_struct_is_a + making rna_sensor future proof

Dalai Felinto dfelinto at gmail.com
Fri Nov 26 04:58:32 CET 2010


Revision: 33326
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33326
Author:   dfelinto
Date:     2010-11-26 04:58:31 +0100 (Fri, 26 Nov 2010)

Log Message:
-----------
follow up of "Bugfix #23576" (Logic UI) - replacing hardcoded values by RNA_struct_is_a + making rna_sensor future proof

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c
    trunk/blender/source/blender/makesrna/intern/rna_sensor.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-11-26 03:50:14 UTC (rev 33325)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c	2010-11-26 03:58:31 UTC (rev 33326)
@@ -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 @@
 	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 */

Modified: trunk/blender/source/blender/makesrna/intern/rna_sensor.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sensor.c	2010-11-26 03:50:14 UTC (rev 33325)
+++ trunk/blender/source/blender/makesrna/intern/rna_sensor.c	2010-11-26 03:58:31 UTC (rev 33326)
@@ -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 @@
 	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 */





More information about the Bf-blender-cvs mailing list