Skip to content

Commit e45e439

Browse files
committed
🛠️ Fix easing args not saving correctly
- Fixed incorrect transoforms only tag check
1 parent 4315574 commit e45e439

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/components/keyframeEasings.svelte

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
5454
if (hasArgs(selectedKeyframe.easing)) getEasingArgs()
5555
56-
console.log(match[2].toLowerCase(), match[1].toLowerCase())
5756
return {
5857
type: match?.[2].toLowerCase(),
5958
mode: match?.[1].toLowerCase(),
@@ -76,20 +75,26 @@
7675
easingMode = mode
7776
}
7877
79-
let unsub: () => void
78+
let unsub: (() => void) | undefined
8079
function getEasingArgs() {
8180
if (!selectedKeyframe) return
8281
unsub && unsub()
8382
if (hasArgs(selectedKeyframe.easing)) {
84-
easingArg = new Valuable(getEasingArgDefault(selectedKeyframe) || 0)
85-
unsub = easingArg.subscribe(value => setEasingArgs(value))
83+
easingArg = new Valuable(
84+
selectedKeyframe.easingArgs?.[0] || getEasingArgDefault(selectedKeyframe) || 0,
85+
)
86+
unsub = easingArg?.subscribe(value => setEasingArgs(value))
8687
} else {
8788
easingArg = undefined
8889
}
8990
}
9091
91-
function setEasingArgs(arg: number) {
92+
function setEasingArgs(arg: number | undefined) {
9293
if (!selectedKeyframe) return
94+
if (!arg) {
95+
selectedKeyframe.easingArgs = undefined
96+
return
97+
}
9398
selectedKeyframe.easingArgs = [arg]
9499
}
95100
@@ -111,7 +116,6 @@
111116
['position', 'rotation', 'scale'].includes(keyframe.channel) &&
112117
!isFirstKeyframe(keyframe)
113118
) {
114-
console.log(keyframe)
115119
selectedKeyframe = keyframe
116120
const easing = getSelectedEasing()
117121
if (easing) {
@@ -124,10 +128,12 @@
124128
})
125129
126130
events.UNSELECT_KEYFRAME.subscribe(() => {
131+
setEasingArgs($easingArg)
127132
selectedKeyframe = undefined
128133
})
129134
130135
events.UNSELECT_AJ_PROJECT.subscribe(() => {
136+
setEasingArgs($easingArg)
131137
selectedKeyframe = undefined
132138
})
133139
</script>

src/systems/datapackCompiler/animation.mcb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,12 @@ dir <%export_namespace%> {
457457
const variant = rig.variants[frame.variant.uuid]
458458
if (!variant) return
459459
const execute_condition = variant.execute_condition ? variant.execute_condition.trim() + ' ' : ''
460-
emit.mcb(`execute on vehicle unless entity @s[tag=!<%TAGS.TRANSFORMS_ONLY()%>] ${execute_condition}run function *${export_namespace}/variants/${variant.name}/apply`)
460+
emit.mcb(`execute on vehicle unless entity @s[tag=<%TAGS.TRANSFORMS_ONLY()%>] ${execute_condition}run function *${export_namespace}/variants/${variant.name}/apply`)
461461
}
462462
if (frame.commands) {
463463
const commands = frame.commands
464464
const execute_condition = commands.execute_condition ? commands.execute_condition.trim() + ' ' : ''
465-
emit.mcb(`execute on vehicle unless entity @s[tag=!<%TAGS.TRANSFORMS_ONLY()%>] ${execute_condition}run {\n${commands.commands}\n}`)
465+
emit.mcb(`execute on vehicle unless entity @s[tag=<%TAGS.TRANSFORMS_ONLY()%>] at @s ${execute_condition}run {\n${commands.commands}\n}`)
466466
}
467467
%%>
468468
}

0 commit comments

Comments
 (0)