Skip to content

Commit 63ce4b5

Browse files
committed
🤪 Whoops, Variants can only exclude bones.
- Added `groupsOnly` and `excludeEmptyGroups` to the `getAvailableNodes` function.
1 parent a765b54 commit 63ce4b5

File tree

3 files changed

+50
-59
lines changed

3 files changed

+50
-59
lines changed

src/components/variantConfigDialog.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
const primaryTextures = [...Texture.all]
2424
const secondaryTextures = availableTextures
2525
26-
const availableBones = getAvailableNodes(excludedBones.get())
26+
const availableBones = getAvailableNodes(excludedBones.get(), {
27+
groupsOnly: true,
28+
excludeEmptyGroups: true,
29+
})
2730
2831
let textureMapUpdated = 0
2932

src/util/excludedNodes.ts

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,31 @@ import { TextDisplay } from '../outliner/textDisplay'
22
import { VanillaBlockDisplay } from '../outliner/vanillaBlockDisplay'
33
import { VanillaItemDisplay } from '../outliner/vanillaItemDisplay'
44

5-
export function getAvailableNodes(excludedNodes: CollectionItem[]): CollectionItem[] {
6-
const allNodes = [
7-
...Group.all,
8-
...Locator.all,
9-
...TextDisplay.all,
10-
...VanillaItemDisplay.all,
11-
...VanillaBlockDisplay.all,
12-
...(OutlinerElement.types.camera?.all || []),
13-
]
5+
export function getAvailableNodes(
6+
excludedNodes: CollectionItem[],
7+
options: { groupsOnly?: boolean; excludeEmptyGroups?: boolean } = {}
8+
): CollectionItem[] {
9+
const allNodes: Array<
10+
Group | Locator | TextDisplay | VanillaItemDisplay | VanillaBlockDisplay | OutlinerElement
11+
> = []
12+
if (options?.excludeEmptyGroups) {
13+
allNodes.push(
14+
...Group.all.filter(
15+
g => g.children.length > 0 && g.children.some(c => c instanceof Cube)
16+
)
17+
)
18+
} else {
19+
allNodes.push(...Group.all)
20+
}
21+
if (!options?.groupsOnly) {
22+
allNodes.push(
23+
...Locator.all,
24+
...TextDisplay.all,
25+
...VanillaItemDisplay.all,
26+
...VanillaBlockDisplay.all,
27+
...(OutlinerElement.types.camera?.all || [])
28+
)
29+
}
1430
const availableNodes = allNodes.map(node => {
1531
const entry = excludedNodes.find(n => n.value === node.uuid)
1632
if (entry) {

test_blueprints/armor_stand.ajblueprint

Lines changed: 21 additions & 49 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.4",
4+
"format_version": "0.5.5",
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"
@@ -1569,34 +1569,6 @@
15691569
"source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAgCAYAAACinX6EAAAAAXNSR0IArs4c6QAAAZZJREFUaEPtVruqhDAQjZ1gYSlY+gH+gfZ+sb2fYWEpCDaCgt1eTrhHhlldLsgVNkkajZldmJPzmMh4viLP+zcBgMAAzxEIEvCcAMEEgwSCBDxHIEjAcwKEFAgSCBJQCHRd98KnbdtMkiSmrmunWfLWHACoqsr0fW+GYTBN0/gFQNu2r6IobPNYXgIgVeE8ANQ8dY8ntC994OrMBYZEAACGl+e5GcfRNp+mqQVA75dlsd9xjjMnAIDm0QgAYINZltnmpmmyaQBPwKIvYL/vu63/9pSwDOCNoyGy4YoBEhAA5AQAvHHcMCVA+pPycRxbRnCPpxMMkBJg07xlSkD6g/QAFwalQwK6eeqdjAADyBBpmt8ek28eoCMPzWqT1CnxKSZ1pHLE5v/yXMYuz55ImSMGz7L/L42hhqMzPQJ7mui6rvadqSLrySjW6988YbK353w5OgNE3F5Zlmae5wMEMogyg+lKOV3VP2GytwE4G6TYIG8eJsrU0JKSfqLrAdh/e8xtAJgiB89/hyrdsDzX72cAoeaJlPkBm2JOMHlI974AAAAASUVORK5CYII=",
15701570
"image_data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAgCAYAAACinX6EAAAAAXNSR0IArs4c6QAAAZZJREFUaEPtVruqhDAQjZ1gYSlY+gH+gfZ+sb2fYWEpCDaCgt1eTrhHhlldLsgVNkkajZldmJPzmMh4viLP+zcBgMAAzxEIEvCcAMEEgwSCBDxHIEjAcwKEFAgSCBJQCHRd98KnbdtMkiSmrmunWfLWHACoqsr0fW+GYTBN0/gFQNu2r6IobPNYXgIgVeE8ANQ8dY8ntC994OrMBYZEAACGl+e5GcfRNp+mqQVA75dlsd9xjjMnAIDm0QgAYINZltnmpmmyaQBPwKIvYL/vu63/9pSwDOCNoyGy4YoBEhAA5AQAvHHcMCVA+pPycRxbRnCPpxMMkBJg07xlSkD6g/QAFwalQwK6eeqdjAADyBBpmt8ek28eoCMPzWqT1CnxKSZ1pHLE5v/yXMYuz55ImSMGz7L/L42hhqMzPQJ7mui6rvadqSLrySjW6988YbK353w5OgNE3F5Zlmae5wMEMogyg+lKOV3VP2GytwE4G6TYIG8eJsrU0JKSfqLrAdh/e8xtAJgiB89/hyrdsDzX72cAoeaJlPkBm2JOMHlI974AAAAASUVORK5CYII=",
15711571
"mode": "bitmap"
1572-
},
1573-
{
1574-
"path": "",
1575-
"name": "empty.png",
1576-
"folder": "block",
1577-
"namespace": "",
1578-
"id": "3",
1579-
"width": 64,
1580-
"height": 64,
1581-
"uv_width": 64,
1582-
"uv_height": 64,
1583-
"particle": false,
1584-
"use_as_default": false,
1585-
"layers_enabled": false,
1586-
"sync_to_project": "",
1587-
"render_mode": "default",
1588-
"render_sides": "auto",
1589-
"frame_time": 1,
1590-
"frame_order_type": "loop",
1591-
"frame_order": "",
1592-
"frame_interpolate": false,
1593-
"visible": true,
1594-
"internal": true,
1595-
"saved": false,
1596-
"uuid": "a3f6a420-7f66-366f-30dc-58d15dec29b7",
1597-
"source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAIRJREFUeF7t1QERADAMArHi33SFfOagHBm7+Fv8/hOABsQTQCBeAJ8gAgjEE0AgXgArgAAC8QQQiBfACiCAQDwBBOIFsAIIIBBPAIF4AawAAgjEE0AgXgArgAAC8QQQiBfACiCAQDwBBOIFsAIIIBBPAIF4AawAAgjEE0AgXgArgECdwANo2ABBrP9ggQAAAABJRU5ErkJggg==",
1598-
"image_data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAIRJREFUeF7t1QERADAMArHi33SFfOagHBm7+Fv8/hOABsQTQCBeAJ8gAgjEE0AgXgArgAAC8QQQiBfACiCAQDwBBOIFsAIIIBBPAIF4AawAAgjEE0AgXgArgAAC8QQQiBfACiCAQDwBBOIFsAIIIBBPAIF4AawAAgjEE0AgXgArgECdwANo2ABBrP9ggQAAAABJRU5ErkJggg==",
1599-
"mode": "bitmap"
16001572
}
16011573
],
16021574
"variants": {
@@ -1605,27 +1577,27 @@
16051577
"name": "default",
16061578
"uuid": "f78e10c0-a4a3-aa2f-43ac-753facebd709",
16071579
"texture_map": {},
1608-
"excluded_bones": []
1580+
"excluded_nodes": []
16091581
},
16101582
"list": [
16111583
{
16121584
"display_name": "no_armor",
16131585
"name": "no_armor",
16141586
"uuid": "5417306e-2c69-3f36-1e3c-edd904034a36",
16151587
"texture_map": {
1616-
"240844f3-f615-fe51-0ada-d208791fbdc0": "a3f6a420-7f66-366f-30dc-58d15dec29b7",
1617-
"34528a28-3a31-8b47-65bb-ef2b60b02401": "a3f6a420-7f66-366f-30dc-58d15dec29b7"
1588+
"240844f3-f615-fe51-0ada-d208791fbdc0": "797174ae-5c58-4a83-a630-eefd51007c80",
1589+
"34528a28-3a31-8b47-65bb-ef2b60b02401": "797174ae-5c58-4a83-a630-eefd51007c80"
16181590
},
1619-
"excluded_bones": []
1591+
"excluded_nodes": []
16201592
},
16211593
{
16221594
"display_name": "no_baseplate",
16231595
"name": "no_baseplate",
16241596
"uuid": "bf2a6915-ec63-7ccf-3844-ea8be00b97e6",
16251597
"texture_map": {
1626-
"eb6c49b8-8e8e-a039-9a6f-ef6a06bc7924": "a3f6a420-7f66-366f-30dc-58d15dec29b7"
1598+
"eb6c49b8-8e8e-a039-9a6f-ef6a06bc7924": "797174ae-5c58-4a83-a630-eefd51007c80"
16271599
},
1628-
"excluded_bones": [
1600+
"excluded_nodes": [
16291601
"98795982-9c43-6e3e-eed9-2c776a957938",
16301602
"102db36a-eeda-0e6f-d5cc-c186ecda8165",
16311603
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824",
@@ -1644,7 +1616,7 @@
16441616
"name": "colors",
16451617
"uuid": "49521f4b-b970-e4bd-b594-2e05d2d46027",
16461618
"texture_map": {},
1647-
"excluded_bones": []
1619+
"excluded_nodes": []
16481620
}
16491621
]
16501622
},
@@ -1663,7 +1635,7 @@
16631635
"blend_weight": "",
16641636
"start_delay": "",
16651637
"loop_delay": "0",
1666-
"excluded_bones": [],
1638+
"excluded_nodes": [],
16671639
"animators": {
16681640
"b5b52d2c-097c-08df-6457-372fbae12445": {
16691641
"name": "left_arm",
@@ -1719,7 +1691,7 @@
17191691
"blend_weight": "",
17201692
"start_delay": "",
17211693
"loop_delay": "",
1722-
"excluded_bones": [],
1694+
"excluded_nodes": [],
17231695
"animators": {
17241696
"b5b52d2c-097c-08df-6457-372fbae12445": {
17251697
"name": "left_arm",
@@ -1937,7 +1909,7 @@
19371909
"blend_weight": "",
19381910
"start_delay": "",
19391911
"loop_delay": "",
1940-
"excluded_bones": [],
1912+
"excluded_nodes": [],
19411913
"animators": {
19421914
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824": {
19431915
"name": "armor_stand_root",
@@ -2163,7 +2135,7 @@
21632135
"blend_weight": "",
21642136
"start_delay": "",
21652137
"loop_delay": "",
2166-
"excluded_bones": [
2138+
"excluded_nodes": [
21672139
{
21682140
"name": "baseplate_pivot_a",
21692141
"value": "4f000ffc-11d6-3a4b-7c8d-6b5ba483228c"
@@ -2491,7 +2463,7 @@
24912463
"blend_weight": "",
24922464
"start_delay": "",
24932465
"loop_delay": "",
2494-
"excluded_bones": [],
2466+
"excluded_nodes": [],
24952467
"animators": {
24962468
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824": {
24972469
"name": "armor_stand_root",
@@ -2711,7 +2683,7 @@
27112683
"blend_weight": "",
27122684
"start_delay": "",
27132685
"loop_delay": "",
2714-
"excluded_bones": [],
2686+
"excluded_nodes": [],
27152687
"animators": {
27162688
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824": {
27172689
"name": "armor_stand_root",
@@ -2931,7 +2903,7 @@
29312903
"blend_weight": "",
29322904
"start_delay": "",
29332905
"loop_delay": "",
2934-
"excluded_bones": [],
2906+
"excluded_nodes": [],
29352907
"animators": {
29362908
"49e67c2a-3d1d-792d-9c75-72ecbc0f92e0": {
29372909
"name": "body_waist_pivot",
@@ -3205,7 +3177,7 @@
32053177
"blend_weight": "",
32063178
"start_delay": "",
32073179
"loop_delay": "",
3208-
"excluded_bones": [],
3180+
"excluded_nodes": [],
32093181
"animators": {
32103182
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824": {
32113183
"name": "armor_stand_root",
@@ -3355,7 +3327,7 @@
33553327
"blend_weight": "",
33563328
"start_delay": "",
33573329
"loop_delay": "",
3358-
"excluded_bones": [],
3330+
"excluded_nodes": [],
33593331
"animators": {
33603332
"5e08acae-d6ca-0dfd-9360-8cdb13c7a824": {
33613333
"name": "armor_stand_root",
@@ -3673,7 +3645,7 @@
36733645
"blend_weight": "",
36743646
"start_delay": "",
36753647
"loop_delay": "",
3676-
"excluded_bones": [],
3648+
"excluded_nodes": [],
36773649
"animators": {
36783650
"6c53311f-ffc8-e567-ff1b-65840698e9ba": {
36793651
"name": "body",
@@ -3713,7 +3685,7 @@
37133685
"blend_weight": "",
37143686
"start_delay": "",
37153687
"loop_delay": "",
3716-
"excluded_bones": [],
3688+
"excluded_nodes": [],
37173689
"animators": {
37183690
"6c53311f-ffc8-e567-ff1b-65840698e9ba": {
37193691
"name": "body",
@@ -3836,7 +3808,7 @@
38363808
"blend_weight": "",
38373809
"start_delay": "",
38383810
"loop_delay": "",
3839-
"excluded_bones": [],
3811+
"excluded_nodes": [],
38403812
"animators": {
38413813
"effects": {
38423814
"name": "Effects",
@@ -3894,7 +3866,7 @@
38943866
"blend_weight": "",
38953867
"start_delay": "",
38963868
"loop_delay": "",
3897-
"excluded_bones": [],
3869+
"excluded_nodes": [],
38983870
"animators": {
38993871
"d0076177-a6cf-561c-08d8-efd07677b337": {
39003872
"name": "camera",

0 commit comments

Comments
 (0)