File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
components/keyframePanels Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 7
7
const keyframeValue = new Valuable <string >(getKeyframeVariant (selectedKeyframe ) as string )
8
8
let selectContainer: HTMLDivElement
9
9
10
+ if (! Variant .all .find (v => v .uuid === keyframeValue .get ())) {
11
+ console .warn (' Keyframe variant not found. Resetting to default.' )
12
+ const uuid = Variant .getDefault ().uuid
13
+ setKeyframeVariant (selectedKeyframe , uuid )
14
+ keyframeValue .set (uuid )
15
+ }
16
+
10
17
keyframeValue .subscribe (value => {
11
18
setKeyframeVariant (selectedKeyframe , value )
12
19
})
Original file line number Diff line number Diff line change 1
1
import { IBlueprintVariantJSON } from './blueprintFormat'
2
+ import { getKeyframeVariant , setKeyframeVariant } from './mods/customKeyframesMod'
2
3
import { events } from './util/events'
3
4
import { sanitizePathName } from './util/minecraftUtil'
4
5
@@ -116,6 +117,17 @@ export class Variant {
116
117
// Cannot delete default variant
117
118
if ( this . isDefault ) return
118
119
120
+ for ( const animation of Blockbench . Animation . all ) {
121
+ for ( const animator of Object . values ( animation . animators ) ) {
122
+ for ( const keyframe of animator . keyframes ) {
123
+ const uuid = getKeyframeVariant ( keyframe )
124
+ if ( uuid != undefined && this . uuid === uuid ) {
125
+ setKeyframeVariant ( keyframe , Variant . getDefault ( ) . uuid )
126
+ }
127
+ }
128
+ }
129
+ }
130
+
119
131
const index = Variant . all . indexOf ( this )
120
132
if ( index > - 1 ) {
121
133
Variant . all . splice ( index , 1 )
You can’t perform that action at this time.
0 commit comments