Skip to content

v3.0 | Depalettizer Release

Latest
Compare
Choose a tag to compare
@loonaticx loonaticx released this 29 Aug 04:31
· 3 commits to main since this release

V3.0 release contains major changes and additions to the eggtools library

Core Classes

EggMan

  • EggMan now has support for getting point information, including vertex coordinates and texture coordinates, off a provided EggNode.
  • A new replace_eggdata method has been introduced. This is used to install new information to an egg file that is currently under control by an EggMan.
  • try_absolute option in fix_broken_texpaths: It's not recommended to have this flag enabled unless you are using it to pass the filepath over to something like Pillow for opening images. Don't apply this on egg files that are meant to be written out!

EggContext

With the addition of merging EggDatas, it's important to ensure that the EggContext object is also considered as it holds important complimentary egg data.

EggContext has been refactored into its own module and has graduated from being a simple data class. The filename property of this object has extra coverage on ensuring that the filename as defined in the EggContext is consistent with egg_filename defined in EggData. It also contains several additional helper methods & attributes, such as an ordered set containing all of the EggGroups in the EggContext (Which makes sense, as EggContext is used alongside EggData objects.)

EggDataContext

There is now a wrapper class for EggData, known as EggDataContext. This wrapper is to accommodate the synchronization of EggContext objects and any migrations or modifications made to the egg data. It is preferred to use EggDataContext over EggData where possible.

Utilities

EggDepalettizer can be used to effectively "depalettize" egg files, if certain conditions are met. Provided a model, the depalettizer assesses each EggNode, determining what textures compose of the target node. For each EggPolygon, it generates a PointData object, which is used to store correlation between the texture reference and vertex datas. From there, bounding boxes can be generated by summing up all of the UV coordinates, which will then be used to crop out the used part of the texture into its own file. The bounding box is also used as a component for "normalizing" the UV coordinates on each vertex entry. There is a sample file located in examples/utils/EggDepalettizer.py

  • For best results, the input model should have each texture component as a separate node.

EggUVPlotter is a way to visualize an egg file's UV coordinates using Matplotlib. This is a very helpful visualization tool when manipulating the UV data of an Egg node. There is a sample file located in examples/utils/EggUVPlotter.py

MarginCalculator is a small utility class for working with ratios/coverage percent and can help with common 2D-area operations.

Components

Point Components

PointData is a new object is used to store situational information of polygons.

  • EggPolygon objects define textures that they are using, alongside providing a reference to their parent node.
  • These objects also contain the EggVertex objects that compose the polygon. These vertex objects hold vectors such as the point location in 3D space and UV coordinate data.
  • Thus, by using the UV coordinates and the given texture image, we can pinpoint the exact coverage of a texture that is being used by any given EggNode.
  • Notice: Multitexturing is not supported with PointData objects at this time.

Image Components

The image components aren't particularly exclusive to the use of egg files, but provide features to handle image manipulation being done with a provided egg. This component module introduces new dependencies, including Numpy, Pillow, and OpenCV.

  • A new ImageMarginer object, which is used to apply margining on textures that were affected by a change in UV data.
    • The marginer extends the dimensions of the texture and then fills in the new area with an ImageFill method (described below.) This allows the source image to retain its original quality.
    • NOTE: ImageMarginer is still experimental. There is a known issue with the image margins and the UV margin ratio being desynced if the padding value is high enough.
  • ImageFill is used by ImageMarginer to apply the filling of new texture space. There are different modes to choose from, including clamping, solid colors, repeating patterns, or a "smart fill"-esque approach.
    • InnerFillType is experimental, not recommended to be utilized at this time.

General Egg Components

  • Started working on EggEnums, which is a very object-oriented wrapper around various enums defined in egg classes. Intended to help with static typing.