Bugfix #8283: PyConstraints menu problems

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.
This commit is contained in:
Joshua Leung
2008-02-14 10:42:53 +00:00
parent 4cb91914c9
commit 4339c32c6c
2 changed files with 6 additions and 2 deletions

View 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)) {

View 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 */