10000 nifxml 0.9 by hexabits · Pull Request #65 · niftools/nifxml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nifxml 0.9 #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Dec 17, 2017
Merged

nifxml 0.9 #65

merged 49 commits into from
Dec 17, 2017

Conversation

hexabits
Copy link
Member
@hexabits hexabits commented Oct 6, 2017

Changelog WIP

  • Header compound overhaul. Wider version support, correct versioning, unknown decoding.
  • Removal of niflibtype - generators must map this internally.
  • NiPhysX block decoding
  • NiPS* block decoding
  • NiEvaluator (20.5+ KF) decoding
  • NiMesh skinning block decoding
  • Added 30.2.0.3 support to <version>
  • Major documentation changes at block and row level
  • Type narrowing for Ref and Ptr where possible
  • Major structural changes to:
    • NiBSpline* blocks
    • NiControllerSequence
    • NiSourceTexture
    • NiPixelData and NiPersistentSrcTextureRendererData
    • NiMesh/NiGeometry - moved shared data into a compound

New Attributes

  • prefix for enum/bitflags. It is used for prepending to each enum option name where necessary.
  • suffix for add. It is appended to the name of the add where necessary.

Required Parser Changes

  • [ALL PARSERS] For arg attribute, you must support \ to mean compound member accessor. For example Vertex Desc\Vertex Attributes for the compound BSVertexDesc.
  • If using C-style enums that need unique enumerator names, you must combine the prefix and the name on enum/bitflags.
  • If generating class variables in a strongly typed language, you must append the suffix to the variable name. The suffix is provided when multiple <add> use the same name but the type differs per version. They are always exclusive by version but sometimes the type changes.

Upcoming Commits

  • A major reorganization is planned that will basically rearrange every line of the file. This will group objects logically and make the file easier to navigate. Deferred for 0.9.5
  • A major overhaul of the use of User Version vs User Version 2. The latter has been confirmed to be Bethesda-only and there are many improper uses of User Version in verconds when User Version 2 suffices. Improper User Version use can cause support for other games' NIFs to break, such as Divinity 2 which has user versions of 0x20000 and 0x30000. Completed
  • Commits which widen NIF version support and lower the number of files which load with error.

hexabits added 25 commits August 2, 2017 12:26
Duplicate name avoidance was too strict and unnecessary in these cases.  Nifdocsys will now attempt to cast subsequent duplicate names to the correct types in order to ensure correct read/write size.  As such the first type should always be the largest, so the "Flags" fields on NiAVObject were switched.

So in the case of Flags and Body Flags, a uint data member will be created on the class and will be read/written to with a cast during I/O.

The suffix is still required when the types are not castable between one another.
Almost completely redone with correct version ranges, fixed names, fixed types, and corrections for 30.x NIFs.   30.x NIFs with embedded thumbnail metadata would not load before these fixes.

Also, BSStreamHeader was annotated but a compound for it was not feasible for several reasons, namely the nesting of `User Version 2` which would break existing parsers.   This also leads to the ugly repetition of the cond expression for it.
The blocks were almost entirely undecoded before, with incomplete linkage (Ref fields).  They are now completely decoded and I do not believe there were any regressions for past NIF versions, but it would be hard to test as I do not have NIFs before 30.1 with these blocks.

However the version conditions were all maintained and corrected on the fields that were already decoded for 20.x.
NiPS blocks replaced NiPSys blocks but were never decoded, so no new NIFs could be loaded.
Redid most of NiPixelData and NiPersistentSrcTextureRendererData. Cleaned up NiTexturingProperty naming and versions, merged NiMultiTextureProperty with NiTexturingProperty as the separate declarations were unnecessary and repetitive.  Filled out incomplete enums.
Also added an enum value from FO4.
Major cleanup to the niobject documentation as well as addition of deprecation and removal info where applicable.
Fixed a few enum types to bitflags.  Renamed some compounds to match the types in engine.  Removed MTransform because it doesn't exist.  The NiAVObject transform is simply an NiTransform written out of order.   Switched types to use NiQuatTransform where applicable.

Made an NiPlane compound to match the type used in engine.   Switched types to use NiPlane where applicable.

Removed some unused compounds and commented code.
Offset and Half Range are the correct names for the compact control point data used to decompress the compact control points.

Beware for NiBSplineTransformInterpolator and NiBSplineCompTransformInterpolator the naming has shifted for "Offset".

"Offset" is now "Handle" and "Bias" is now "Offset".   This means the same names still exist but for different rows.

Also shifted some types around to the correct classes and filled out some unknowns.
Filled out and fixed enum and some compound documentation,  changed names to match engine types.  Started marking some enums/compounds as Bethesda-specific.

Also shifted NiPoint3InterpController members to NiMaterialColorController where they belonged.
Corrected naming, filled unknowns, and redid documentation for NiControllerSequence/NiSequence incl the ControlledBlock compound.

Added documentation regarding Controller ID and Interpolator ID (previously "Variable 1" and "Variable 2").

Added a few missing controllers.   Fixed NiLightColorController to not be related to NiMaterialColorController.

Fixed BSPSysMultiTargetEmitterCtlr inheritance.
Fixed the nodes list to be more correct.  Documented NiLight changes in FO4.
Created a compound for NiTexture::FormatPrefs to mimic Gamebryo and in order to more correctly document the intent of the FormatPrefs.
Prefix actual Havok lib types with 'hk', remove 'hk' from TriangleData as it is a Bethesda type.
Removal of extraneous or inaccurate "Unknown" descriptions,  removal of unhelpful, repetitive and unnecessary descriptions.  Clarification of many descriptions.  Clarification of some names.  Focus on more useful descriptions for particle system blocks.
Also some decoding and major corrections.

NiParticlesData and NiPSysData were almost completely wrong.  NiGeometryData was wrong.  NiGeometry was wrong.  This was mostly due to Bethesda changing or breaking inheritance for derived types.

For Bethesda 20.2 NIFs NiParticlesData now inherits from NiObject directly.  NiParticleSystem changes between BSGeometry or NiGeometry based on version.

This resulted in NiPSysData and NiParticleSystem being almost completely wrong for later Bethesda versions.

Also changed all misuses of `User Version` to differentiate Bethesda versions to `User Version 2`.
"Signed" turned into `signed` which is a reserved keyword in C++.  A ref was missing a template.
nifdocsys will cast duplicate names as long as the types are integral and the largest type is first.
Use BSVertexDesc everywhere applicable.  Now passing in the entire compound as an ARG.  This means that a parser either has to treat BSVertexDesc as a uint64 and then shift to VF6-VF7, use & overloads for the class, or special case the class in some way.

Changed BS Properties fixed-size link array to two flat Refs as they are always a Shader Property and an Alpha Property and are dealt with flatly in-engine as well.
Changed to be more in line with the real names.  Combined the FO4 BSGeometrySegmentData with the old BSGeometrySegmentData in the same compound so that they would be the same type/variable for niflib on BSSubIndexTriShape and removed the suffix attr for it.
The mapping will now be done in nifdocsys.
Oblivion appears to use TransformA and TransformB just like FO3 and later but the orders of the vectors appear to be swapped for each transform.  At least this makes the constraints render consistent with FO3+.
Narrow and correct the template types used for refs where possible.

Give correct inheritance to shader properties for Skyrim and later.
Also flattened the hardcoded entity arrays since there has to be two anyway.  This way changing the Num to incorrect number will not mess up the file writes.

Reduced the 3 sets of Transform A and B rows to only two by changing the vercond.
With gen_niflib supporting the prefix attribute, enums can be shifted to using it where needed.  In this case the name attributes of the bitflags take up a lot of space in the UI and removing the prefix compacts this.

Also made them more consistent.  FO3 is now  F3SF1/F3SF2 and FO4 is F4SF1/F4SF2.
Missed field when transferring decoding from 010 templates.
The type was actually Bounding Volume, with the "unknown int" being the bound type.  This compound already existed in the XML for other blocks.
Aids in proper creation of new blocks by having sound default values.

Also splits Glossiness/Smoothness in BSLightingShaderProperty to have correct defaults and documentation on ranges.  Unknown Float 1 was changed to Rimlight Power as well, and the next line, Backlight Power, relies on its value being FLT_MAX.  So  `Rimlight Power == 0x7F7FFFFF` is used as a `cond` for Backlight Power and this may require the parser to deal with a float to hex comparison.
The header conditions did not apply to 20.0.0.4.10 which is apparently present in Steam distributions.  The correct files are 20.0.0.5.11 which is a newer format.

Fixed a condition in NiParticlesData that was accidentally applying to non-Bethesda NIFs.
Combined GeomMaterialData and MaterialData into one compound and changed NiRenderObject and NiGeometry to compensate, since they used the exact same format for material data.  Moved more rows into MaterialData as well which simplified the conditioning/duplication on NiGeometry greatly.
BSPackedCombinedGeomDataExtra is the version of precombined produced by the CK, whereas all vanilla precombined was BSPackedCombinedGeomDataExtra.   The latter is much smaller because it only includes a reference to the geometry.  The CK precombined bakes all geometry into the file.
Added NiSequenceData and NiEvaluator for 20.5.0.0+.  In 20.5.0.0 NiSequenceData is an alias for NiControllerSequence.  The XML does not handle this and will defer to parser support.  It does not seem to happen in practice.

For 20.5.0.1,  NiSequenceData is a hybrid of old and new,  pre-NiEvaluator.

For 20.5.0.2+, NiEvaluator replaces NiInterpolator for everything.  Data wise they are almost exactly the same.

Also improved the default values for Blend and BSpline interpolators.
Instead of requiring all parsers to special-case the arg passing for BSVertexDesc,  have just adopted the `\` syntax for compound member accessor.

So at least for parsers that do not internalize BSVertexDesc to be `uint64_t` or equivalent to mirror the game,  all you need to do is support `\`.

For C++ this would go from

`Vertex Desc\Vertex Attributes`
to
`vertexDesc.vertexAttributes`

The period syntax was decided against because it is not very visible and `\` is familiar from filepaths / directory trees.
Rename LOD levels in BSLODTriShape to match BSMeshLODTriShape.

Made NiMeshModifier abstract.

Named NiGeometryData Group ID, which is never used but is at least known.
The game, Entropia Universe, only used Gamebryo between 2004 and 2009, when it switched to CryEngine 2.  http://www.entropiawiki.com/Info.aspx?chart=VU&name=10.0
@hexabits hexabits merged commit 7e3677e into niftools:develop Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0