From 609d1ada8cbe00d1e7945207143343d60cfa264b Mon Sep 17 00:00:00 2001 From: Shengjie Xu Date: Sat, 28 Dec 2024 13:11:49 -0500 Subject: [PATCH] Integrate new background image assets --- .../config.yml" | 1 + .../references.yml" | 5 + .../P2-\345\256\242\345\216\205/config.yml" | 1 + .../references.yml" | 5 + .../P3-\346\225\231\345\256\244/config.yml" | 1 + .../references.yml" | 5 + .../config.yml" | 1 + .../references.yml" | 5 + .../config.yml" | 1 + .../references.yml" | 5 + .../P7-\345\205\254\345\233\255/config.yml" | 1 + .../references.yml" | 5 + .../P_config_common.yml" | 13 + .../P_references_common.yml" | 18 + ...4\346\231\232\345\205\263\347\201\257.png" | Bin ...4\346\231\232\345\274\200\347\201\257.png" | Bin .../config.yml" | 14 +- .../references.yml" | 2 +- ...4\346\231\232\345\205\263\347\201\257.png" | Bin ...4\346\231\232\345\274\200\347\201\257.png" | Bin .../config.yml" | 14 +- .../references.yml" | 2 +- ...4\346\231\232\345\205\263\347\201\257.png" | Bin ...4\346\231\232\345\274\200\347\201\257.png" | Bin .../T2-\345\256\244\345\244\226/config.yml" | 14 +- .../references.yml" | 2 +- .../T_config_common.yml" | 1 + .../T_references_common.yml" | 0 .../background/background_templates.yml | 7 - assets/imagepack/background/backgrounds.yml | 19 + assets/preppipe_asset_manifest.yml | 2 +- src/preppipe/util/imagepack.py | 404 +++++++++--------- 32 files changed, 301 insertions(+), 247 deletions(-) create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/config.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/references.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_config_common.yml" create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_references_common.yml" rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" (100%) rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" (100%) rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" (100%) rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" (100%) rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" (100%) rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" (100%) create mode 100644 "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_config_common.yml" rename "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/references_template.yml" => "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_references_common.yml" (100%) delete mode 100644 assets/imagepack/background/background_templates.yml create mode 100644 assets/imagepack/background/backgrounds.yml diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/references.yml" new file mode 100644 index 0000000..8495b6c --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P1-\345\260\217\345\215\247\345\256\244/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "BedroomSmall" + zh_cn: "小卧室" + zh_hk: "小臥室" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/references.yml" new file mode 100644 index 0000000..ea1e446 --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P2-\345\256\242\345\216\205/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "LivingRoom" + zh_cn: "客厅" + zh_hk: "客廳" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/references.yml" new file mode 100644 index 0000000..8b0b4dd --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P3-\346\225\231\345\256\244/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "Classroom" + zh_cn: "教室" + zh_hk: "教室" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/references.yml" new file mode 100644 index 0000000..f1ae299 --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P4-\345\255\246\346\240\241\350\265\260\345\273\212/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "SchoolHallway" + zh_cn: "学校走廊" + zh_hk: "學校走廊" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/references.yml" new file mode 100644 index 0000000..68441ee --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P6-\345\215\225\344\275\215\345\244\247\351\227\250/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "OrganizationGate" + zh_cn: "单位大门" + zh_hk: "單位大門" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/config.yml" new file mode 100644 index 0000000..03d603a --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/config.yml" @@ -0,0 +1 @@ +include: "../P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/references.yml" new file mode 100644 index 0000000..97cd08e --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P7-\345\205\254\345\233\255/references.yml" @@ -0,0 +1,5 @@ +include: "../P_references_common.yml" +reference: + en: "Park" + zh_cn: "公园" + zh_hk: "公園" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_config_common.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_config_common.yml" new file mode 100644 index 0000000..70fcfc4 --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_config_common.yml" @@ -0,0 +1,13 @@ +图层: + L0-白天: + 特殊标记: "基底" + L1-傍晚: + 特殊标记: "基底" + L2-夜晚关灯: + 特殊标记: "基底" + L3-夜晚开灯: + 特殊标记: "基底" +元数据: + author: "考拉Koala" + license: "cc0" + overview_scale: 0.125 diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_references_common.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_references_common.yml" new file mode 100644 index 0000000..debe662 --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/P_references_common.yml" @@ -0,0 +1,18 @@ +kind: BACKGROUND +composites: + L0: + en: "Daytime" + zh_cn: "白天" + zh_hk: "白天" + L1: + en: "Evening" + zh_cn: "傍晚" + zh_hk: "傍晚" + L2: + en: "Night-LightsOff" + zh_cn: "夜晚-关灯" + zh_hk: "夜晚-關燈" + L3: + en: "Night-LightsOn" + zh_cn: "夜晚-开灯" + zh_hk: "夜晚-開燈" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/config.yml" index 6b871b3..5a6eb6e 100755 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/config.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/config.yml" @@ -1,12 +1,4 @@ -图层: - L0-白天: - 特殊标记: "基底" - L1-傍晚: - 特殊标记: "基底" - L2-夜晚_关灯: - 特殊标记: "基底" - L3-夜晚_开灯: - 特殊标记: "基底" +include: "../T_config_common.yml" 选区: M0-屏幕: 基础颜色: "#ffeddf" @@ -17,7 +9,3 @@ 右下: [3489,1680] M1-地毯: 基础颜色: "#fff2d2" -元数据: - author: "考拉Koala" - license: "cc0" - overview_scale: 0.125 diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/references.yml" index 54fb873..0dd852a 100644 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/references.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T0-\345\260\217\345\236\213\345\256\244\345\206\205/references.yml" @@ -1,4 +1,4 @@ -include: "../references_template.yml" +include: "../T_references_common.yml" reference: en: "Interior-Private" zh_cn: "小型室内" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/config.yml" index d9c232c..cefdbfe 100755 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/config.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/config.yml" @@ -1,12 +1,4 @@ -图层: - L0-白天: - 特殊标记: "基底" - L1-傍晚: - 特殊标记: "基底" - L2-夜晚_关灯: - 特殊标记: "基底" - L3-夜晚_开灯: - 特殊标记: "基底" +include: "../T_config_common.yml" 选区: M0-屏幕: 基础颜色: "#fff0db" @@ -17,7 +9,3 @@ 右下: [3590,2028] M1-背景: 基础颜色: "#edc7ac" -元数据: - author: "考拉Koala" - license: "cc0" - overview_scale: 0.125 diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/references.yml" index 5e714c2..a06245e 100644 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/references.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T1-\345\244\247\345\236\213\345\256\244\345\206\205/references.yml" @@ -1,4 +1,4 @@ -include: "../references_template.yml" +include: "../T_references_common.yml" reference: en: "Interior-Public" zh_cn: "大型室内" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232_\345\205\263\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L2-\345\244\234\346\231\232\345\205\263\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232_\345\274\200\347\201\257.png" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/L3-\345\244\234\346\231\232\345\274\200\347\201\257.png" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/config.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/config.yml" index ad147db..9c26005 100755 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/config.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/config.yml" @@ -1,12 +1,4 @@ -图层: - L0-白天: - 特殊标记: "基底" - L1-傍晚: - 特殊标记: "基底" - L2-夜晚_关灯: - 特殊标记: "基底" - L3-夜晚_开灯: - 特殊标记: "基底" +include: "../T_config_common.yml" 选区: M0-屏幕: 基础颜色: "#9dbfe6" @@ -17,7 +9,3 @@ 右下: [3528,1891] M1-底座: 基础颜色: "#9396a4" -元数据: - author: "考拉Koala" - license: "cc0" - overview_scale: 0.125 diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/references.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/references.yml" index cd298a0..6967306 100644 --- "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/references.yml" +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T2-\345\256\244\345\244\226/references.yml" @@ -1,4 +1,4 @@ -include: "../references_template.yml" +include: "../T_references_common.yml" reference: en: "Exterior" zh_cn: "室外" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_config_common.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_config_common.yml" new file mode 100644 index 0000000..7a79029 --- /dev/null +++ "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_config_common.yml" @@ -0,0 +1 @@ +include: "./P_config_common.yml" diff --git "a/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/references_template.yml" "b/assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_references_common.yml" similarity index 100% rename from "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/references_template.yml" rename to "assets/imagepack/background/A0-\350\200\203\346\213\211Koala/T_references_common.yml" diff --git a/assets/imagepack/background/background_templates.yml b/assets/imagepack/background/background_templates.yml deleted file mode 100644 index dd3022e..0000000 --- a/assets/imagepack/background/background_templates.yml +++ /dev/null @@ -1,7 +0,0 @@ -imagepack: - Koala-interior-private: - yamlpath: "{srcpath}/A0-考拉Koala/T0-小型室内/config.yml" - Koala-interior-public: - yamlpath: "{srcpath}/A0-考拉Koala/T1-大型室内/config.yml" - Koala-exterior: - yamlpath: "{srcpath}/A0-考拉Koala/T2-室外/config.yml" diff --git a/assets/imagepack/background/backgrounds.yml b/assets/imagepack/background/backgrounds.yml new file mode 100644 index 0000000..2501155 --- /dev/null +++ b/assets/imagepack/background/backgrounds.yml @@ -0,0 +1,19 @@ +imagepack: + A0P1: + yamlpath: "{srcpath}/A0-考拉Koala/P1-小卧室/config.yml" + A0P2: + yamlpath: "{srcpath}/A0-考拉Koala/P2-客厅/config.yml" + A0P3: + yamlpath: "{srcpath}/A0-考拉Koala/P3-教室/config.yml" + A0P4: + yamlpath: "{srcpath}/A0-考拉Koala/P4-学校走廊/config.yml" + A0P6: + yamlpath: "{srcpath}/A0-考拉Koala/P6-单位大门/config.yml" + A0P7: + yamlpath: "{srcpath}/A0-考拉Koala/P7-公园/config.yml" + A0T0: + yamlpath: "{srcpath}/A0-考拉Koala/T0-小型室内/config.yml" + A0T1: + yamlpath: "{srcpath}/A0-考拉Koala/T1-大型室内/config.yml" + A0T2: + yamlpath: "{srcpath}/A0-考拉Koala/T2-室外/config.yml" diff --git a/assets/preppipe_asset_manifest.yml b/assets/preppipe_asset_manifest.yml index 2f4e4e9..ed0061f 100644 --- a/assets/preppipe_asset_manifest.yml +++ b/assets/preppipe_asset_manifest.yml @@ -1,4 +1,4 @@ subdirs: - - imagepack/background/background_templates.yml + - imagepack/background/backgrounds.yml - thirdparty/thirdparty.yml - gui/gui.yml diff --git a/src/preppipe/util/imagepack.py b/src/preppipe/util/imagepack.py index 934f569..5e5e397 100644 --- a/src/preppipe/util/imagepack.py +++ b/src/preppipe/util/imagepack.py @@ -1057,189 +1057,221 @@ def convert_mask_image(mask : PIL.Image.Image) -> PIL.Image.Image: ra = np.uint8(maxchannel > 0) * 255 return PIL.Image.fromarray(ra, "L").convert("1", dither=PIL.Image.Dither.NONE) + @staticmethod + def load_yaml(yamlpath : str) -> dict[str, typing.Any]: + # 除了读取 yaml 之外,我们还把一些共通的特性(比如 include)给实现了 + def read_yaml_dict(yamlpath : str) -> dict: + with open(yamlpath, "r", encoding="utf-8") as f: + result = yaml.safe_load(f) + if not isinstance(result, dict): + raise PPInternalError("Invalid yaml config: " + yamlpath) + return result + def handle_include_resursive(include_path : str, cur_path : str) -> dict[str, typing.Any]: + if not os.path.isabs(include_path): + include_path = os.path.join(os.path.dirname(cur_path), include_path) + if not os.path.exists(include_path): + raise PPInternalError("Cannot find included file: " + include_path) + result = read_yaml_dict(include_path) + if "include" in result: + next_include_path = result["include"] + child = handle_include_resursive(next_include_path, include_path) + child.update(result) + result = child + return result + result = {} + if os.path.exists(yamlpath): + result = read_yaml_dict(yamlpath) + if "include" in result: + child = handle_include_resursive(result["include"], yamlpath) + child.update(result) + result = child + # 为了避免检查是否有未用到的字段时因为 include 而出错,我们在这把 include 字段去掉 + if "include" in result: + del result["include"] + return result + @staticmethod def build_image_pack_from_yaml(yamlpath : str): basepath = os.path.dirname(os.path.abspath(yamlpath)) - with open(yamlpath, "r", encoding="utf-8") as f: - yamlobj = yaml.safe_load(f) - result = ImagePack(0, 0) - layers = None - masks = None - composites = None - metadata = None - generation = None - for k in yamlobj.keys(): - if k in ImagePack.TR_imagepack_yamlparse_layers.get_all_candidates(): - layers = yamlobj[k] - elif k in ImagePack.TR_imagepack_yamlparse_masks.get_all_candidates(): - masks = yamlobj[k] - elif k in ImagePack.TR_imagepack_yamlparse_composites.get_all_candidates(): - composites = yamlobj[k] - elif k in ImagePack.TR_imagepack_yamlparse_metadata.get_all_candidates(): - metadata = yamlobj[k] - elif k in ImagePack.TR_imagepack_yamlparse_generation.get_all_candidates(): - generation = yamlobj[k] + yamlobj = ImagePack.load_yaml(yamlpath) + result = ImagePack(0, 0) + layers = None + masks = None + composites = None + metadata = None + generation = None + for k in yamlobj.keys(): + if k in ImagePack.TR_imagepack_yamlparse_layers.get_all_candidates(): + layers = yamlobj[k] + elif k in ImagePack.TR_imagepack_yamlparse_masks.get_all_candidates(): + masks = yamlobj[k] + elif k in ImagePack.TR_imagepack_yamlparse_composites.get_all_candidates(): + composites = yamlobj[k] + elif k in ImagePack.TR_imagepack_yamlparse_metadata.get_all_candidates(): + metadata = yamlobj[k] + elif k in ImagePack.TR_imagepack_yamlparse_generation.get_all_candidates(): + generation = yamlobj[k] + else: + raise PPInternalError("Unknown key: " + k + "(supported keys: " + + str(ImagePack.TR_imagepack_yamlparse_layers.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_masks.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_composites.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_metadata.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_generation.get_all_candidates()) + + ")") + if generation is not None: + layers, masks, composites, metadata = ImagePack.handle_yaml_generation(generation, layers, masks, composites, metadata) + if layers is None: + raise PPInternalError("No layers in " + yamlpath) + layer_dict : dict[str, int] = {} + for imgpathbase, d in layers.items(): + imgpath = imgpathbase + ".png" + layerindex = len(result.layers) + layer_dict[imgpathbase] = layerindex + flag_base = False + flag_toggle = False + def add_flag(flag : str): + nonlocal flag_base + nonlocal flag_toggle + if not isinstance(flag, str): + raise PPInternalError("Invalid flag in " + yamlpath + ": " + str(flag)) + if flag in ImagePack.TR_imagepack_yamlparse_base.get_all_candidates(): + flag_base = True + elif flag in ImagePack.TR_imagepack_yamlparse_toggle.get_all_candidates(): + flag_toggle = True else: - raise PPInternalError("Unknown key: " + k + "(supported keys: " - + str(ImagePack.TR_imagepack_yamlparse_layers.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_masks.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_composites.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_metadata.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_generation.get_all_candidates()) - + ")") - if generation is not None: - layers, masks, composites, metadata = ImagePack.handle_yaml_generation(generation, layers, masks, composites, metadata) - if layers is None: - raise PPInternalError("No layers in " + yamlpath) - layer_dict : dict[str, int] = {} - for imgpathbase, d in layers.items(): - imgpath = imgpathbase + ".png" - layerindex = len(result.layers) - layer_dict[imgpathbase] = layerindex - flag_base = False - flag_toggle = False - def add_flag(flag : str): - nonlocal flag_base - nonlocal flag_toggle - if not isinstance(flag, str): - raise PPInternalError("Invalid flag in " + yamlpath + ": " + str(flag)) - if flag in ImagePack.TR_imagepack_yamlparse_base.get_all_candidates(): - flag_base = True - elif flag in ImagePack.TR_imagepack_yamlparse_toggle.get_all_candidates(): - flag_toggle = True + raise PPInternalError("Unknown flag: " + flag + "(supported flags: " + + str(ImagePack.TR_imagepack_yamlparse_base.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_toggle.get_all_candidates()) + ")") + if isinstance(d, dict): + for key, value in d.items(): + if key in ImagePack.TR_imagepack_yamlparse_flags.get_all_candidates(): + if isinstance(value, str): + add_flag(value) + elif isinstance(value, list): + for flag in value: + add_flag(flag) + if not os.path.exists(os.path.join(basepath, imgpath)): + raise PPInternalError("Image file not found: " + imgpath) + patch = ImageWrapper.create_untrusted(os.path.join(basepath, imgpath)) + img = patch.get() + if result.width == 0 and result.height == 0: + result.width = img.width + result.height = img.height + if img.width != result.width or img.height != result.height: + raise PPInternalError("Image size mismatch: " + str((img.width, img.height)) + " != " + str((result.width, result.height))) + # 尝试缩小图片本体,如果有大片空白的话只截取有内容的部分 + offset_x = 0 + offset_y = 0 + bbox = img.getbbox() + if bbox is not None: + offset_x, offset_y, xmax, ymax = bbox + if offset_x != 0 or offset_y != 0 or xmax != img.width or ymax != img.height: + img = img.crop(bbox) + patch = ImageWrapper(image=img) + newlayer = ImagePack.LayerInfo(patch, + offset_x=offset_x, offset_y=offset_y, + width=img.width, height=img.height, + base=flag_base, toggle=flag_toggle, basename=imgpathbase) + result.layers.append(newlayer) + if composites is None: + for i, layer in enumerate(result.layers): + result.composites.append(ImagePack.CompositeInfo([i], layer.basename)) + else: + for stack_name, stack_list in composites.items(): + stack = [] + if stack_list is None: + stack.append(layer_dict[stack_name]) + elif isinstance(stack_list, list): + stack = [layer_dict[s] for s in stack_list] + result.composites.append(ImagePack.CompositeInfo(stack, stack_name)) + + if masks is not None: + for imgpathbase, maskinfo in masks.items(): + applyon : list[int] | None = None + maskcolor : Color | None = None + projective_vertices_result : tuple[tuple[int,int],tuple[int,int],tuple[int,int],tuple[int,int]] | None = None + if not isinstance(maskinfo, dict): + raise PPInternalError("Invalid mask in " + yamlpath + ": expecting a dict but got " + str(maskinfo)) + for key, value in maskinfo.items(): + if key in ImagePack.TR_imagepack_yamlparse_maskcolor.get_all_candidates(): + maskcolor = Color.get(value) + elif key in ImagePack.TR_imagepack_yamlparse_applyon.get_all_candidates(): + applyon = [] + if isinstance(value, str): + applyon.append(layer_dict[value]) + elif isinstance(value, list): + for entry in value: + applyon.append(layer_dict[entry]) + else: + raise PPInternalError("Invalid applyon in " + yamlpath + ": expecting a list or str but got " + str(value)) + if len(applyon) == 0: + applyon = None + elif key in ImagePack.TR_imagepack_yamlparse_projective.get_all_candidates(): + if not isinstance(value, dict): + raise PPInternalError("Invalid projective in " + yamlpath + ": expecting a dict but got " + str(value)) + topleft : tuple[int, int] | None = None + topright : tuple[int, int] | None = None + bottomleft : tuple[int, int] | None = None + bottomright : tuple[int, int] | None = None + def read_2int_tuple(v) -> tuple[int, int]: + if not isinstance(v, list) or len(v) != 2: + raise PPInternalError("Invalid projective vertex in " + yamlpath + ": expecting a list of 2 but got " + str(v)) + x, y = v + if not isinstance(x, int) or not isinstance(y, int): + raise PPInternalError("Invalid projective vertex in " + yamlpath + ": expecting a list of 2 int but got " + str(v)) + return (x, y) + for k, v in value.items(): + if k in ImagePack.TR_imagepack_yamlparse_topleft.get_all_candidates(): + topleft = read_2int_tuple(v) + elif k in ImagePack.TR_imagepack_yamlparse_topright.get_all_candidates(): + topright = read_2int_tuple(v) + elif k in ImagePack.TR_imagepack_yamlparse_bottomleft.get_all_candidates(): + bottomleft = read_2int_tuple(v) + elif k in ImagePack.TR_imagepack_yamlparse_bottomright.get_all_candidates(): + bottomright = read_2int_tuple(v) + else: + raise PPInternalError("Invalid projective in " + yamlpath + ": unknown key " + k + "(supported keys: " + + str(ImagePack.TR_imagepack_yamlparse_topleft.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_topright.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_bottomleft.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_bottomright.get_all_candidates()) + ")") + if topleft is None or topright is None or bottomleft is None or bottomright is None: + raise PPInternalError("Invalid projective in " + yamlpath + ": missing values") + projective_vertices_result = (topleft, topright, bottomleft, bottomright) else: - raise PPInternalError("Unknown flag: " + flag + "(supported flags: " - + str(ImagePack.TR_imagepack_yamlparse_base.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_toggle.get_all_candidates()) + ")") - if isinstance(d, dict): - for key, value in d.items(): - if key in ImagePack.TR_imagepack_yamlparse_flags.get_all_candidates(): - if isinstance(value, str): - add_flag(value) - elif isinstance(value, list): - for flag in value: - add_flag(flag) - if not os.path.exists(os.path.join(basepath, imgpath)): - raise PPInternalError("Image file not found: " + imgpath) - patch = ImageWrapper.create_untrusted(os.path.join(basepath, imgpath)) - img = patch.get() - if result.width == 0 and result.height == 0: - result.width = img.width - result.height = img.height - if img.width != result.width or img.height != result.height: - raise PPInternalError("Image size mismatch: " + str((img.width, img.height)) + " != " + str((result.width, result.height))) - # 尝试缩小图片本体,如果有大片空白的话只截取有内容的部分 + raise PPInternalError("Unknown key: " + key + "(supported keys: " + + str(ImagePack.TR_imagepack_yamlparse_maskcolor.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_applyon.get_all_candidates()) + ", " + + str(ImagePack.TR_imagepack_yamlparse_projective.get_all_candidates()) + ")") + if maskcolor is None: + raise PPInternalError("Invalid mask in " + yamlpath + ": missing maskcolor") + maskimgpath = os.path.join(basepath, imgpathbase + ".png") + # 读取选区图并将其转化为黑白图片 + original_mask = PIL.Image.open(maskimgpath) + maskimg = ImagePack.convert_mask_image(original_mask) + if maskimg.width != result.width or maskimg.height != result.height: + raise PPInternalError("Mask size mismatch: " + str((maskimg.width, maskimg.height)) + " != " + str((result.width, result.height))) offset_x = 0 offset_y = 0 - bbox = img.getbbox() + bbox = maskimg.getbbox() if bbox is not None: offset_x, offset_y, xmax, ymax = bbox - if offset_x != 0 or offset_y != 0 or xmax != img.width or ymax != img.height: - img = img.crop(bbox) - patch = ImageWrapper(image=img) - newlayer = ImagePack.LayerInfo(patch, - offset_x=offset_x, offset_y=offset_y, - width=img.width, height=img.height, - base=flag_base, toggle=flag_toggle, basename=imgpathbase) - result.layers.append(newlayer) - if composites is None: - for i, layer in enumerate(result.layers): - result.composites.append(ImagePack.CompositeInfo([i], layer.basename)) - else: - for stack_name, stack_list in composites.items(): - stack = [] - if stack_list is None: - stack.append(layer_dict[stack_name]) - elif isinstance(stack_list, list): - stack = [layer_dict[s] for s in stack_list] - result.composites.append(ImagePack.CompositeInfo(stack, stack_name)) - - if masks is not None: - for imgpathbase, maskinfo in masks.items(): - applyon : list[int] | None = None - maskcolor : Color | None = None - projective_vertices_result : tuple[tuple[int,int],tuple[int,int],tuple[int,int],tuple[int,int]] | None = None - if not isinstance(maskinfo, dict): - raise PPInternalError("Invalid mask in " + yamlpath + ": expecting a dict but got " + str(maskinfo)) - for key, value in maskinfo.items(): - if key in ImagePack.TR_imagepack_yamlparse_maskcolor.get_all_candidates(): - maskcolor = Color.get(value) - elif key in ImagePack.TR_imagepack_yamlparse_applyon.get_all_candidates(): - applyon = [] - if isinstance(value, str): - applyon.append(layer_dict[value]) - elif isinstance(value, list): - for entry in value: - applyon.append(layer_dict[entry]) - else: - raise PPInternalError("Invalid applyon in " + yamlpath + ": expecting a list or str but got " + str(value)) - if len(applyon) == 0: - applyon = None - elif key in ImagePack.TR_imagepack_yamlparse_projective.get_all_candidates(): - if not isinstance(value, dict): - raise PPInternalError("Invalid projective in " + yamlpath + ": expecting a dict but got " + str(value)) - topleft : tuple[int, int] | None = None - topright : tuple[int, int] | None = None - bottomleft : tuple[int, int] | None = None - bottomright : tuple[int, int] | None = None - def read_2int_tuple(v) -> tuple[int, int]: - if not isinstance(v, list) or len(v) != 2: - raise PPInternalError("Invalid projective vertex in " + yamlpath + ": expecting a list of 2 but got " + str(v)) - x, y = v - if not isinstance(x, int) or not isinstance(y, int): - raise PPInternalError("Invalid projective vertex in " + yamlpath + ": expecting a list of 2 int but got " + str(v)) - return (x, y) - for k, v in value.items(): - if k in ImagePack.TR_imagepack_yamlparse_topleft.get_all_candidates(): - topleft = read_2int_tuple(v) - elif k in ImagePack.TR_imagepack_yamlparse_topright.get_all_candidates(): - topright = read_2int_tuple(v) - elif k in ImagePack.TR_imagepack_yamlparse_bottomleft.get_all_candidates(): - bottomleft = read_2int_tuple(v) - elif k in ImagePack.TR_imagepack_yamlparse_bottomright.get_all_candidates(): - bottomright = read_2int_tuple(v) - else: - raise PPInternalError("Invalid projective in " + yamlpath + ": unknown key " + k + "(supported keys: " - + str(ImagePack.TR_imagepack_yamlparse_topleft.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_topright.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_bottomleft.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_bottomright.get_all_candidates()) + ")") - if topleft is None or topright is None or bottomleft is None or bottomright is None: - raise PPInternalError("Invalid projective in " + yamlpath + ": missing values") - projective_vertices_result = (topleft, topright, bottomleft, bottomright) - else: - raise PPInternalError("Unknown key: " + key + "(supported keys: " - + str(ImagePack.TR_imagepack_yamlparse_maskcolor.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_applyon.get_all_candidates()) + ", " - + str(ImagePack.TR_imagepack_yamlparse_projective.get_all_candidates()) + ")") - if maskcolor is None: - raise PPInternalError("Invalid mask in " + yamlpath + ": missing maskcolor") - maskimgpath = os.path.join(basepath, imgpathbase + ".png") - # 读取选区图并将其转化为黑白图片 - original_mask = PIL.Image.open(maskimgpath) - maskimg = ImagePack.convert_mask_image(original_mask) - if maskimg.width != result.width or maskimg.height != result.height: - raise PPInternalError("Mask size mismatch: " + str((maskimg.width, maskimg.height)) + " != " + str((result.width, result.height))) - offset_x = 0 - offset_y = 0 - bbox = maskimg.getbbox() - if bbox is not None: - offset_x, offset_y, xmax, ymax = bbox - maskimg = maskimg.crop(bbox) - newmask = ImagePack.MaskInfo(mask=ImageWrapper(image=maskimg), - mask_color=maskcolor, - offset_x=offset_x, offset_y=offset_y, - width=maskimg.width, height=maskimg.height, - projective_vertices=projective_vertices_result, basename=imgpathbase, applyon=applyon) - result.masks.append(newmask) - - if metadata is not None: - if not isinstance(metadata, dict): - raise PPInternalError("Invalid metadata in " + yamlpath + ": expecting a dict but got " + str(metadata)) - result.opaque_metadata.update(metadata) - - result.optimize_masks() - return result + maskimg = maskimg.crop(bbox) + newmask = ImagePack.MaskInfo(mask=ImageWrapper(image=maskimg), + mask_color=maskcolor, + offset_x=offset_x, offset_y=offset_y, + width=maskimg.width, height=maskimg.height, + projective_vertices=projective_vertices_result, basename=imgpathbase, applyon=applyon) + result.masks.append(newmask) + + if metadata is not None: + if not isinstance(metadata, dict): + raise PPInternalError("Invalid metadata in " + yamlpath + ": expecting a dict but got " + str(metadata)) + result.opaque_metadata.update(metadata) + + result.optimize_masks() + return result TR_imagepack_yamlgen_parts = TR_imagepack.tr("parts", en="parts", @@ -2606,29 +2638,7 @@ def get_code_from_composite_name(name : str) -> str: self.bbox = (xmin, ymin, xmax, ymax) # 默认的初始化完毕,开始读取 references.yml - def handle_include_resursive(include_path : str, cur_path : str) -> dict[str, typing.Any]: - if not os.path.isabs(include_path): - include_path = os.path.join(os.path.dirname(cur_path), include_path) - if not os.path.exists(include_path): - raise PPInternalError("Cannot find included file: " + include_path) - with open(include_path, "r", encoding="utf-8") as f: - result = yaml.safe_load(f) - if "include" in result: - next_include_path = result["include"] - child = handle_include_resursive(next_include_path, include_path) - child.update(result) - result = child - return result - references = {} - if os.path.exists(references_path): - with open(references_path, "r", encoding="utf-8") as f: - references = yaml.safe_load(f) - if not isinstance(references, dict): - raise PPInternalError("Invalid references file: " + references_path) - if "include" in references: - child = handle_include_resursive(references["include"], references_path) - child.update(references) - references = child + references = ImagePack.load_yaml(references_path) if len(references) == 0: return # 为检查是否有没用上的项