== PyConstraints - 2 Fixes ==
authorJoshua Leung <aligorith@gmail.com>
Wed, 20 Jun 2007 09:58:16 +0000 (09:58 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 20 Jun 2007 09:58:16 +0000 (09:58 +0000)
* Error print for getSettings was lacking a newline
* When adding a PyConstraint using Ctrl-Alt-C, the script is now queried to find out whether it uses a target.

source/blender/python/BPY_interface.c
source/blender/src/editconstraint.c

index 6ee06c64cc7569f603e45d6ce278abe7d124ae7e..93f02b75bc96563a39b20b50b19d4a0e9a2b0d57 100644 (file)
@@ -1478,7 +1478,7 @@ void BPY_pyconstraint_settings(void *arg1, void *arg2)
        
        gval = PyDict_GetItemString(globals, "getSettings");
        if (!gval) {
-               printf("ERROR: no getSettings function in constraint!");
+               printf("ERROR: no getSettings function in constraint!\n");
                
                /* free temp objects */
                ReleaseGlobalDictionary( globals );
index 95391b37af7700c2e9cd9817ee198fba4fd8fc64..7e1178de3770d603277a4aa989992d9675b7bd44 100644 (file)
@@ -747,17 +747,26 @@ void add_constraint(int only_IK)
                }
                else if(nr==18) {       
                        char *menustr;
-                       int scriptint= 0, dummy_active=0;
+                       int scriptint= 0, dummy_int=0;
+                       float dummy_matrix[4][4];
                        
                        /* popup a list of usable scripts */
-                       menustr = buildmenu_pyconstraints(NULL, &dummy_active);
+                       menustr = buildmenu_pyconstraints(NULL, &dummy_int);
                        scriptint = pupmenu(menustr);
                        MEM_freeN(menustr);
                        
                        /* only add constraint if a script was chosen */
                        if (scriptint) {
+                               /* add constraint */
                                con = add_new_constraint(CONSTRAINT_TYPE_PYTHON);
                                validate_pyconstraint_cb(con->data, &scriptint);
+                               
+                               /* make sure target allowance is set correctly */
+                               dummy_int = BPY_pyconstraint_targets(con->data, dummy_matrix);
+                               if (dummy_int) {
+                                       bPythonConstraint *pycon= (bPythonConstraint *)con->data;
+                                       pycon->flag |= PYCON_USETARGETS;
+                               }
                        }
                }