Skip to content
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

Add animation KeyFrame structs + decoded properties #122

Merged
merged 47 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bbdce34
Rename animRig.hpp to AnimRig.hpp
Mozz3d May 14, 2024
7b8a47d
Update Rig.hpp header
Mozz3d May 14, 2024
6d86aab
Create AnimBufferState.hpp
Mozz3d May 14, 2024
2b64dfc
Add `dataState` property to AnimRig.hpp and create generated stub
Mozz3d May 14, 2024
04058d6
Create Generated AnimSet.hpp stub
Mozz3d May 14, 2024
6312732
Update AnimSet.hpp
Mozz3d May 14, 2024
2257f3f
Update Reflection-inl.hpp
Mozz3d May 14, 2024
80bc321
Create AnimKeyFrames.hpp
Mozz3d May 14, 2024
1f9f54a
Create AnimationBufferCompressed.hpp stub
Mozz3d May 14, 2024
1029c45
Update AnimationBufferCompressed.hpp stub
Mozz3d May 14, 2024
8984b56
Create AnimationBufferCompressed.hpp with decoded properties
Mozz3d May 14, 2024
26fd75e
Update Reflection-inl.hpp
Mozz3d May 14, 2024
a4dc22b
Update AnimKeyFrames.hpp
Mozz3d May 14, 2024
e295724
Update AnimSet.hpp
Mozz3d May 14, 2024
b849a0e
Update AnimSet.hpp
Mozz3d May 14, 2024
e9da1d7
Update AnimRig.hpp
Mozz3d May 14, 2024
8db9e9d
Update include/RED4ext/Scripting/Natives/AnimSet.hpp
Mozz3d May 14, 2024
b5181d1
Update include/RED4ext/Scripting/Natives/AnimSet.hpp
Mozz3d May 14, 2024
f25f945
Update include/RED4ext/Scripting/Natives/AnimationBufferCompressed.hpp
Mozz3d May 14, 2024
29d8e36
Update include/RED4ext/Scripting/Natives/AnimationBufferCompressed.hpp
Mozz3d May 14, 2024
793e22e
Update include/RED4ext/Scripting/Natives/AnimKeyFrames.hpp
Mozz3d May 14, 2024
93a616c
Update include/RED4ext/Scripting/Natives/AnimKeyFrames.hpp
Mozz3d May 14, 2024
0464312
Update AnimKeyFrames.hpp
Mozz3d May 14, 2024
ef80d49
Update AnimSet.hpp
Mozz3d May 14, 2024
81ebc46
Update AnimationBufferCompressed.hpp stub
Mozz3d May 14, 2024
ad4cbef
Update generated AnimSet.hpp
Mozz3d May 14, 2024
1ea371f
Update generated AnimationBufferCompressed.hpp
Mozz3d May 14, 2024
573f6b4
Rename AnimSet.hpp to animAnimSet.hpp
Mozz3d May 14, 2024
b3dd253
Remove Reflection-inl.hpp mappings
Mozz3d May 14, 2024
e5cf6b8
Update and rename AnimationBufferCompressed.hpp to animAnimationBuffe…
Mozz3d May 14, 2024
d9bc201
Rename AnimRig.hpp to animRig.hpp
Mozz3d May 15, 2024
8bb2d6e
Update AnimationBufferCompressed.hpp
Mozz3d May 15, 2024
dd3ab08
Update AnimationBufferCompressed.hpp
Mozz3d May 15, 2024
5b6be93
Update AnimSet.hpp
Mozz3d May 15, 2024
98e7f18
Remove KeyFrameHeader asserts
Mozz3d May 15, 2024
8dbd8bd
fix AnimBufferState.hpp formatting
Mozz3d May 26, 2024
1056640
Merge branch 'master' into master
Mozz3d May 26, 2024
19efb6b
fixed AnimKeyFrames.hpp formatting
Mozz3d May 26, 2024
03d9888
fixed animAnimSet.hpp formatting
Mozz3d May 26, 2024
72585a9
fixed animAnimationBufferCompressed.hpp formatting
Mozz3d May 26, 2024
c51f225
fixed animAnimSet.hpp formatting (again)
Mozz3d May 26, 2024
33653d2
idk whats wrong with the formatting here, just experimenting to under…
Mozz3d May 26, 2024
e9f354e
same thing as before
Mozz3d May 26, 2024
d4f2b74
fixed animAnimSet.hpp formatting
Mozz3d May 27, 2024
888a506
fixed animRig.hpp formatting
Mozz3d May 27, 2024
2815002
fixed animAnimSet.hpp formatting (again)
Mozz3d May 27, 2024
52a6071
Merge branch 'master' into master
Mozz3d May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimBufferState.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include <RED4ext/Buffer.hpp>
#include <RED4ext/Memory/SharedPtr.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <cstdint>

namespace RED4ext
{
namespace anim
{
struct AnimBufferState
{
enum State : uint8_t
{
Empty = 0,
Loading,
Ready,
External,
};

SharedPtr<DeferredDataBufferCopyToken> token; // 00
JobHandle job; // 10
uint32_t requestsCounter; // 18
State state; // 1C
uint8_t unk1E; // 1E
};
RED4EXT_ASSERT_SIZE(AnimBufferState, 0x20);
} // namespace anim
} // namespace RED4ext
68 changes: 68 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimKeyFrames.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once

#include <cstdint>

namespace RED4ext
{
namespace anim
{
enum KeyFrameComponent
{
Translation = 0,
Rotation,
Scale,
};

struct KeyFrameHeader
{
uint16_t timeNormalized; // 00
uint16_t boneIndex : 13; // 02
uint16_t componentType : 2; // 0E
uint16_t rotationWSign : 1; // 0F
};
RED4EXT_ASSERT_SIZE(KeyFrameHeader, 0x4);
Mozz3d marked this conversation as resolved.
Show resolved Hide resolved
RED4EXT_ASSERT_OFFSET(KeyFrameHeader, timeNormalized, 0x0);

struct KeyFrameCompressed : KeyFrameHeader
{
uint16_t x; // 00
uint16_t y; // 02
uint16_t z; // 04
};
RED4EXT_ASSERT_SIZE(KeyFrameCompressed, 0xA);

struct KeyFrameRaw : KeyFrameHeader
Mozz3d marked this conversation as resolved.
Show resolved Hide resolved
{
float x; // 00
float y; // 04
float z; // 08
};
RED4EXT_ASSERT_SIZE(KeyFrameRaw, 0x10);

struct KeyFrameConst // 14 Bytes?
{
uint16_t bitWiseData; // 00 Most likely a bitfield

float x; // 02
float y; // 06
float z; // 0A
};
RED4EXT_ASSERT_SIZE(KeyFrameConst, 0x10);

struct TrackKey
{
uint16_t time; // 00
uint16_t index; // 02
float value; // 04
};
RED4EXT_ASSERT_SIZE(TrackKey, 0x8);

struct TrackKeyConst // 6 Bytes?
{
uint16_t index; // 00
float value; // 02
};
RED4EXT_ASSERT_SIZE(TrackKeyConst, 0x8);

} // namespace anim
} // namespace RED4ext
10 changes: 10 additions & 0 deletions include/RED4ext/Scripting/Natives/Generated/anim/AnimSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

// This file is generated from the Game's Reflection data

#include <RED4ext/Scripting/Natives/animAnimSet.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(anim::AnimSet, 0x1F0);
using animAnimSet = anim::AnimSet;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
Expand Down Expand Up @@ -50,5 +59,6 @@ RED4EXT_ASSERT_SIZE(AnimSet, 0x1F0);
} // namespace anim
using animAnimSet = anim::AnimSet;
} // namespace RED4ext
*/

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

// This file is generated from the Game's Reflection data

#include <RED4ext/Scripting/Natives/animAnimationBufferCompressed.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(anim::AnimationBufferCompressed, 0x188);
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
Expand Down Expand Up @@ -45,5 +54,6 @@ RED4EXT_ASSERT_SIZE(AnimationBufferCompressed, 0x188);
} // namespace anim
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext
*/

// clang-format on
49 changes: 49 additions & 0 deletions include/RED4ext/Scripting/Natives/animAnimSet.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma once

#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/AnimBufferState.hpp>
#include <RED4ext/Scripting/Natives/Generated/CResource.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataChunk.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimFallbackFrameDesc.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <cstdint>

namespace RED4ext
{
namespace anim
{
struct AnimSetEntry;
struct Rig;

struct AnimSet : CResource
{
static constexpr const char* NAME = "animAnimSet";
static constexpr const char* ALIAS = NAME;

DynArray<Handle<anim::AnimSetEntry>> animations; // 40
DynArray<anim::AnimDataChunk> animationDataChunks; // 50
AnimBufferState* dataState; // 60
DataBuffer fallbackAnimDataBuffer; // 68
uint8_t unk90[0xA8 - 0x90]; // 90
DynArray<anim::AnimFallbackFrameDesc> fallbackAnimFrameDescs; // A8
uint8_t unkB8[0xC8 - 0xB8]; // B8
DynArray<uint16_t> fallbackDataAddresses; // C8
DynArray<uint8_t> fallbackAnimDescIndexes; // D8
DynArray<uint8_t> fallbackDataAddressIndexes; // E8
uint16_t fallbackNumPositionData; // F8
uint16_t fallbackNumRotationData; // FA
uint16_t fallbackNumFloatTrackData; // FC
uint8_t unkFE[0x130 - 0xFE]; // FE
Ref<anim::Rig> rig; // 130
red::TagList tags; // 148
uint8_t unk158[0x1E8 - 0x158]; // 158
uint32_t version; // 1E8
uint8_t unk1EC[0x1F0 - 0x1EC]; // 1EC
};
RED4EXT_ASSERT_SIZE(AnimSet, 0x1F0);
} // namespace anim
using animAnimSet = anim::AnimSet;
} // namespace RED4ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once

#include <RED4ext/CName.hpp>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Range.hpp>
#include <RED4ext/Scripting/Natives/AnimBufferState.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataAddress.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/IAnimationBuffer.hpp>
#include <RED4ext/Scripting/Natives/KeyFrames.hpp>
#include <cstdint>

namespace RED4ext
{
namespace anim
{
struct AnimationBufferCompressed : anim::IAnimationBuffer
{
static constexpr const char* NAME = "animAnimationBufferCompressed";
static constexpr const char* ALIAS = NAME;

DynArray<uint16_t> fallbackFrameIndices; // 30
float duration; // 40
uint32_t numFrames; // 44
uint8_t numExtraJoints; // 48
uint8_t numExtraTracks; // 49
bool isScaleConstant; // 4A
bool hasRawRotations; // 4B
uint16_t numJoints; // 4C
uint16_t numTracks; // 4E
uint32_t numAnimKeysCompressed; // 50
uint32_t numAnimKeysRaw; // 54
uint32_t numConstAnimKeys; // 58
uint32_t numTrackKeys; // 5C
uint32_t numConstTrackKeys; // 60
AnimDataAddress dataAddress; // 64
DeferredDataBuffer defferedBuffer; // 70
DataBuffer inplaceCompressedBuffer; // C8
DynArray<CName> extraDataNames; // F0
uint8_t unk100[0x110 - 0x100]; // 100
Range<KeyFrameCompressed> animKeysCompressed; // 110
Range<KeyFrameRaw> animKeysRaw; // 120
Range<KeyFrameConst> constAnimKeys; // 130
Range<TrackKey> trackKeys; // 140
Range<TrackKeyConst> constTrackKeys; // 150
AnimBufferState dataState; // 160
uint64_t unk180; // 180
};
RED4EXT_ASSERT_SIZE(AnimationBufferCompressed, 0x188);
} // namespace anim
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext
4 changes: 2 additions & 2 deletions include/RED4ext/Scripting/Natives/animRig.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#pragma once

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/Scripting/Natives/Generated/CResource.hpp>
Expand All @@ -13,6 +12,7 @@
#include <RED4ext/Scripting/Natives/Generated/physics/RagdollBodyInfo.hpp>
#include <RED4ext/Scripting/Natives/Generated/physics/RagdollBodyNames.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <cstdint>

namespace RED4ext::anim
{
Expand Down