[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29517] trunk/blender/source/blender/ editors/space_logic/logic_ops.c: logic ops: accepting no object as argument into "remove s/c/a" operators ( uses the active object in those cases)

Dalai Felinto dfelinto at gmail.com
Thu Jun 17 09:33:59 CEST 2010


Revision: 29517
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29517
Author:   dfelinto
Date:     2010-06-17 09:33:57 +0200 (Thu, 17 Jun 2010)

Log Message:
-----------
logic ops: accepting no object as argument into "remove s/c/a" operators (uses the active object in those cases)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_logic/logic_ops.c

Modified: trunk/blender/source/blender/editors/space_logic/logic_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_ops.c	2010-06-17 07:20:12 UTC (rev 29516)
+++ trunk/blender/source/blender/editors/space_logic/logic_ops.c	2010-06-17 07:33:57 UTC (rev 29517)
@@ -110,8 +110,14 @@
 	
 	RNA_string_get(op->ptr, "sensor", sensor_name);
 	RNA_string_get(op->ptr, "object", ob_name);
-	
-	*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+
+	/* if ob_name is valid try to find the object with this name
+	otherwise gets the active object */
+	if (ob_name[0] != '\0' )
+		*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+	else
+		*ob= ED_object_active_context(C);
+
 	if (!*ob)
 		return NULL;
 	
@@ -152,8 +158,14 @@
 	
 	RNA_string_get(op->ptr, "controller", controller_name);
 	RNA_string_get(op->ptr, "object", ob_name);
-	
-	*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+
+	/* if ob_name is valid try to find the object with this name
+	otherwise gets the active object */
+	if (ob_name[0] != '\0' )
+		*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+	else
+		*ob= ED_object_active_context(C);
+
 	if (!*ob)
 		return NULL;
 	
@@ -194,8 +206,14 @@
 	
 	RNA_string_get(op->ptr, "actuator", actuator_name);
 	RNA_string_get(op->ptr, "object", ob_name);
-	
-	*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+
+	/* if ob_name is valid try to find the object with this name
+	otherwise gets the active object */
+	if (ob_name[0] != '\0' )
+		*ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+	else
+		*ob= ED_object_active_context(C);
+
 	if (!*ob)
 		return NULL;
 	





More information about the Bf-blender-cvs mailing list