YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
24 stars 8 forks source link

Access particle system instance from layer element #2789

Open zzhamzz opened 11 months ago

zzhamzz commented 11 months ago

Is your feature request related to a problem?

Currently there is not a direct way of getting the particle system instance from a layer element. This makes it difficult to manipulate at runtime a particle system manually placed in the room editor on an asset layer.

All functions that manipulate active particle systems require a particle system instance. e.g.

Even though we can find the element of a part system on a layer via layer_get_all_elements, layer_get_element_type and layerelementtype_particlesystem, there is no way to get the particle system instance that is normally returned from part_system_create/layer.

You can get access to it in very hacky ways like iterating over all possible part system indices and testing with part_system_exist. But this is unacceptable, error prone, and not feasible in all situations.

Describe the solution you'd like

Add function similar to layer_sequence_get_instance but for particle systems.

Add layer_part_system_get_instance that accepts an layer element index and returns a part system index.

Describe alternatives you've considered

Consider adding the part system instance to the in-beta room_get_info function.

I am not 100% sure if that would be the correct place for it as room_get_info seems to deal with room 'definitions' and not active rooms.

Additional context

No response

YYDan commented 10 months ago

https://github.com/YoYoGames/GameMaker-Bugs/issues/3990 - is probably a better/newer version of this FR?

zzhamzz commented 10 months ago

For Clarity:

FR YoYoGames/GameMaker-Bugs#3990 is requesting part system data come in the form of a struct instead of piece meal via the various partsystem*functions.

However, FR YoYoGames/GameMaker-Bugs#3990 requires a part system instance to be passed as an arguement. Cool if you have the part system instance to pass.

The Feature I am requesting is to be able to retrieve the associated part system instance id from a part system layer element similar to how layer_sequence_get_instance can retrieve the sequence instance from a layer element.

Currently there is no direct way to do get the part system associated with a layer element.

The functions part_system_create/layer return the part system instance id so you can maintain access to it. However, manually placed part systems on a layer are essentially 'lost' to the user at runtime and it is difficult/convoluted/impossible to gain access to them at runtime.

The new function room_get_info, currently in-beta, is an 'almost-but-not-quite' mix of these two request. It can get info on the part system ASSET associated with a layer element in struct form. But it does not get info on the part system INSTANCE associated with an layer element.

Ideally neither of these FRs would be fullfilled the way 'room_get_info' works. Room_get_info retrieves large amounts of data about the room. These two request (#311 and YoYoGames/GameMaker-Bugs#2789) should work on an individual part system (instance id or layer element id).