diff --git a/src/anm2/anm2.h b/src/anm2/anm2.h index b48137f..1599972 100644 --- a/src/anm2/anm2.h +++ b/src/anm2/anm2.h @@ -72,7 +72,7 @@ namespace anm2ed::anm2 Item* item_get(int, Type, int = -1); Reference layer_animation_add(Reference = {}, std::string = {}, int = 0, types::destination::Type = types::destination::ALL); - Reference null_animation_add(Reference = {}, std::string = {}, types::destination::Type = types::destination::ALL); + Reference null_animation_add(Reference = {}, std::string = {}, bool = false, types::destination::Type = types::destination::ALL); Frame* frame_get(int, Type, int, int = -1); void merge(const Anm2&, const std::filesystem::path&, const std::filesystem::path&); diff --git a/src/anm2/anm2_items.cpp b/src/anm2/anm2_items.cpp index 35a97cc..aed2f7b 100644 --- a/src/anm2/anm2_items.cpp +++ b/src/anm2/anm2_items.cpp @@ -31,7 +31,7 @@ namespace anm2ed::anm2 } Reference Anm2::layer_animation_add(Reference reference, std::string name, int spritesheetID, - destination::Type locale) + destination::Type destination) { auto id = reference.itemID == -1 ? map::next_id_get(content.layers) : reference.itemID; auto& layer = content.layers[id]; @@ -45,12 +45,12 @@ namespace anm2ed::anm2 animation->layerOrder.push_back(id); }; - if (locale == destination::ALL) + if (destination == destination::ALL) { for (auto& animation : animations.items) if (!animation.layerAnimations.contains(id)) add(&animation, id); } - else if (locale == destination::THIS) + else if (destination == destination::THIS) { if (auto animation = animation_get(reference.animationIndex)) if (!animation->layerAnimations.contains(id)) add(animation, id); @@ -59,26 +59,27 @@ namespace anm2ed::anm2 return {reference.animationIndex, LAYER, id}; } - Reference Anm2::null_animation_add(Reference reference, std::string name, destination::Type locale) + Reference Anm2::null_animation_add(Reference reference, std::string name, bool isShowRect, destination::Type destination) { auto id = reference.itemID == -1 ? map::next_id_get(content.nulls) : reference.itemID; auto& null = content.nulls[id]; null.name = !name.empty() ? name : null.name; + null.isShowRect = isShowRect; auto add = [&](Animation* animation, int id) { animation->nullAnimations[id] = Item(); }; - if (locale == destination::ALL) + if (destination == destination::ALL) { for (auto& animation : animations.items) if (!animation.nullAnimations.contains(id)) add(&animation, id); } - else if (locale == destination::THIS) + else if (destination == destination::THIS) { if (auto animation = animation_get(reference.animationIndex)) if (!animation->nullAnimations.contains(id)) add(animation, id); } - return {reference.animationIndex, LAYER, id}; + return {reference.animationIndex, NULL_, id}; } } \ No newline at end of file diff --git a/src/anm2/anm2_spritesheets.cpp b/src/anm2/anm2_spritesheets.cpp index 284733a..f0d27cc 100644 --- a/src/anm2/anm2_spritesheets.cpp +++ b/src/anm2/anm2_spritesheets.cpp @@ -39,7 +39,6 @@ namespace anm2ed::anm2 std::vector Anm2::spritesheet_labels_get() { std::vector labels{}; - labels.emplace_back(localize.get(BASIC_NONE)); for (auto& [id, spritesheet] : content.spritesheets) { auto pathString = path::to_utf8(spritesheet.path); diff --git a/src/imgui/window/layers.cpp b/src/imgui/window/layers.cpp index 4a73ac1..3a3a0e8 100644 --- a/src/imgui/window/layers.cpp +++ b/src/imgui/window/layers.cpp @@ -175,7 +175,8 @@ namespace anm2ed::imgui if (propertiesPopup.isJustOpened) ImGui::SetKeyboardFocusHere(); input_text_string(localize.get(BASIC_NAME), &layer.name); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME)); - combo_negative_one_indexed(localize.get(LABEL_SPRITESHEET), &layer.spritesheetID, document.spritesheet.labels); + + ImGui::Combo(localize.get(LABEL_SPRITESHEET), &layer.spritesheetID, document.spritesheet.labels.data(), (int)document.spritesheet.labels.size()); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_SPRITESHEET)); } ImGui::EndChild(); diff --git a/src/imgui/window/timeline.cpp b/src/imgui/window/timeline.cpp index f2121f4..4cdd1f8 100644 --- a/src/imgui/window/timeline.cpp +++ b/src/imgui/window/timeline.cpp @@ -1783,13 +1783,16 @@ namespace anm2ed::imgui { input_text_string(localize.get(BASIC_NAME), &addItemName); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_NAME)); - ImGui::BeginDisabled(type != anm2::LAYER); + if (type == anm2::LAYER) { - combo_negative_one_indexed(localize.get(LABEL_SPRITESHEET), &addItemSpritesheetID, - document.spritesheet.labels); + ImGui::Combo(localize.get(LABEL_SPRITESHEET), &addItemSpritesheetID, document.spritesheet.labels.data(), (int)document.spritesheet.labels.size()); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_LAYER_SPRITESHEET)); } - ImGui::EndDisabled(); + else if (type == anm2::NULL_) + { + ImGui::Checkbox(localize.get(LABEL_RECT), &addItemIsShowRect); + ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_NULL_RECT)); + } } ImGui::EndDisabled(); } @@ -1838,9 +1841,9 @@ namespace anm2ed::imgui document.snapshot(localize.get(EDIT_ADD_ITEM)); if (type == anm2::LAYER) addReference = anm2.layer_animation_add({reference.animationIndex, anm2::LAYER, addItemID}, addItemName, - addItemSpritesheetID - 1, (destination::Type)destination); + addItemSpritesheetID, (destination::Type)destination); else if (type == anm2::NULL_) - addReference = anm2.null_animation_add({reference.animationIndex, anm2::LAYER, addItemID}, addItemName, + addReference = anm2.null_animation_add({reference.animationIndex, anm2::NULL_, addItemID}, addItemName, addItemIsShowRect, (destination::Type)destination); document.change(Document::ITEMS); diff --git a/src/imgui/window/timeline.h b/src/imgui/window/timeline.h index 3923271..bf6c670 100644 --- a/src/imgui/window/timeline.h +++ b/src/imgui/window/timeline.h @@ -26,7 +26,7 @@ namespace anm2ed::imgui PopupHelper propertiesPopup{PopupHelper(LABEL_TIMELINE_PROPERTIES_POPUP, POPUP_NORMAL)}; PopupHelper bakePopup{PopupHelper(LABEL_TIMELINE_BAKE_POPUP, POPUP_SMALL_NO_HEIGHT)}; std::string addItemName{"New Item"}; - bool addItemIsRect{}; + bool addItemIsShowRect{}; int addItemID{-1}; int addItemSpritesheetID{-1}; int hoveredTime{}; diff --git a/src/resource/strings.h b/src/resource/strings.h index d1c5bbc..639a319 100644 --- a/src/resource/strings.h +++ b/src/resource/strings.h @@ -498,7 +498,7 @@ namespace anm2ed X(TOOLTIP_NEW_ITEM, "Create a new item.", "Crea un nuevo item.", "Создать новый предмет.", "创造一个新物品.", "새 항목을 만듭니다.") \ X(TOOLTIP_NO_UNUSED_ITEMS, "There are no unused items to use.", "No hay items sin utilizar para usar.", "Нет неиспользуемых предметов, которые использовать.", "没有可用的未使用物品.", "사용하지 않는 항목이 없습니다.") \ X(TOOLTIP_NULL_NAME, "Set the null's name.", "Ajusta el nombre del Null.", "Назвать этот нуль.", "更改Null的名字.", "Null의 이름을 설정합니다.") \ - X(TOOLTIP_NULL_RECT, "The null will have a rectangle show around it.", "Null tendra una guia de rectangulo alrededor.", "Около этого нуля будет прямоугольник.", "此Null周围会显示一个方框.", "Null의 주변에 사각형이 표시됩니다.") \ + X(TOOLTIP_NULL_RECT, "Toggle to show the null as a rectangle.", "Alterna para mostrar el null como un rectangulo.", "Переключите, чтобы показывать null как прямоугольник.", "切换以将此Null显示为方框.", "Null을 사각형으로 표시하도록 전환합니다.") \ X(TOOLTIP_NULL_RECT_HIDDEN, "The null's rectangle is hidden. Press to show it.", "La guia de rectangulo de Null esta oculta. Presiona para mostrarla.", "Прямоугольник этого нуля скрыт. Нажмите, чтобы его показать.", "此Null的方框已隐藏. 点击以显示.", "Null의 사각형이 숨겨져 있습니다. 표시하려면 누르세요.") \ X(TOOLTIP_NULL_RECT_SHOWN, "The null's rectangle is shown. Press to hide it.", "La guia de rectangulo de Null esta visible. Presiona para ocultarla.", "Прямоугольник этого нуля видим. Нажмите, чтобы его скрыть.", "此Null的方框当前可见. 点击以隐藏.", "Null의 사각형이 표시되어 있습니다. 숨기려면 누르세요.") \ X(TOOLTIP_NULL_TYPE, "Add a null item.", "Añade un item Null.", "Добавить нулевой предмет.", "添加一个Null物品.", "Null 항목을 추가합니다.") \ diff --git a/workshop/metadata.xml b/workshop/metadata.xml index 7053f32..1f811d1 100644 --- a/workshop/metadata.xml +++ b/workshop/metadata.xml @@ -40,6 +40,6 @@ Alternatively, if you have subscribed to the mod, you can find the latest releas [h3]Happy animating![/h3] [img]https://files.catbox.moe/4auc1c.gif[/img] - 2.8 + 2.9 Public