ModCreatorKit adds a bunch of cheats and utilities that are useful to modders.
Most of these cheats were unused leftovers in the Spore code, so they are not added as conventional cheats; instead, we forcefully add a cheat stored at a certain address in code.
There are two exceptions:
devContext: Just switches the game mode to whatever the player says. Very simple implementation using the
devAnimLog: When enabled, the ID of all animations loaded will be printed to the console. To do this, we've had to detour the function that loads
Another feature of this mod is file debugging: the ability of changing certain mod files without having to repack
the mod. We've done this by detouring the function that opens a file from a
.package file: if that package has a certain
"debugging information" (basically file paths) that SporeModderFX has packed, instead of opening the file in the
.package we will
find the file in the disk.
This mod also adds a new game mode and a cheat to access it,
effectsEditor. This can be used with SMFX to test and edit effects
in real time, check the tutorial.
This editor relies on the "file debugging" feature exposed before. We also detour the
SwarmManager that checks what
be used for a certian effect. When the effect ID is
_effect_editor, we force a reload of the
main.effdir file that is generated by
SporeModder FX when using the effects editor there.
The effects editor mode itself is very simple. It just loads its own camera (which is a copy of the editor camera) and loads the
effect. In the
Update method, every second, checks if
main.effdir was modified and reloads the effect if necessary.
Part Thumbnail Capture
This mod also includes a cheat tht lets you create thumbnails for your custom parts that fit perfectly into the part preview. To do that it uses
ThumbnailCaptureScript class, which is many things at a time: a cheat, a renderable, an UI listener, and a message listener.
When the cheat is executed, it navigates the Palettes hierarchy to add an UI listener (itself) to all palette items. It also adds itself as a renderable in the render layer 40, which is after everything has already been rendered. The message listener is used to detect when the editor is exited, to remove all the UI listeners.
The UI listener just detects when the mouse enters a palette item, which is when the part preview will start displaying. It just stores in the class which palette item is about to be previewed.
Render function doesn't render anything; it just waits until the UI listener has detected a previewed item, and that item has loaded its model.
Then it clears the entire screen (during the capture frame, the screen will go black) to remove any background. It renders the palette item model and uses the
VIEWPORT properties to know at which screen coordinates it has been rendered. It then saves that fragment into a
.png, having captured the first
frame of the model preview animation.