Tool windows redesign and the Novel Editor workspace
Tool windows: - Every editor (scenario, scene builder, map, interactive objects, lighting, catalog export) is rebuilt on the interface ToolWindow chrome and the denser ToolTheme: header with title/close, status bar, Ctrl+S, dirty-state confirmation. - Shared building blocks in src/Common: ToolUi (rows, buttons, sections), CollapsibleSection, FilteredList, ModFileSelector, DragHandle and BackgroundCanvas (scene background with pan/zoom). - The map, interactive and light editors draw on canvases (MapEditorCanvas, InteractiveEditorCanvas, LightEditorCanvas) instead of one Control "handle" node per object; the *Handle classes are removed. - Scenario editor: tab data model (TabData), automatic graph layout (ScenarioGraphLayout), file tree/info/thumbnail panel updates. - Services: ModFileService (mod file listing and writing), SceneBackgroundService; MapFileService/ModResourceService follow. - Catalog export: per-language name/description editing. - Locale (en/ru) regrouped under tools/*; unused keys removed. Novel Editor: - collections/novel_editor.json: a "game" whose entry scene is an authoring workspace over the novel engine and the story content. - NovelEditorHub (scenes/novel_editor_hub.tscn) lists every installed tool through IToolProvider.AddMenuButton; ToolsInitializer registers it as the logical scene "novel_editor".
This commit is contained in:
1 parent
578ba7c5d5
commit
8742aa3da5
45 files changed
+4718
-3463
No files matched your search
@@ -1,5 +1,7 @@
|
||||
using System.Linq;
|
||||
using Cthangover.Tools.Services;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Cthangover.Mods.Interface.Tool;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
@@ -14,26 +16,59 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
private Label _infoLocaleKeys;
|
||||
private Label _infoQuestRefs;
|
||||
|
||||
public ScenarioInfoPanel()
|
||||
/// <summary>Binds the rows once the panel enters the tree (see <see cref="Bind"/>).</summary>
|
||||
public override void _Ready()
|
||||
{
|
||||
GetNode<Label>("Scroll/VBox/HintScene").Text = TranslationServer.Translate("tools/scenario_editor/info_scene") + ":";
|
||||
GetNode<Label>("Scroll/VBox/HintPriority").Text = TranslationServer.Translate("tools/scenario_editor/info_priority") + ":";
|
||||
GetNode<Label>("Scroll/VBox/HintCondition").Text = TranslationServer.Translate("tools/scenario_editor/info_condition") + ":";
|
||||
GetNode<Label>("Scroll/VBox/HintSwitchTargets").Text = TranslationServer.Translate("tools/scenario_editor/info_switch_targets") + ":";
|
||||
GetNode<Label>("Scroll/VBox/HintLocaleKeys").Text = TranslationServer.Translate("tools/scenario_editor/info_locale_keys") + ":";
|
||||
GetNode<Label>("Scroll/VBox/HintQuestRefs").Text = TranslationServer.Translate("tools/scenario_editor/info_quest_refs") + ":";
|
||||
Bind();
|
||||
}
|
||||
|
||||
_infoScene = GetNode<Label>("Scroll/VBox/InfoScene");
|
||||
_infoPriority = GetNode<Label>("Scroll/VBox/InfoPriority");
|
||||
_infoCondition = GetNode<Label>("Scroll/VBox/InfoCondition");
|
||||
_infoSwitchTargets = GetNode<Label>("Scroll/VBox/InfoSwitchTargets");
|
||||
_infoLocaleKeys = GetNode<Label>("Scroll/VBox/InfoLocaleKeys");
|
||||
_infoQuestRefs = GetNode<Label>("Scroll/VBox/InfoQuestRefs");
|
||||
/// <summary>
|
||||
/// Looks the rows up lazily: the tscn builder runs the constructor before
|
||||
/// the child nodes exist, so lookups there would fail.
|
||||
/// </summary>
|
||||
private void Bind()
|
||||
{
|
||||
if (_infoScene != null)
|
||||
return;
|
||||
|
||||
SetHint("HintScene", "tools/scenario_editor/info_scene");
|
||||
SetHint("HintPriority", "tools/scenario_editor/info_priority");
|
||||
SetHint("HintCondition", "tools/scenario_editor/info_condition");
|
||||
SetHint("HintSwitchTargets", "tools/scenario_editor/info_switch_targets");
|
||||
SetHint("HintLocaleKeys", "tools/scenario_editor/info_locale_keys");
|
||||
SetHint("HintQuestRefs", "tools/scenario_editor/info_quest_refs");
|
||||
|
||||
_infoScene = Value("InfoScene");
|
||||
_infoPriority = Value("InfoPriority");
|
||||
_infoCondition = Value("InfoCondition");
|
||||
_infoSwitchTargets = Value("InfoSwitchTargets");
|
||||
_infoLocaleKeys = Value("InfoLocaleKeys");
|
||||
_infoQuestRefs = Value("InfoQuestRefs");
|
||||
}
|
||||
|
||||
private void SetHint(string node, string key)
|
||||
{
|
||||
var label = GetNode<Label>("Scroll/VBox/" + node);
|
||||
label.Text = TranslationServer.Translate(key).ToString().ToUpperInvariant();
|
||||
label.AddThemeColorOverride("font_color", UiTokens.Muted);
|
||||
label.AddThemeFontSizeOverride("font_size", UiTokens.FontSmall);
|
||||
}
|
||||
|
||||
private Label Value(string node)
|
||||
{
|
||||
var label = GetNode<Label>("Scroll/VBox/" + node);
|
||||
label.AutowrapMode = TextServer.AutowrapMode.WordSmart;
|
||||
label.SizeFlagsHorizontal = SizeFlags.ExpandFill;
|
||||
label.CustomMinimumSize = new Vector2(120, 0);
|
||||
label.AddThemeFontOverride("font", ToolWindow.GetMonospaceFont());
|
||||
label.AddThemeFontSizeOverride("font_size", UiTokens.FontBodySmall);
|
||||
return label;
|
||||
}
|
||||
|
||||
/// <summary>Parses the given scenario text and refreshes every metadata row.</summary>
|
||||
public void Update(string text)
|
||||
{
|
||||
Bind();
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
Clear();
|
||||
@@ -54,6 +89,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
/// <summary>Resets every metadata row to the "-" placeholder.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
Bind();
|
||||
_infoScene.Text = "-";
|
||||
_infoPriority.Text = "-";
|
||||
_infoCondition.Text = "-";
|
||||
|
||||
Reference in new issue
Block a user