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;
        


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to