Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artwork creation during tick fails if index_offset zero #58

Open
Chadnaut opened this issue Feb 11, 2024 · 3 comments
Open

Artwork creation during tick fails if index_offset zero #58

Chadnaut opened this issue Feb 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Chadnaut
Copy link
Collaborator

Appears to be a bug since other offsets work (also occurs in AM vanilla)

local a, b, c;

function on_tick(tick_time) {
    if (!a) {
        a = fe.add_artwork("snap", 110, 0, 100, 100);
        a.index_offset = 0; // zero doesn't work?
    }
    if (!b) {
        b = fe.add_artwork("snap", 220, 0, 100, 100);
        b.rawset_index_offset(-1); // rawset to a different offset...
        b.index_offset = 0; // ...then set zero, works
    }
    if (!c) {
        c = fe.add_artwork("snap", 330, 0, 100, 100);
        c.index_offset = 1; // non-zero always works
    }
}

fe.add_artwork("snap", 0, 0, 100, 100);
fe.add_ticks_callback("on_tick");
@oomek
Copy link
Owner

oomek commented Feb 11, 2024

There are many reasons why drawables should not be added in tick, but I believe you know what you are doing and there is no way to achieve what you need when drawables are added in transitions or in the main layout body.
I've checked the code and AM+ behaviour is consistent with AM 2.7.0, same bug. It is even worse with Vid.ImagesOnly flag. a,b,c don't show up at all until you navigate.
To be honest it's not what I would jump onto and investigate immediately, but will keep this issue open until I finish the new transition model.

@oomek oomek added the bug Something isn't working label Feb 11, 2024
@Chadnaut
Copy link
Collaborator Author

I have a create/animate/update pipeline that runs on tick (no leaks).
video_flags does work, but only if it's set before index_offset.
The rawset workaround does the job, so this quirk is not a show-stopper.

@oomek
Copy link
Owner

oomek commented Oct 16, 2024

Easy fix by commenting

if ( m_index_offset != io )

But if the index_offset is set on each tick it will be a performance hog.
Still trying to figure out a solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants