Skip to content

Commit 069e02e

Browse files
committed
🛠️ Fix #193
1 parent 7562348 commit 069e02e

File tree

7 files changed

+114
-95
lines changed

7 files changed

+114
-95
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "animated_java",
44
"title": "Animated Java",
55
"version": "0.5.3",
6-
"display_version": "1.0.0-pre3",
6+
"display_version": "1.0.0-pre4",
77
"min_blockbench_version": "4.10.0",
88
"author": {
99
"name": "Titus Evans (SnaveSutit)",

src/components/variantConfigDialog.svelte

Lines changed: 88 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -132,91 +132,99 @@
132132
{$uuid}
133133
</div>
134134

135-
<div class="toolbar" style="margin: 8px 0;">
136-
<div>
137-
{translate('dialog.variant_config.texture_map.title')}
138-
</div>
139-
<div class="spacer" />
140-
<!-- svelte-ignore a11y-click-events-have-key-events -->
141-
<div
142-
class="tool"
143-
title={translate('dialog.variant_config.texture_map.create_new_mapping')}
144-
on:click={() => {}}
145-
>
146-
<i class="material-icons icon" on:click={() => createTextureMapping()}>add</i>
135+
{#if !variant.isDefault}
136+
<div class="toolbar" style="margin: 8px 0;">
137+
<div>
138+
{translate('dialog.variant_config.texture_map.title')}
139+
</div>
140+
<div class="spacer" />
141+
<!-- svelte-ignore a11y-click-events-have-key-events -->
142+
<div
143+
class="tool"
144+
title={translate('dialog.variant_config.texture_map.create_new_mapping')}
145+
on:click={() => {}}
146+
>
147+
<i class="material-icons icon" on:click={() => createTextureMapping()}>add</i>
148+
</div>
149+
<!-- svelte-ignore a11y-click-events-have-key-events -->
150+
<!-- svelte-ignore missing-declaration -->
151+
<i
152+
class="fa fa-question dialog_form_description"
153+
title={translate('dialog.variant_config.texture_map.description')}
154+
on:click={() => {
155+
const tooltip = translate('dialog.variant_config.texture_map.description')
156+
Blockbench.showQuickMessage(tooltip, 50 * tooltip.length)
157+
}}
158+
/>
147159
</div>
148-
<!-- svelte-ignore a11y-click-events-have-key-events -->
149-
<!-- svelte-ignore missing-declaration -->
150-
<i
151-
class="fa fa-question dialog_form_description"
152-
title={translate('dialog.variant_config.texture_map.description')}
153-
on:click={() => {
154-
const tooltip = translate('dialog.variant_config.texture_map.description')
155-
Blockbench.showQuickMessage(tooltip, 50 * tooltip.length)
156-
}}
157-
/>
158-
</div>
159-
<lu class="texture_map_container">
160-
{#key textureMapUpdated}
161-
{#each [...textureMap.map.entries()] as entry, index}
162-
<div class="texture_mapping_item"></div>
163-
<li class="texture_mapping_item">
164-
<div class="texture_mapping_item_dropdown_container">
165-
<img src={getTextureSrc(entry[0])} alt="" />
166-
<select
167-
class="texture_mapping_item_dropdown"
168-
on:change={e => selectNewPrimaryTexture(e, entry[0])}
169-
>
170-
<!-- svelte-ignore missing-declaration -->
171-
{#each primaryTextures as texture}
172-
<option selected={texture.uuid === entry[0]}>
173-
{texture.name}
174-
</option>
175-
{/each}
176-
</select>
177-
</div>
160+
<lu class="texture_map_container">
161+
{#key textureMapUpdated}
162+
{#each [...textureMap.map.entries()] as entry, index}
163+
<div class="texture_mapping_item"></div>
164+
<li class="texture_mapping_item">
165+
<div class="texture_mapping_item_dropdown_container">
166+
<img src={getTextureSrc(entry[0])} alt="" />
167+
<select
168+
class="texture_mapping_item_dropdown"
169+
on:change={e => selectNewPrimaryTexture(e, entry[0])}
170+
>
171+
<!-- svelte-ignore missing-declaration -->
172+
{#each primaryTextures as texture}
173+
<option selected={texture.uuid === entry[0]}>
174+
{texture.name}
175+
</option>
176+
{/each}
177+
</select>
178+
</div>
179+
180+
<i class="material-icons icon">east</i>
178181

179-
<i class="material-icons icon">east</i>
182+
<div class="texture_mapping_item_dropdown_container">
183+
<img src={getTextureSrc(entry[1])} alt="" />
184+
<select
185+
class="texture_mapping_item_dropdown"
186+
on:change={e => selectNewSecondaryTexture(e, entry[0])}
187+
>
188+
<!-- svelte-ignore missing-declaration -->
189+
{#each secondaryTextures as texture}
190+
<option selected={texture.uuid === entry[1]}>
191+
{texture.name}
192+
</option>
193+
{/each}
194+
</select>
195+
</div>
180196

181-
<div class="texture_mapping_item_dropdown_container">
182-
<img src={getTextureSrc(entry[1])} alt="" />
183-
<select
184-
class="texture_mapping_item_dropdown"
185-
on:change={e => selectNewSecondaryTexture(e, entry[0])}
197+
<!-- svelte-ignore a11y-click-events-have-key-events -->
198+
<i
199+
class="material-icons icon tool"
200+
on:click={() => deleteTextureMapping(entry[0])}>delete</i
186201
>
187-
<!-- svelte-ignore missing-declaration -->
188-
{#each secondaryTextures as texture}
189-
<option selected={texture.uuid === entry[1]}>
190-
{texture.name}
191-
</option>
192-
{/each}
193-
</select>
202+
</li>
203+
{:else}
204+
<div class="no_mappings">
205+
{translate('dialog.variant_config.texture_map.no_mappings')}
194206
</div>
195-
196-
<!-- svelte-ignore a11y-click-events-have-key-events -->
197-
<i
198-
class="material-icons icon tool"
199-
on:click={() => deleteTextureMapping(entry[0])}>delete</i
200-
>
201-
</li>
202-
{:else}
203-
<div class="no_mappings">
204-
{translate('dialog.variant_config.texture_map.no_mappings')}
205-
</div>
206-
{/each}
207-
{/key}
208-
</lu>
209-
<Collection
210-
label={translate('dialog.variant_config.excluded_bones.title')}
211-
tooltip={translate('dialog.variant_config.bone_lists.description')}
212-
availableItemsColumnLable={translate('dialog.variant_config.included_bones.title')}
213-
availableItemsColumnTooltip={translate('dialog.variant_config.included_bones.description')}
214-
includedItemsColumnLable={translate('dialog.variant_config.excluded_bones.title')}
215-
includedItemsColumnTooltip={translate('dialog.variant_config.excluded_bones.description')}
216-
swapColumnsButtonTooltip={translate('dialog.variant_config.swap_columns_button.tooltip')}
217-
availableItems={availableBones}
218-
bind:includedItems={excludedBones}
219-
/>
207+
{/each}
208+
{/key}
209+
</lu>
210+
<Collection
211+
label={translate('dialog.variant_config.excluded_bones.title')}
212+
tooltip={translate('dialog.variant_config.bone_lists.description')}
213+
availableItemsColumnLable={translate('dialog.variant_config.included_bones.title')}
214+
availableItemsColumnTooltip={translate(
215+
'dialog.variant_config.included_bones.description',
216+
)}
217+
includedItemsColumnLable={translate('dialog.variant_config.excluded_bones.title')}
218+
includedItemsColumnTooltip={translate(
219+
'dialog.variant_config.excluded_bones.description',
220+
)}
221+
swapColumnsButtonTooltip={translate(
222+
'dialog.variant_config.swap_columns_button.tooltip',
223+
)}
224+
availableItems={availableBones}
225+
bind:includedItems={excludedBones}
226+
/>
227+
{/if}
220228
</div>
221229

222230
<style>

src/components/variantsPanel.svelte

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,11 @@
137137
{item.value.displayName}
138138
</div>
139139
<div class="spacer" />
140-
{#if !item.value.isDefault}
141-
<i
142-
class="material-icons icon in_list_button"
143-
title={translate('panel.variants.tool.edit_variant')}
144-
on:click={() => openVariantConfigDialog(item.value)}>edit</i
145-
>
146-
{/if}
140+
<i
141+
class="material-icons icon in_list_button"
142+
title={translate('panel.variants.tool.edit_variant')}
143+
on:click={() => openVariantConfigDialog(item.value)}>edit</i
144+
>
147145
{#if Variant.selected === item.value}
148146
<i
149147
class="material-icons icon in_list_button"
@@ -153,15 +151,26 @@
153151
<i
154152
class="material-icons icon in_list_button in_list_button_disabled"
155153
title={translate('panel.variants.tool.variant_not_visible')}
156-
>visibility_off</i
157154
>
155+
visibility_off
156+
</i>
158157
{/if}
158+
159159
{#if !item.value.isDefault}
160160
<!-- svelte-ignore a11y-click-events-have-key-events -->
161161
<i
162162
class="material-icons icon in_list_button"
163-
on:click={e => deleteVariant(e)}>delete</i
163+
on:click={e => deleteVariant(e)}
164+
>
165+
delete
166+
</i>
167+
{:else}
168+
<i
169+
class="material-icons icon in_list_button_disabled"
170+
title={translate('panel.variants.tool.cannot_delete_default_variant')}
164171
>
172+
delete
173+
</i>
165174
{/if}
166175
{/if}
167176
</li>

src/lang/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ animated_java.panel.variants.tool.duplicate_selected_variant: Duplicate Selected
323323
animated_java.panel.variants.tool.delete_selected_variant: Delete Selected Variant
324324
animated_java.panel.variants.tool.variant_visible: Variant Selected
325325
animated_java.panel.variants.tool.variant_not_visible: Variant Not Selected
326+
animated_java.panel.variants.tool.cannot_delete_default_variant: Cannot delete the default variant!
326327

327328
animated_java.action.variants.create: Create Variant
328329
animated_java.action.variants.duplicate: Duplicate Variant

src/systems/animated_java.mcb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,11 @@ dir <%export_namespace%> {
600600
}
601601

602602
dir variants {
603-
dir default {
603+
dir <%defaultVariant.name%> {
604604
function apply {
605605
execute unless entity @s[type=item_display,tag=<%TAGS.PROJECT_ROOT(export_namespace)%>] run return run \
606606
function *global/errors/function_not_executed_as_root_entity \
607-
{'function_path': 'animated_java:<%export_namespace%>/variants/default/apply'}
607+
{'function_path': 'animated_java:<%export_namespace%>/variants/<%defaultVariant.name%>/apply'}
608608
REPEAT (Object.values(rig.nodeMap)) as node {
609609
IF (node.type === 'bone') {
610610
execute on passengers if entity @s[tag=aj.<%export_namespace%>.bone.<%node.name%>] run {

src/systems/datapackCompiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ export async function compileDataPack(options: {
566566
rig,
567567
animations,
568568
variants: Variant.all,
569+
defaultVariant: Variant.getDefault(),
569570
export_version: Math.random().toString().substring(2, 10),
570571
root_entity_passengers: await generateRootEntityPassengers(rig, rigHash),
571572
TAGS,

test_blueprints/armor_stand.ajblueprint

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"format": "animated_java_blueprint",
4-
"format_version": "0.5.2",
4+
"format_version": "0.5.3",
55
"uuid": "167b27cd-b559-3f13-a97c-0841fe21f1d1",
66
"save_location": "D:\\github-repos\\animated-java\\animated-java\\test_blueprints\\armor_stand.ajblueprint",
77
"last_used_export_namespace": "armor_stand"
@@ -1656,7 +1656,7 @@
16561656
"override": false,
16571657
"length": 2,
16581658
"snapping": 20,
1659-
"selected": true,
1659+
"selected": false,
16601660
"saved": false,
16611661
"path": "",
16621662
"anim_time_update": "",
@@ -3925,7 +3925,7 @@
39253925
"override": false,
39263926
"length": 4.95,
39273927
"snapping": 20,
3928-
"selected": false,
3928+
"selected": true,
39293929
"saved": false,
39303930
"path": "",
39313931
"anim_time_update": "",

0 commit comments

Comments
 (0)