31a9680f5d OOT Link Import/Export + Flipbook Import/Export + Animation Updates/Fixes (#126)
* Format oot_f3d_writer with black.

* Add properties/UI for flipbook textures.

* Form oot_skeleton with black.

* Added parameter for actor name to be passed into skeleton parsing code.

* Formatted oot_model_classes with black

* Added basic flipbook texture array importing.

Note this only works under specific conditions right now (texture array name must be present in the gSPSegment() call)

* Added visualization option to texture array items.

* Added better texture array detection handling most cases.

Notable exceptions: z_en_wf (branch between two different segment loads), z_obj_switch (2d texture array)

* Added warning labels for edge case overlays.

* EnOssan (shopkeepers) and DemoEc (end credit) overlays now supported for flipbook textures.

* Added support for Link for flipbook textures.z

* Removed debug prints.

* Fixed issue with texture reference palettes not being loaded correctly.

* Added name property for flipbook textures when in "individual" mode.

* Added exporting of flipbook textures along with skeletons.

* Added load button to flipbook textures.

* Fixed bug where visualizing a flipbook texture auto optimized the texture format.

* Fixed minor bug with texture array definition not being found

* Added support for reading/writing elements from 2D texture arrays.

Note that there is current import lag (probably due to regex processing) after implementing asset including for files.

* Added flipbook texture handling to DLs, fixed lag issue with including link_animetion.c for regex searches. Fixed some asset includes.

* Fixed minor bugs related to overlayName parameter. Added palette applying to flipbooks, which will be incorrect for importing fast64 exports.

* Added warning message for LOD overriding flipbook textures.

* Attempted to add palette sharing.

One import/export cycle works fine, next results in compiler errors

* Fixed issue with trying to re-process existing flipbook textures.

* Fixed issue with DL import not finding textures.

* Fixed issue where importing an export would cause CI flipbook issues with skeletons using LOD.

* Commented out some debug messages.

* Improved debug message for flipbook errors.

* Fixed issue with checking if flipbook property should be processed. Refactored flipbook CI exporting code.

* Fixed issue with bad flipbook CI for LOD skeletons.

There's a possibility that two CI flipbooks write to the same flipbook name. Before this fix the later one would override the older one (ex. LOD), which would cause the first flipbook to use the LOD version textures with its own palette, causing issues.

* Minor UI / error handling for flipbooks.

* Removed outdated UI message.

* Updated README.

* Format oot_anim with black.

* Added Link animation importing.

* Added Link animation import/export, including texture animation. Fixed signed short bug with animation data.

* Placed all oot_anim import/export settings into their own property groups.

* Updated README.

* Fixed issue with bad normals on export due to non-folded rest pose.

* Fixed issues with incorrect animation exports for rotated armatures. Fixed skeleton export for armatures with non-zero rest pose rotations.

* Fixed bug where vanilla limb removal caused unwanted removed data.

* Updated README for skeleton exporting process.

* Added ability to import animation rotations correctly for non-zero rotation rest poses.

* Can now import translations correctly for non-zero rotation armatures.

* Refactored flipbook code to be more generalized. Fixed direct setting of texture nodes for flipbook animation.

* Black format oot_collision_classes

* Black format oot_collision

* Fixed typo error

Co-authored-by: krm01 <[email protected]>

* Fixed typo error

Co-authored-by: krm01 <[email protected]>

* Fixed 2d array index issue when doing a custom Link export. Added handling for gEmptyDL import for skeletons.

* Skeletons now preserve minium DL count using gEmptyDL, fixed issue with comments in texture arrays.

* Format oot_f3d_writer with black

* Format oot_skeleton with black

* Fixed texture file saving for oot skeleton/dl

* Moved skeleton import/export settings into property groups.

* Custom skeleton export now has options for folder and asset include directory.

* Fixed skeleton export settings bug

* Moved oot dl import/export settings into property groups

* Custom dl export now has options for folder and asset include directory.

* Format sm64_geolayout_writer with black.

* Format sm64_level_writer with black.

* Re-allowed texture c array conversion when ignoring texture restrictions

* Large texture mode now converts textures, updated getOptimalFormat

* Update fast64_internal/f3d/f3d_material.py

Co-authored-by: Dragorn421 <[email protected]>

* Move export/import settings to OOT_Properties, renamed assetIncludeDir

* Fixed register ordering

* Fixed possible unbound useLargeTextures

* Update fast64_internal/oot/oot_skeleton.py

Co-authored-by: Dragorn421 <[email protected]>

* Removed unused imports

* Changed name of ArmatureApplyWithMesh operator for more clarity from function of same name

* Update fast64_internal/oot/oot_model_classes.py

Co-authored-by: Dragorn421 <[email protected]>

* Changed typing for validateCIFlipbook for clarity.

* Added easy option for importing/exporting Link

* Added convenient rest poses for importing Link

* Removed global actor scale, moved to object local property. Imports will try to parse actor scale.

* Refactored skeleton import/export settings to use property groups

* Fixed actor scale detection. Handled collider import cases for Va and Sst.

* Fixed actor scale importing.

* Update fast64_internal/f3d/flipbook.py

Co-authored-by: Dragorn421 <[email protected]>

* Used dataclass

* Update fast64_internal/f3d/flipbook.py

Co-authored-by: Dragorn421 <[email protected]>

* Add optional typing to checkFlipbookReference

* Renamed ImagePointerProperty to FlipbookImagePointerProperty

* Removed outdated comments

* Renamed drawFlipbookRequirementMessage

* Update fast64_internal/f3d/flipbook.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/f3d/flipbook.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/f3d/flipbook.py

Co-authored-by: Dragorn421 <[email protected]>

* Fixed bug with flipbook anim updating

* Fixed another bug with flipbook anim updating

* Removed flipbookAnimHandler on unregister

* Update fast64_internal/oot/oot_anim.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/oot/oot_anim.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/oot/oot_anim.py

Co-authored-by: Dragorn421 <[email protected]>

* Renamed ootRotationValue to binangToRadians

* Update fast64_internal/oot/oot_anim.py

Co-authored-by: Dragorn421 <[email protected]>

* Renamed link texture animation callbacks

* Update fast64_internal/oot/oot_anim.py

Co-authored-by: Dragorn421 <[email protected]>

* Move anim import/export settings to fast64.oot property group

* Renamed is2DArray to flipbookUses2DArray

* Renamed arrayIndex2D to flipbookArrayIndex2D

* Renamed overlay to actorOverlayName

* Update fast64_internal/oot/oot_texture_array.py

Co-authored-by: Dragorn421 <[email protected]>

* Added CollectionProperty alias for typing purposes.

* Update fast64_internal/oot/oot_texture_array.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/f3d/f3d_parser.py

Co-authored-by: Dragorn421 <[email protected]>

* Added typing to F3DContext, refactored tuples into classes.

- moved clearMaterial()/clearGeometry() into parser/writer functions, so game specific writers/parsers doesn't have to call them directly
- fixed some variable name bugs in oot_f3d_writer

* Fixed bug with DL importing due to function order.

* Updated README for custom link import/export.

* Add F3D parsing fixes and material optimizations.

Also fixes bug where dynamic gfx calls weren't being imported correctly for Link.

* Fixed issue where files were being written outside of folder for custom export

* Added error message for unweighted vertices.

* Updated README

* Add import

* Fixed material caching issue for tex gen

* Fixed issue with incorrectly preserved material properties

Note that this fix also takes into account that dynamic material properties should be preserved between limbs (Link).

* Minor hash related issue with Light

* Update fast64_internal/f3d/f3d_material.py

Co-authored-by: Dragorn421 <[email protected]>

* Update fast64_internal/f3d/f3d_writer.py

Co-authored-by: Dragorn421 <[email protected]>

* Modified comments in oot_anim

* Fixed comment in f3d_parser

* Fixed material key with lighting properties

* Changed types to sequences

* Fixed divide by 0 error when tex scale = 0

* Fixed tuple

* Remove scale_autoprop setting

* Added error message

* Fixed vertex buffer error message

Co-authored-by: krm01 <[email protected]>
Co-authored-by: Dragorn421 <[email protected]>
2022-11-03 13:03:07 +01:00
2022-06-30 18:41:43 -05:00
2022-06-12 23:53:02 +02:00
2022-06-12 23:53:02 +02:00
2022-06-30 18:41:43 -05:00
2022-09-30 15:11:01 +02:00

Fast64

This requires Blender 3.2+.

Forked from kurethedead/fast64 on BitBucket.

alt-text

This is a Blender plugin that allows one to export F3D display lists. It also has the ability to export assets for Super Mario 64 and Ocarina of Time decompilation projects. It supports custom color combiners / geometry modes / etc. It is also possible to use exported C code in homebrew applications.

Make sure to save often, as this plugin is prone to crashing when creating materials / undoing material creation. This is a Blender issue.

https://developer.blender.org/T70574

alt-text

Credits

Thanks to anonymous_moose, Cheezepin, Rovert, and especially InTheBeef for testing. Thanks to InTheBeef for LowPolySkinnedMario.

Discord Server

We have a Discord server for support as well as development here.

Table of Contents

  1. Super Mario 64
  2. Ocarina Of Time

Installation

Download the repository as a zip file. In Blender, go to Edit -> Preferences -> Add-Ons and click the "Install" button to install the plugin from the zip file. Find the Fast64 addon in the addon list and enable it. If it does not show up, go to Edit -> Preferences -> Save&Load and make sure 'Auto Run Python Scripts' is enabled.

Tool Locations

The tools can be found in the properties sidebar under the 'Fast64' tab (toggled by pressing N). The F3D material inspector can be found in the properties editor under the material tab.

F3D Materials

Any exported mesh must use an F3D Material, which can be added by the 'Create F3D Material' button in the material inspector window. You CANNOT use regular blender materials. If you have a model with Principled BSDF materials, you can use the Principled BSDF to F3D conversion operator to automatically convert them. The image in the "Base Color" slot will be set as texture 0, while the image in the "Subsurface Color" slot will be set as texture 1.

Vertex Colors

To use vertex colors, select a vertex colored texture preset and add two vertex color layers to your mesh named 'Col' and 'Alpha'. The alpha layer will use the greyscale value of the vertex color to determine alpha.

Large Texture Mode

In F3D material properties, you can enable "Large Texture Mode". This will let you use textures up to 1024x1024 as long as each triangle in the mesh has UVs that can fit within a single tile load. Fast64 will categorize triangles into shared tile loads and load the portion of the texture when necessary.

Decomp vs Homebrew Compatibility

There may occur cases where code is formatted differently based on the code use case. In the tools panel under the Fast64 File Settings subheader, you can toggle homebrew compatibility.

Converting To F3D v5 Materials

A new optimized shader graph was introduced to decrease processing times for material creation and exporting. If you have a project that still uses old materials, you may want to convert them to v5. To convert an old project, click the "Recreate F3D Materials As V5" operator near the top of the Fast64 tab in 3D view. This may take a while depending on the number of materials in the project. Then go to the outliner, change the display mode to "Orphan Data" (broken heart icon), then click "Purge" in the top right corner. Purge multiple times until all of the old node groups are gone.

Updater

Fast64 features an updater (CGCookie/blender-addon-updater).

It can be found in the addon preferences:

How the updater in the addon preferences looks, right after addon install

Click the "Check now for fast64 update" button to check for updates.

Updater preferences after clicking the "check for updates" button

Click "Install main / old version" and choose "Main" if it isn't already selected:

Updater: install main

Click OK, there should be a message "Addon successfully installed" and prompting you to restart Blender:

Updater: successful install, must restart

Clicking the red button will close Blender. After restarting, fast64 will be up-to-date with the latest main revision.

Fast64 Development

If you'd like to develop in VSCode, follow this tutorial to get proper autocomplete. Skip the linter for now, we'll need to make sure the entire project gets linted before enabling autosave linting because the changes will be massive. https://b3d.interplanety.org/en/using-microsoft-visual-studio-code-as-external-ide-for-writing-blender-scripts-add-ons/

Formatting

We use Black.

To make VS Code use it, change the python.formatting.provider setting to "black". VS Code will ask you to install Black if not already installed.

To format the whole repo, run black . (or python3 -m black . depending on how it is installed) from the root of the repo.

The (minimal) configuration for Black is in /pyproject.toml.

Updater notes

Be careful if testing the updater when using git, it may mess up the .git folder in some cases.

Also see the extensive documentation in the https://github.com/CGCookie/blender-addon-updater README.

The "Update directly to main" button uses bl_info["version"] as the current version, and versions parsed from git tags as other versions. This means that to create a new version, the bl_info version should be bumped and a corresponding tag should be created (for example "version": (1, 0, 2), and a v1.0.2 tag). This tag will then be available to update to, if it denotes a version that is more recent than the current version.

The "Install main / old version" button will install the latest revision from the main branch.

S
Description
Blender based editor for scenes, meshes, and more in first-party N64 games. Primarily optimized for SM64 with some new QOL additions.
Readme
52 MiB
Languages
Python 100%