Plasma icon indicating copy to clipboard operation
Plasma copied to clipboard

Enable Python access to plLayer and ImageLibMod textures.

Open Deledrius opened this issue 2 years ago • 4 comments

In order to facilitate the expansion of existing Ages as well as adding new Fan Ages, this PR provides a way to modify textures dynamically through Python scripts. It is especially ideal for otherwise-identical meshes whose appearance can be easily changed with only a texture swap. Book covers and Linking Panels are the primary intended targets.

Planned uses:

  • Random selection of backdrop images on the StartUp menu screen, showcasing Ages from interesting perspectives.
  • Adding new books to the Nexus with minimal modifications. Currently, to add a new Age to the Nexus, an entire new copy of the book mesh and animations is required, with extensive and error-prone wiring and material duplication. This PR allows the entire book machine jumble to be simplified into a single book and an ImageLibMod containing the linking panels which can then be assigned based on the current selection.
  • Adding new books to Relto with minimal modifications. The Relto Bookshelf's selection of books is currently hard coded, making it difficult to add, remove, or change books. This PR would allow dummy books to be skinned with different covers depending on dynamic conditions (player-vault-based data, for instance).
  • Adding new books to Chiso with minimal modifications. Chiso Preniv's many books could likewise be more easily assigned and updated with only a minor script update and a new image added to an ImageLibMod, simplifying new-Age-related updates.

This PR:

  • Adds Python access to plLayer textures.
  • Adds Python access to ImageLibMods through their plSceneObject.
  • Adds a new ptAttrib for assigning plLayers in PlasmaMax PFMs.
  • Provides a small demonstration function added to the StartUp Age to show the simplicity of using the new features. (Draft only, not intended for merge outside of Gehn).

Questions for reviewers:

  • Is this the best way to accomplish these goals? Is this safe?
  • Is this sufficiently complete? More access to the plLayer is possible, though more would not necessarily be useful.

Deledrius avatar Mar 11 '23 11:03 Deledrius

I think we should probably toss the whole BUILDING_PYPLASMA thing from the new code. It makes things hard to follow.

I agree, and was thinking the same thing (which is why I asked about it in the chat last week). It's useless to us, unfortunately, and just makes everything harder to read. I'll remove it from this one.

Doing all of pfPython was going to affect a lot of files though, so I haven't done it yet. Will probably open a separate PR for that.

Deledrius avatar Mar 12 '23 05:03 Deledrius

Still waiting on:

  • https://github.com/H-uru/Plasma/pull/1360#discussion_r1267394146
  • https://github.com/H-uru/Plasma/pull/1360#discussion_r1267395943

Hoikas avatar Jul 29 '23 15:07 Hoikas

What is the status here?

Hoikas avatar Oct 15 '23 21:10 Hoikas

What is the status here?

Working on a few things to get it finished up, but my time has been limited. I hope we can finish this one soon. :)

Deledrius avatar Oct 31 '23 22:10 Deledrius