mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 12:53:56 +01:00
Fix: Address karelpak1's review on animated legendary camouflages
- Sockets bound to a joint now sit right on the joint, as in game. Only the skeleton's own children are bound. This fixes the WZ-114 gun barrels collapsing. - Clips keep their full duration when it runs past their last key. - Part states are kept per entity and exported on each part's own switchers, so parts with matching names can't overwrite each other. - A finished one-shot animation now stops on whatever it switched to, as in game. It only keeps looping if it changes nothing. - Delayed actions run in delay order.
This commit is contained in:
1 parent
99373872ed
commit
232b3e7770
5 files changed
+83
-72
No files matched your search
@@ -118,7 +118,7 @@ export async function extractModel(
|
||||
skin: Skin,
|
||||
][] = [];
|
||||
const motions = new Map<Hierarchy, Motion>();
|
||||
const garageMotions = isPart ? partGarage(sc2, preset).motions : new Set();
|
||||
const garage = isPart ? partGarage(sc2, preset) : undefined;
|
||||
|
||||
if (isPart) {
|
||||
const loading: Promise<void>[] = [];
|
||||
@@ -173,7 +173,7 @@ export async function extractModel(
|
||||
skeletons.set(hierarchy, created);
|
||||
|
||||
// only what loops in the garage is exported
|
||||
if (motion && motionComponent && garageMotions.has(hierarchy)) {
|
||||
if (motion && motionComponent && garage?.motions.has(hierarchy)) {
|
||||
createMotionClip(
|
||||
document,
|
||||
buffer,
|
||||
@@ -210,9 +210,9 @@ export async function extractModel(
|
||||
case "StateSwitcherComponent":
|
||||
node.setExtras({
|
||||
// a part's scenarios can pick its state as it loads
|
||||
state:
|
||||
component[`ssc.state${component["ssc.activeState"]}`] ??
|
||||
(isPart ? null : undefined),
|
||||
state: garage
|
||||
? (garage.states.get(hierarchy) ?? null)
|
||||
: component[`ssc.state${component["ssc.activeState"]}`],
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -348,7 +348,13 @@ export async function extractModel(
|
||||
);
|
||||
|
||||
for (const [owner, entity, joint, skin] of jointBindings) {
|
||||
const socket = findNode(owner, entity);
|
||||
// the game only binds the skeleton entity's own children
|
||||
const socket = owner
|
||||
.listChildren()
|
||||
.find(
|
||||
(child) =>
|
||||
child.getName() === entity && !skin.listJoints().includes(child),
|
||||
);
|
||||
|
||||
if (!socket) throw new Error(`Missing socket ${entity}`);
|
||||
|
||||
@@ -362,16 +368,6 @@ export async function extractModel(
|
||||
return document;
|
||||
}
|
||||
|
||||
function findNode(node: Node, name: string): Node | undefined {
|
||||
for (const child of node.listChildren()) {
|
||||
if (child.getName() === name) return child;
|
||||
|
||||
const found = findNode(child, name);
|
||||
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
|
||||
export async function extractMaterials(
|
||||
document: Document,
|
||||
sc2: ReturnType<Sc2ReadStream["sc2"]>,
|
||||
|
||||
Reference in new issue
Block a user