MV When does a bitmap ACTUALLY update?

Title doesn't really capture my question well... but here goes. For once I don't consider this a "stupid in the sense that I'm missing something obvious or I've overthought the problem" question like a lot of my others. Graphical stuff is one of my biggest weaknesses, so please assume I know nearly nothing on the topic. You won't be far off the mark lol

So, I have a window in a custom scene(plugin-generated, not one I've made. I haven't touched making my own scenes yet). Inside that window I draw a bitmap. After the bitmap is loaded and drawn, I wish to change the colors using its rotateHue function. Here's where it gets odd, and where the title question comes into play. The first time I have the scene up, the bitmap doesn't change. Ever. However, if I close that scene, and reopen it, then every time the window is refreshed, the colors change as the hue rotates. Why does it not happen the first time?

I know why the color keeps changing when the window refreshes, it's due to how rotateHue works and where I'm calling it. What I'm wanting to know is why it only seems to work if the scene is closed and then reopened. I would assume that a scene's behavior should be the same whether it's the first time you've loaded it or the 100th. I assume it's either the scene or the bitmap.

Not sure if the information is relevant, but this issue is in the course of trying to get an MZ plugin working with RETRO. MZ plugins load a bitmap and THEN set the hue, where MV loads a bitmap WITH the hue information, at least with battler images, which is what I'm working with. The use of rotateHue is my first pass on making the two behave similarly. I intend to use a modified and condensed copy of rotateHue for the end result. I'm trying to modify it as far down the prototype chain as I can, just in case another MZ plugin uses setHue for non-battler sprites. I'm currently working with the most basic bitmap and sprite prototypes.

Thanks in advance!
I know why the color keeps changing when the window refreshes, it's due to how rotateHue works and where I'm calling it. What I'm wanting to know is why it only seems to work if the scene is closed and then reopened. I would assume that a scene's behavior should be the same whether it's the first time you've loaded it or the 100th. I assume it's either the scene or the bitmap.

Could it be that the imagemanager hasn't loaded it yet the first time? Try putting a ImageManager.loadEnemy() at the beginning of the scene.
Could it be that the imagemanager hasn't loaded it yet the first time? Try putting a ImageManager.loadEnemy() at the beginning of the scene.
I wouldn't assume so, there's a check in rotateHue that requires the context of the bitmap to be present. I assume that's the bitmap's actual graphical information. Like I said, graphics are a weak point of mine. Stepping through the code tells me the requirements are met and all the work modifying the pixels is done... but the image remains unchanged. And I'm making sure to not edit plugins I'm working with, that would invalidate the point of RETRO.

I'm no closer to figuring out WHY that issue exists, but I made a workaround that will work just fine. Since MZ loads images without the hue information, RETRO detects that and assigns the file path to the bitmap object. Then, when a setHue is called (a function native to MZ), it loads the image again, using the assigned path and the provided hue information. Works perfectly now! And it's set as far down the chain as possible, so this method should work with ANY sprite, even though it's only battlers that natively change hue by default.

...though the rotating colors thing was hilarious when I first saw it. Gave me an idea for a new plugin... and since work on RETRO is slower than I'd like already... I really shouldn't be having new ideas. lol
Actually wait, are you rotating the hue after it gets blted to the window? If that's the case then your rotations are off by one, since you're doing

-select
-Bake image onto window canvas
-Rotate image hue


So trial #2 has one rotation baked in, rather than 2
Actually wait, are you rotating the hue after it gets blted to the window? If that's the case then your rotations are off by one, since you're doing

-select
-Bake image onto window canvas
-Rotate image hue


So trial #2 has one rotation baked in, rather than 2
Here's how it breaks down, as far as I can tell.
MZ: Load bitmap. Later, setHue. For enemy sprites, I assume this adds an onLoad listener callback to setHue using the enemy's hue information.
MV: Load bitmap with hue information. It adds an onLoad listener callback to rotate the hue using the provided hue information.

What makes this issue more complex is that, for the plugin in question, it's not creating an enemy sprite, just a basic sprite, so it's never assigned an enemy, the relevant enemy information is used directly instead. This is part of the reason I was trying to go as basic as possible with the modifications, since modifying the enemy sprite function would do absolutely nothing. That and this same issue would pop up with any and all sprites that would have hue changes MZ-style.

So it's POSSIBLE it's a preloading issue, where the setHue call is occurring BEFORE the bitmap is fully loaded, so it does its thing. The part I don't get here is, on the second opening of the scene(which has a selectable window next to it), it rotates the hue every time it refreshes, and it refreshes every time a selection on the selectable window is changed. So in theory, it should be successfully rotating the hue on the FIRST opening as well, whenever the selection is changed, since the bitmap is most definitely already cached. But it doesn't.

I can't seem to find anything that makes a distinction between the first time the scene is opened versus every other time it's opened. If it's a preloading issue, then I would assume that when the image is FIRST drawn, it's drawn without the hue information, but when the selection is changed and the bitmap refreshed, it SHOULD rotate the hue, since that's where the call was.

I've checked and double-checked, the code is successfully ran EVERY time, but there's never a visual change until you close and re-open the scene.

Original thread: https://forums.rpgmakerweb.com/threads/when-does-a-bitmap-actually-update.136129/