Page 1 of 1

ConvertToBrush and auto id selection

Posted: Mon Apr 03, 2023 4:01 pm
by jPV
It seems that auto id selection with ConvertToBrush() has got broken in Hollywood 10 (works with earlier versions).

At least in this kind of case:

Code: Select all

@REQUIRE "iconic"
LoadIcon(1, "SYS:Utilities.info")

For Local k = 1 To GetAttribute(#ICON, 1, #ATTRNUMENTRIES)
    For Local j = 1 To GetAttribute(#ICON, 1, #ATTRNUMFRAMES, k)
        ; This works:
        ConvertToBrush(#ICON, 1, 1, k, j - 1)
        DisplayBrush(1, #CENTER, #CENTER)
        WaitLeftMouse
        Cls
        ; This fails on HW10 (works on HW9.1), id becomes 0:
        Local id = ConvertToBrush(#ICON, 1, Nil, k, j - 1)
        DisplayBrush(id, #CENTER, #CENTER)
        WaitLeftMouse
        Cls
    Next
Next

Re: ConvertToBrush and auto id selection

Posted: Mon Apr 03, 2023 9:57 pm
by lazi
You should live with a workaround while a fix/patch/new release will come:

Code: Select all

   tmp2 = ConvertToBrush(#BRUSH, tmp1, Nil)
   t, c = GetObjects(#BRUSH)   ; workaround
   tmp2 = t[c-1]               ; workaround
   DisplayBrush(tmp2,10,10)
This one is working with #BRUSH, but you could apapt it for #ICON.
Let us know if it works!

Re: ConvertToBrush and auto id selection

Posted: Thu Apr 13, 2023 3:29 pm
by airsoftsoftwair
Yes, definitely a bug, will be fixed.

Re: ConvertToBrush and auto id selection

Posted: Thu Apr 13, 2023 4:04 pm
by airsoftsoftwair

Code: Select all

- Fix: ConvertToBrush() didn't return a new brush ID when Nil was passed to it