Bugfix #8283: PyConstraints menu problems
authorJoshua Leung <aligorith@gmail.com>
Thu, 14 Feb 2008 10:42:53 +0000 (10:42 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 14 Feb 2008 10:42:53 +0000 (10:42 +0000)
The menu listing the scripts available for use was not working correctly for newly created PyConstraints. This was caused by a missing initialisation for the 'active' index.

source/blender/src/buttons_object.c
source/blender/src/editconstraint.c

index e00e38477a815624cb4df676f0963444474d92df..106940d266875d9c930eddd72afd73541bf62d3a 100644 (file)
@@ -673,8 +673,8 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                                short yoffset= ((tarnum-1) * 38);
                                                
                                                /* target label */
-                                               sprintf(tarstr, "Target %02d:", tarnum);
-                                               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, tarstr, *xco+45, *yco-(48+yoffset), 80, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
+                                               sprintf(tarstr, "Target %d:", tarnum);
+                                               uiDefBut(block, LABEL, B_CONSTRAINT_TEST, tarstr, *xco+45, *yco-(48+yoffset), 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
                                                
                                                /* target space-selector - per target */
                                                if (is_armature_target(ct->tar)) {
index b30fbf47b6a918c73e1a2dc5b115d8196a4112ca..542b31b1157e659b28a4b150abe551d64089db6b 100644 (file)
@@ -884,6 +884,10 @@ char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
        sprintf(buf, "Scripts: %%t|[None]%%x0|");
        BLI_dynstr_append(pupds, buf);
        
+       /* init active-index first */
+       if (con_text == NULL)
+               *pyconindex= 0;
+       
        /* loop through markers, adding them */
        for (text=G.main->text.first, i=1; text; i++, text=text->id.next) {
                /* this is important to ensure that right script is shown as active */