Skip to content

Commit

Permalink
Add translation field to shine editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Amethyst-szs committed Jan 20, 2025
1 parent f76236e commit 0318877
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 15 deletions.
4 changes: 3 additions & 1 deletion MoonFlow/docs/kingdoms/moon_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ The quest field allows you to select which Quest ID this moon is connected to. E
This bitfield allows you to set which scenario IDs the Power Moon is collectable in. Note that this is based on the home stage's current scenario progression, *not* the current stage and scenario you happen to be in (ex. Koopa Freerunning). Any moons only collectable in higher scenarios than your progression will be hidden from the moon list. Highly recommended to make sure this matches your stage files.

### Translation
Position of the Shine object in 3D space. Position can be copied from EditorCore, in-game, or any other interface that uses real coordinates. This does *not* include Moonlight/Spotlight due to using fake simplified coordinates.
Position of the Shine object in 3D space. Position can be copied from EditorCore, in-game, or any other interface that uses real coordinates. This does *not* include Moonlight/Spotlight due to using fake simplified coordinates.

This position is only used for rendering the icon on the kingdom's map screen, in respect to the world's projection matrix.
Binary file modified MoonFlow/lang/en.mo
Binary file not shown.
22 changes: 15 additions & 7 deletions MoonFlow/lang/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,10 @@ msgstr "Scenario Info:"
msgid "WORLD_EDITOR_TAB_STAGE"
msgstr "Stages"

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE"
msgstr "Moons"

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_INVALID_NEW_STAGE_NAME_ERROR"
msgstr "Name already claimed by:"
Expand All @@ -1456,10 +1460,6 @@ msgstr "Select stage type"
msgid "WORLD_EDITOR_ADD_NEW_STAGE_SUBMIT"
msgstr "Submit"

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE"
msgstr "Moons"

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE_CREATE_NEW_TOOLTIP"
msgstr "Append a new Power Moon to the end of the list"
Expand Down Expand Up @@ -2999,6 +2999,17 @@ msgstr "Which scenarios can this Power Moon collected in?"
msgid "WORLD_EDITOR_SHINE_EDITOR_SCENARIO_BIT_FLAGS_HEADER"
msgstr "Valid Scenarios:"

#: scene/editor/world/shine/world_shine_editor.tscn
msgid "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES_TOOLTIP"
msgstr ""
"Where in the world is this moon located? This value is\n"
"only used to render the moon's icon on the kingdom map,\n"
"in respect to the world projection matrix."

#: scene/editor/world/shine/world_shine_editor.tscn
msgid "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES"
msgstr "Map Position:"

#: addons/podb/input_map.tres
msgctxt "INPUT_MAP"
msgid "ui_add_tag"
Expand Down Expand Up @@ -3553,9 +3564,6 @@ msgstr ""
#~ msgid "PLACEHOLDER"
#~ msgstr "Placeholder stuff :)"

#~ msgid "WORLD_EDITOR_SHINE_EDITOR_MAIN_SCENARIO_HEADER"
#~ msgstr "Story Scenario:"

#~ msgid "HOME_TAB_OPEN_FILE_TOOLTIP"
#~ msgstr "Open File"

Expand Down
16 changes: 12 additions & 4 deletions MoonFlow/lang/lang.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,10 @@ msgstr ""
msgid "WORLD_EDITOR_TAB_STAGE"
msgstr ""

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE"
msgstr ""

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_INVALID_NEW_STAGE_NAME_ERROR"
msgstr ""
Expand All @@ -1507,10 +1511,6 @@ msgstr ""
msgid "WORLD_EDITOR_ADD_NEW_STAGE_SUBMIT"
msgstr ""

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE"
msgstr ""

#: scene/editor/world/world_editor_app.tscn
msgid "WORLD_EDITOR_TAB_SHINE_CREATE_NEW_TOOLTIP"
msgstr ""
Expand Down Expand Up @@ -2974,6 +2974,14 @@ msgstr ""
msgid "WORLD_EDITOR_SHINE_EDITOR_SCENARIO_BIT_FLAGS_HEADER"
msgstr ""

#: scene/editor/world/shine/world_shine_editor.tscn
msgid "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES_TOOLTIP"
msgstr ""

#: scene/editor/world/shine/world_shine_editor.tscn
msgid "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES"
msgstr ""

#: addons/podb/input_map.tres
msgctxt "INPUT_MAP"
msgid "ui_add_tag"
Expand Down
27 changes: 27 additions & 0 deletions MoonFlow/scene/editor/world/shine/WorldShineEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public partial class WorldShineEditor : MarginContainer
[Export]
private VBoxContainer ScenarioBitFlags;

[Export]
private SpinBox SpinTranslationX;
[Export]
private SpinBox SpinTranslationY;
[Export]
private SpinBox SpinTranslationZ;

[Signal]
public delegate void ContentModifiedEventHandler();

Expand All @@ -63,6 +70,10 @@ public void InitEditor(WorldInfo world, ShineInfo shine)
BitFlagButtonHolder.SetPrimaryBit(QuestBitFlags, shine.MainScenarioNo);
BitFlagButtonHolder.ConnectPrimaryBitChanged(QuestBitFlags,
new Action<int>(OnQuestIdModified));

SpinTranslationX.SetValueNoSignal(Shine.Trans.X);
SpinTranslationY.SetValueNoSignal(Shine.Trans.Y);
SpinTranslationZ.SetValueNoSignal(Shine.Trans.Z);
}

#region Signals
Expand Down Expand Up @@ -143,6 +154,22 @@ private void OnQuestIdModified(int idx)
EmitSignal(SignalName.ContentModified);
}

private void OnTranslationXModified(float value)
{
Shine.Trans.X = value;
EmitSignal(SignalName.ContentModified);
}
private void OnTranslationYModified(float value)
{
Shine.Trans.Y = value;
EmitSignal(SignalName.ContentModified);
}
private void OnTranslationZModified(float value)
{
Shine.Trans.Z = value;
EmitSignal(SignalName.ContentModified);
}

#endregion

#region Utilities
Expand Down
5 changes: 3 additions & 2 deletions MoonFlow/scene/editor/world/shine/WorldShineEditorHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ private void OnDeleteShine()

private void OnVisibilityChanged()
{
var stageMessage = ProjectManager.GetMSBTArchives()?.StageMessage
?? throw new NullReferenceException("Could not get StageMessage!");
var stageMessage = ProjectManager.GetMSBTArchives()?.StageMessage;
if (stageMessage == null)
return;

var display = Shine.LookupDisplayName(stageMessage);
UpdateDisplayName(display?.GetRawText());
Expand Down
73 changes: 72 additions & 1 deletion MoonFlow/scene/editor/world/shine/world_shine_editor.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[ext_resource type="Texture2D" uid="uid://2g01fvaywdt" path="res://asset/nindot/lms/icon/PictureFont_31.png" id="11_8gd1o"]
[ext_resource type="Texture2D" uid="uid://y2to817674x2" path="res://asset/nindot/lms/icon/PictureFont_4A.png" id="11_afu5f"]

[node name="WorldShineEditor" type="MarginContainer" node_paths=PackedStringArray("OptionStageName", "LineObjId", "SpinUID", "SpinHint", "TextureUIDWarning", "TextureHintWarning", "ButtonTypeGrand", "ButtonTypeMoonRock", "ButtonTypeAchievement", "QuestBitFlags", "ScenarioBitFlags")]
[node name="WorldShineEditor" type="MarginContainer" node_paths=PackedStringArray("OptionStageName", "LineObjId", "SpinUID", "SpinHint", "TextureUIDWarning", "TextureHintWarning", "ButtonTypeGrand", "ButtonTypeMoonRock", "ButtonTypeAchievement", "QuestBitFlags", "ScenarioBitFlags", "SpinTranslationX", "SpinTranslationY", "SpinTranslationZ")]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 121.0
Expand All @@ -37,6 +37,9 @@ ButtonTypeMoonRock = NodePath("Content/Grid_UniqueHintType/HBox_Type/Check_Rock"
ButtonTypeAchievement = NodePath("Content/Grid_UniqueHintType/HBox_Type/Check_Achievement")
QuestBitFlags = NodePath("Content/Grid_QuestScenario/QuestBitFlags")
ScenarioBitFlags = NodePath("Content/Grid_QuestScenario/ScenarioBitFlags")
SpinTranslationX = NodePath("Content/VBox_Trans/HBox_Values/Spin_X")
SpinTranslationY = NodePath("Content/VBox_Trans/HBox_Values/Spin_Y")
SpinTranslationZ = NodePath("Content/VBox_Trans/HBox_Values/Spin_Z")

[node name="Content" type="VBoxContainer" parent="."]
layout_mode = 2
Expand Down Expand Up @@ -289,6 +292,71 @@ layout_mode = 2
theme_override_constants/separation = 6
theme_override_styles/separator = ExtResource("6_diffx")

[node name="VBox_Trans" type="VBoxContainer" parent="Content"]
layout_mode = 2

[node name="Label_TransHead" type="Label" parent="Content/VBox_Trans"]
layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES_TOOLTIP"
mouse_filter = 1
mouse_default_cursor_shape = 16
text = "WORLD_EDITOR_SHINE_EDITOR_TRANSLATION_VALUES"
horizontal_alignment = 1
text_overrun_behavior = 3

[node name="HBox_Values" type="HBoxContainer" parent="Content/VBox_Trans"]
layout_mode = 2

[node name="Spin_X" type="SpinBox" parent="Content/VBox_Trans/HBox_Values"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
min_value = -1e+06
max_value = 1e+06
step = 0.1
allow_greater = true
allow_lesser = true
alignment = 1
update_on_text_changed = true
suffix = "X"
custom_arrow_step = 100.0

[node name="Spin_Y" type="SpinBox" parent="Content/VBox_Trans/HBox_Values"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
min_value = -1e+06
max_value = 1e+06
step = 0.1
value = 5.82077e-05
allow_greater = true
allow_lesser = true
alignment = 1
update_on_text_changed = true
suffix = "Y"
custom_arrow_step = 100.0

[node name="Spin_Z" type="SpinBox" parent="Content/VBox_Trans/HBox_Values"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
min_value = -1e+06
max_value = 1e+06
step = 0.1
value = 5.82077e-05
allow_greater = true
allow_lesser = true
alignment = 1
update_on_text_changed = true
suffix = "Z"
custom_arrow_step = 100.0

[node name="HSep_Spacer4" type="HSeparator" parent="Content"]
layout_mode = 2
theme_override_constants/separation = 6
theme_override_styles/separator = ExtResource("6_diffx")

[connection signal="StageSelected" from="Content/Grid_NameId/Option_StageName" to="." method="OnShineStageNameChanged"]
[connection signal="text_validated" from="Content/Grid_NameId/Line_ObjId" to="." method="OnLineObjectIdModified"]
[connection signal="mouse_entered" from="Content/Grid_UniqueHintType/HBox_UniqueId/Spin_UniqueId" to="." method="UpdateUniquenessWarnings"]
Expand All @@ -304,3 +372,6 @@ theme_override_styles/separator = ExtResource("6_diffx")
[connection signal="toggled" from="Content/Grid_UniqueHintType/HBox_Type/Check_Multi" to="." method="OnTypeGrandToggled"]
[connection signal="toggled" from="Content/Grid_UniqueHintType/HBox_Type/Check_Rock" to="." method="OnTypeMoonRockToggled"]
[connection signal="toggled" from="Content/Grid_UniqueHintType/HBox_Type/Check_Achievement" to="." method="OnTypeAchievementToggled"]
[connection signal="value_changed" from="Content/VBox_Trans/HBox_Values/Spin_X" to="." method="OnTranslationXModified"]
[connection signal="value_changed" from="Content/VBox_Trans/HBox_Values/Spin_Y" to="." method="OnTranslationYModified"]
[connection signal="value_changed" from="Content/VBox_Trans/HBox_Values/Spin_Z" to="." method="OnTranslationZModified"]

0 comments on commit 0318877

Please sign in to comment.