File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,16 @@ export interface IBlueprintFormatJSON {
150
150
151
151
export function convertToBlueprint ( ) {
152
152
// Convert the current project to a Blueprint
153
- // NOTE - Nothing needs to be done here yet. The default functionality is sufficient.
154
153
Project ! . save_path = ''
154
+
155
+ for ( const group of Group . all ) {
156
+ group . createUniqueName ( Group . all . filter ( g => g !== group ) )
157
+ group . sanitizeName ( )
158
+ }
159
+ for ( const animation of Blockbench . Animation . all ) {
160
+ animation . createUniqueName ( Blockbench . Animation . all . filter ( a => a !== animation ) )
161
+ animation . name = toSafeFuntionName ( animation . name )
162
+ }
155
163
}
156
164
157
165
export function getDefaultProjectSettings ( ) : ModelProject [ 'animated_java' ] {
Original file line number Diff line number Diff line change
1
+ import { isCurrentFormat } from '../blueprintFormat'
1
2
import CustomKeyframePanelSvelteComponent from '../components/customKeyframePanel.svelte'
2
3
import { CUSTOM_CHANNELS } from '../mods/customKeyframesMod'
3
4
import { events } from '../util/events'
@@ -8,7 +9,12 @@ import { translate } from '../util/translation'
8
9
const CURRENT_PANEL = new Valuable < HTMLDivElement | undefined > ( undefined )
9
10
10
11
export function injectCustomKeyframePanel ( selectedKeyframe : _Keyframe ) {
11
- if ( ! CUSTOM_CHANNELS . includes ( selectedKeyframe . channel ) ) return
12
+ if (
13
+ ! isCurrentFormat ( ) ||
14
+ ! selectedKeyframe ||
15
+ ! CUSTOM_CHANNELS . includes ( selectedKeyframe . channel )
16
+ )
17
+ return
12
18
13
19
const element = document . querySelector (
14
20
'#panel_keyframe .panel_vue_wrapper .keyframe_data_point'
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ createBlockbenchMod(
7
7
`${ PACKAGE . name } :groupNameMod` ,
8
8
{
9
9
originalRename : Group . prototype . saveName ,
10
+ originalSanitize : Group . prototype . sanitizeName ,
10
11
} ,
11
12
context => {
12
13
Group . prototype . saveName = function ( this : Group , save ?: boolean ) {
@@ -15,6 +16,12 @@ createBlockbenchMod(
15
16
}
16
17
return context . originalRename . call ( this , save )
17
18
}
19
+ Group . prototype . sanitizeName = function ( this : Group ) {
20
+ if ( isCurrentFormat ( ) ) {
21
+ this . name = toSafeFuntionName ( this . name )
22
+ }
23
+ return context . originalSanitize . call ( this )
24
+ }
18
25
return context
19
26
} ,
20
27
context => {
You can’t perform that action at this time.
0 commit comments