Skip to content

Commit aa6f4ce

Browse files
committed
⏺️ Excluded Bones -> Excluded Nodes
- Added cameras, locators, item displays, text displays, and block displays to the excluded nodes list.
1 parent 81fbf90 commit aa6f4ce

13 files changed

+138
-66
lines changed

src/blockbenchTypeMods.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ declare global {
6767

6868
// eslint-disable-next-line @typescript-eslint/naming-convention
6969
interface _Animation {
70-
excluded_bones: CollectionItem[]
70+
excluded_nodes: CollectionItem[]
7171
}
7272

7373
// eslint-disable-next-line @typescript-eslint/naming-convention

src/blueprintFormat.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Valuable } from './util/stores'
1010
import { TRANSPARENT_TEXTURE, TRANSPARENT_TEXTURE_MATERIAL, Variant } from './variants'
1111
import FormatPageSvelte from './components/formatPage.svelte'
1212
import { translate } from './util/translation'
13+
import { process } from './systems/modelDataFixerUpper'
1314

1415
/**
1516
* The serialized Variant Bone Config
@@ -95,7 +96,7 @@ export interface IBlueprintVariantJSON {
9596
/**
9697
* The list of bones that should be ignored when applying the Variant
9798
*/
98-
excluded_bones: string[]
99+
excluded_nodes: string[]
99100
}
100101

101102
/**
@@ -137,7 +138,7 @@ export interface IBlueprintFormatJSON {
137138
elements: any[]
138139
outliner: any[]
139140
textures: Texture[]
140-
animations: AnimationOptions[]
141+
animations: AnimationOptions[] & { excluded_nodes: string[] }
141142
animation_controllers?: AnimationControllerOptions[]
142143
animation_variable_placeholders: string
143144
backgrounds?: Record<string, any>
@@ -200,6 +201,7 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
200201
// ANCHOR - Codec:load
201202
load(model: IBlueprintFormatJSON, file) {
202203
console.log(`Loading Animated Java Blueprint from '${file.name}'...`)
204+
model = process(model)
203205
setupProject(BLUEPRINT_FORMAT, model.meta.uuid)
204206
if (!Project) {
205207
throw new Error('Failed to load Animated Java Blueprint')
@@ -425,7 +427,7 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
425427
list: Variant.all.filter(v => !v.isDefault).map(v => v.toJSON()),
426428
}
427429

428-
model.animations = []
430+
model.animations = [] as any
429431
const animationOptions = { bone_names: true, absolute_paths: options.absolute_paths }
430432
for (const animation of Blockbench.Animation.all) {
431433
if (!animation.getUndoCopy) continue

src/components/animationProperties.svelte

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@
1010
<script lang="ts">
1111
import Collection from './dialogItems/collection.svelte'
1212
import Select from './dialogItems/select.svelte'
13+
import { getAvailableNodes } from '../util/excludedNodes'
1314
1415
export let animationName: Valuable<string>
1516
export let loopMode: Valuable<string>
1617
export let loopDelay: Valuable<number>
1718
export let excludedBones: Valuable<Array<{ name: string; value: string }>>
1819
19-
const availableBones = Group.all.map(group => {
20-
const entry = excludedBones.get().find(bone => bone.value === group.uuid)
21-
if (entry) {
22-
entry.name = group.name
23-
}
24-
25-
return { name: group.name, value: group.uuid }
26-
})
20+
const availableBones = getAvailableNodes(excludedBones.get())
2721
2822
function animationNameValueChecker(value: string): { type: string; message: string } {
2923
if (value.trim().length === 0) {
@@ -71,15 +65,15 @@
7165
/>
7266

7367
<Collection
74-
label={translate('dialog.animation_properties.excluded_bones.title')}
68+
label={translate('dialog.animation_properties.excluded_nodes.title')}
7569
tooltip={translate('dialog.animation_properties.bone_lists.description')}
76-
availableItemsColumnLable={translate('dialog.animation_properties.included_bones.title')}
70+
availableItemsColumnLable={translate('dialog.animation_properties.included_nodes.title')}
7771
availableItemsColumnTooltip={translate(
78-
'dialog.animation_properties.included_bones.description',
72+
'dialog.animation_properties.included_nodes.description',
7973
)}
80-
includedItemsColumnLable={translate('dialog.animation_properties.excluded_bones.title')}
74+
includedItemsColumnLable={translate('dialog.animation_properties.excluded_nodes.title')}
8175
includedItemsColumnTooltip={translate(
82-
'dialog.animation_properties.excluded_bones.description',
76+
'dialog.animation_properties.excluded_nodes.description',
8377
)}
8478
swapColumnsButtonTooltip={translate(
8579
'dialog.animation_properties.swap_columns_button.tooltip',

src/components/dialogItems/collection.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
for (let i = 0; i < availableItems.length; i++) {
2626
const item = availableItems[i]
2727
if (includedItems.get().find(i => i.value === item.value)) {
28-
includedItemsList.push({ id: i, title: item.name })
28+
includedItemsList.push({ id: i, title: item.name, icon: item.icon })
2929
} else {
30-
availableItemsList.push({ id: i, title: item.name })
30+
availableItemsList.push({ id: i, title: item.name, icon: item.icon })
3131
}
3232
}
3333
@@ -80,7 +80,7 @@
8080
{/if}
8181
<i
8282
class="material-icons notranslate icon"
83-
style="color: rgb(162, 235, 255);">folder</i
83+
style="color: rgb(162, 235, 255);">{item.icon || 'folder'}</i
8484
>
8585
<span>{item.title}</span>
8686
</div>
@@ -119,7 +119,7 @@
119119
{/if}
120120
<i
121121
class="material-icons notranslate icon"
122-
style="color: rgb(162, 235, 255);">folder</i
122+
style="color: rgb(162, 235, 255);">{item.icon || 'folder'}</i
123123
>
124124
<span>{item.title}</span>
125125
</div>

src/components/dialogItems/dialogItemUtil.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ type DialogItemValueChecker<Value> =
22
| ((value: Value) => { type: string; message: string })
33
| undefined
44

5-
type CollectionItem = { name: string; value: string }
5+
type CollectionItem = { icon?: string; name: string; value: string }

src/components/variantConfigDialog.svelte

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,21 @@
99

1010
<script lang="ts">
1111
import Collection from './dialogItems/collection.svelte'
12+
import { getAvailableNodes } from '../util/excludedNodes'
1213
1314
export let variant: Variant
1415
export let displayName: Valuable<string>
1516
export let name: Valuable<string>
1617
export let uuid: Valuable<string>
1718
export let textureMap: TextureMap
1819
export let generateNameFromDisplayName: Valuable<boolean>
19-
export let excludedBones: Valuable<Array<{ name: string; value: string }>>
20+
export let excludedBones: Valuable<Array<CollectionItem>>
2021
2122
const availableTextures = [...Texture.all, TRANSPARENT_TEXTURE]
2223
const primaryTextures = [...Texture.all]
2324
const secondaryTextures = availableTextures
2425
25-
const availableBones = Group.all.map(group => {
26-
const entry = excludedBones.get().find(bone => bone.value === group.uuid)
27-
if (entry) {
28-
entry.name = group.name
29-
}
30-
31-
return { name: group.name, value: group.uuid }
32-
})
26+
const availableBones = getAvailableNodes(excludedBones.get())
3327
3428
let textureMapUpdated = 0
3529
@@ -208,15 +202,15 @@
208202
{/key}
209203
</lu>
210204
<Collection
211-
label={translate('dialog.variant_config.excluded_bones.title')}
205+
label={translate('dialog.variant_config.excluded_nodes.title')}
212206
tooltip={translate('dialog.variant_config.bone_lists.description')}
213-
availableItemsColumnLable={translate('dialog.variant_config.included_bones.title')}
207+
availableItemsColumnLable={translate('dialog.variant_config.included_nodes.title')}
214208
availableItemsColumnTooltip={translate(
215-
'dialog.variant_config.included_bones.description',
209+
'dialog.variant_config.included_nodes.description',
216210
)}
217-
includedItemsColumnLable={translate('dialog.variant_config.excluded_bones.title')}
211+
includedItemsColumnLable={translate('dialog.variant_config.excluded_nodes.title')}
218212
includedItemsColumnTooltip={translate(
219-
'dialog.variant_config.excluded_bones.description',
213+
'dialog.variant_config.excluded_nodes.description',
220214
)}
221215
swapColumnsButtonTooltip={translate(
222216
'dialog.variant_config.swap_columns_button.tooltip',

src/interface/animationPropertiesDialog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function openAnimationPropertiesDialog(animation: _Animation) {
88
const animationName = new Valuable(animation.name)
99
const loopMode = new Valuable(animation.loop)
1010
const loopDelay = new Valuable(Number(animation.loop_delay) || 0)
11-
const excludedBones = new Valuable(animation.excluded_bones)
11+
const excludedBones = new Valuable(animation.excluded_nodes)
1212

1313
new SvelteDialog({
1414
id: `${PACKAGE.name}:animationPropertiesDialog`,
@@ -27,7 +27,7 @@ export function openAnimationPropertiesDialog(animation: _Animation) {
2727
animation.createUniqueName(Blockbench.Animation.all)
2828
animation.loop = loopMode.get()
2929
animation.loop_delay = loopDelay.get().toString()
30-
animation.excluded_bones = excludedBones.get()
30+
animation.excluded_nodes = excludedBones.get()
3131
},
3232
}).show()
3333
}

src/lang/en.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ animated_java.dialog.variant_config.texture_map.description: A map of which text
275275
animated_java.dialog.variant_config.texture_map.create_new_mapping: Create New Mapping
276276
animated_java.dialog.variant_config.texture_map.no_mappings: Variant has no mapped textures.
277277

278-
animated_java.dialog.variant_config.bone_lists.description: A list of bones to include or exclude from the Variant. Only bones in the included list will be modified by the Variant, and bones in the excluded list will be ignored.
279-
animated_java.dialog.variant_config.excluded_bones.title: Excluded Bones
280-
animated_java.dialog.variant_config.excluded_bones.description: A list of bones to exclude from the Variant. These bones will not be modified by the Variant.
281-
animated_java.dialog.variant_config.included_bones.title: Included Bones
282-
animated_java.dialog.variant_config.included_bones.description: A list of bones to include in the Variant. Only these bones will be modified by the Variant.
278+
animated_java.dialog.variant_config.bone_lists.description: A list of nodes to include or exclude from the Variant. Only nodes in the included list will be modified by the Variant, and nodes in the excluded list will be ignored.
279+
animated_java.dialog.variant_config.excluded_nodes.title: Excluded Nodes
280+
animated_java.dialog.variant_config.excluded_nodes.description: A list of nodes to exclude from the Variant. These nodes will not be modified by the Variant.
281+
animated_java.dialog.variant_config.included_nodes.title: Included Nodes
282+
animated_java.dialog.variant_config.included_nodes.description: A list of nodes to include in the Variant. Only these nodes will be modified by the Variant.
283283
animated_java.dialog.variant_config.swap_columns_button.tooltip: Swap Lists
284284

285285
## Old AJModel Loader Dialog
@@ -306,11 +306,11 @@ animated_java.dialog.animation_properties.animation_name.error.invalid_character
306306
animated_java.dialog.animation_properties.loop_delay.title: Loop Delay
307307
animated_java.dialog.animation_properties.loop_delay.description: The delay between loops. This is the time the animation will pause before starting again. This is only used when the Loop Mode is set to Loop.
308308

309-
animated_java.dialog.animation_properties.bone_lists.description: A list of bones to include or exclude from the animation. Only bones in the included list will be modified by the animation, and bones in the excluded list will be ignored.
310-
animated_java.dialog.animation_properties.excluded_bones.title: Excluded Bones
311-
animated_java.dialog.animation_properties.excluded_bones.description: A list of bones to exclude from the animation. These bones will not be modified by the animation.
312-
animated_java.dialog.animation_properties.included_bones.title: Included Bones
313-
animated_java.dialog.animation_properties.included_bones.description: A list of bones to include in the animation. Only these bones will be modified by the animation.
309+
animated_java.dialog.animation_properties.bone_lists.description: A list of nodes to include or exclude from the animation. Only nodes in the included list will be modified by the animation, and nodes in the excluded list will be ignored.
310+
animated_java.dialog.animation_properties.excluded_nodes.title: Excluded Nodes
311+
animated_java.dialog.animation_properties.excluded_nodes.description: A list of nodes to exclude from the animation. These nodes will not be modified by the animation.
312+
animated_java.dialog.animation_properties.included_nodes.title: Included Nodes
313+
animated_java.dialog.animation_properties.included_nodes.description: A list of nodes to include in the animation. Only these nodes will be modified by the animation.
314314
animated_java.dialog.animation_properties.swap_columns_button.tooltip: Swap Lists
315315

316316
## Export Progress Dialog
@@ -336,8 +336,8 @@ animated_java.action.variants.delete: Delete Variant
336336
### Animator
337337

338338
## Properties
339-
animated_java.animation.excluded_bones: Excluded Bones
340-
animated_java.animation.invert_excluded_bones: Invert Excluded Bones
339+
animated_java.animation.excluded_nodes: Excluded Nodes
340+
animated_java.animation.invert_excluded_nodes: Invert Excluded Nodes
341341

342342
## Timeline
343343
animated_java.effect_animator.timeline.variant: Variant

src/mods/animationPropertiesMod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ createBlockbenchMod(
6161
context.excludedBonesProperty = new Property(
6262
Blockbench.Animation,
6363
'array',
64-
'excluded_bones',
64+
'excluded_nodes',
6565
{
6666
condition: () => isCurrentFormat(),
67-
label: translate('animation.excluded_bones'),
67+
label: translate('animation.excluded_nodes'),
6868
default: [],
6969
}
7070
)

src/systems/animationRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function getAnimationNodes(
109109
const keyframeMap = new Map(animator.keyframes.map(kf => [kf.time, kf]))
110110
keyframeCache.set(uuid, keyframeMap)
111111
}
112-
excludedBonesCache = new Set(animation.excluded_bones.map(b => b.value))
112+
excludedBonesCache = new Set(animation.excluded_nodes.map(b => b.value))
113113
}
114114
const nodes: IAnimationNode[] = []
115115

0 commit comments

Comments
 (0)