Skip to content

Feature/animations#10

Open
RoyTheunissen wants to merge 56 commits intohamish-milne:masterfrom
RoyTheunissen:feature/animations
Open

Feature/animations#10
RoyTheunissen wants to merge 56 commits intohamish-milne:masterfrom
RoyTheunissen:feature/animations

Conversation

@RoyTheunissen
Copy link
Copy Markdown

@RoyTheunissen RoyTheunissen commented Jul 9, 2022

Made this for my own fork but I figured it might be worth sharing to the original repository in case you found them worthwhile.

What's added?

  • Created an FbxBuilder utility to allow you to quickly create an FBX file by focusing on the data you want to write instead of having to re-create the entire FBX file format yourself
  • Added high-level classes for creating Joints and Animation Curves.
  • Added FBXTime wrapper to convert from frames or seconds to the internal FBX format
  • Added basic support for unique ID generation (could be improved, but it works)
  • Improved syntax for adding new nodes and property blocks
  • Expanded FBXWriter to support inline comments, headers and line breaks
  • Expanded FBXWriter to support FBXTime and various other data types

Here's an example of how to use the new FbxBuilder:

FbxBuilder builder = new FbxBuilder(@"C:\Output\Test.fbx", 30);

// Add a basic joint.
Joint joint1 = builder.AddJoint(new Joint("joint1", new Vector3D(0, 0, 100)));

// Add an animation for joint1's position attribute X-coordinate from frame 1 to 30.
Curve joint1PositionCurve = new Curve(joint1.Translation, Components.X)
{
    { 1, 0.0f },
    { 30, -100.0f },
};
builder.AddCurve(joint1PositionCurve);

builder.Write();

Known issues

  • FbxId generates ID's that are unique to the file, but they're not globally unique. Not sure if this is problematic. Works fine for me.
  • Custom tangent slopes, weights and velocities are not currently supported. This leaves the following possible tangents:
    • Constant
    • Linear
    • Cubic with flat tangents, or with automatic tangents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant