Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bda1a7b
First iteration (no tests)
Lwmte Mar 1, 2026
49c3c3c
Second iteration
Lwmte Mar 1, 2026
7382b6c
Fixed text control focus
Lwmte Mar 1, 2026
1e619ca
Fix WPF nud not accepting minus key
Lwmte Mar 1, 2026
e8bcd38
Fixed tooltip style
Lwmte Mar 1, 2026
b238133
Renames
Lwmte Mar 1, 2026
2a1987d
Update LevelCompilerTombEngine.cs
Lwmte Mar 1, 2026
dc294ad
Write default properties from the xml file, if not present in wads
Lwmte Mar 1, 2026
9b00175
Added enum property type
Lwmte Mar 1, 2026
68119a7
Fix wad2 workflow
Lwmte Mar 1, 2026
66c4d5c
Added mousewheel scroll for comboboxes
Lwmte Mar 1, 2026
154a5ec
Fixes
Lwmte Mar 1, 2026
04571ea
Update FormMain.Designer.cs
Lwmte Mar 1, 2026
2d0f397
UI alignments
Lwmte Mar 1, 2026
a9e5bd9
Update LuaPropertyScriptBuilder.cs
Lwmte Mar 1, 2026
9f94673
Unify boxing/unboxing code for nodes and properties
Lwmte Mar 1, 2026
1fb1cd4
Remove unnecessary controls
Lwmte Mar 2, 2026
7141ca8
Address PR comments
Lwmte Mar 2, 2026
7737278
Address PR comments 2
Lwmte Mar 2, 2026
d415dff
Update FormMain.cs
Lwmte Mar 2, 2026
19a8f16
Fixes
Lwmte Mar 2, 2026
1db562b
Enclose property editor within texture panel
Lwmte Mar 2, 2026
6e68f07
Eyeball, deslop
Lwmte Mar 4, 2026
491a481
Merge branch 'develop' into property_system_wpf
Lwmte Mar 6, 2026
099a100
Add edit properties to object context menu in WT
Lwmte Mar 6, 2026
16c51d4
Merge branch 'develop' into property_system_wpf
Lwmte Mar 9, 2026
a0b0c83
Update README.md
Lwmte Mar 9, 2026
cb9c4c7
Update README.md
Lwmte Mar 9, 2026
33f872a
Fixed #1149
Lwmte Mar 9, 2026
5102c78
Fixed #1150
Lwmte Mar 9, 2026
7636c1f
Merge branch 'develop' into property_system_wpf
Lwmte Mar 11, 2026
80ad2fc
Merge branch 'develop' into property_system_wpf
Lwmte Mar 17, 2026
c6f0a37
Disable control when no wad is loaded
Lwmte Mar 25, 2026
85f102a
Simplify UI updates
Lwmte Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DarkUI/DarkUI.WPF/CustomControls/NumericUpDown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ private void TextBox_PreviewKeyUp(object sender, KeyEventArgs e)

private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
// Prevent character input, but allow the current culture's decimal separator
if (!double.TryParse(e.Text, out _) && e.Text != CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)
// Allow digits, the current culture's decimal separator, and minus sign.
if (!double.TryParse(e.Text, out _)
&& e.Text != CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator
&& e.Text != CultureInfo.CurrentCulture.NumberFormat.NegativeSign)
e.Handled = true;
}

Expand Down
1 change: 1 addition & 0 deletions TombEditor/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,7 @@ static CommandHandler()
AddCommand("ShowTexturePanel", "Show texture panel", CommandType.Windows, (CommandArgs args) => args.Editor.ToggleToolWindow(typeof(TexturePanel)));
AddCommand("ShowObjectList", "Show object list", CommandType.Windows, (CommandArgs args) => args.Editor.ToggleToolWindow(typeof(ObjectList)));
AddCommand("ShowToolPalette", "Show tool palette", CommandType.Windows, (CommandArgs args) => args.Editor.ToggleToolWindow(typeof(ToolPalette)));
AddCommand("ShowItemProperties", "Show item properties", CommandType.Windows, (CommandArgs args) => args.Editor.ToggleToolWindow(typeof(ItemProperties)));

AddCommand("ShowStatistics", "Statistics display", CommandType.Windows, delegate (CommandArgs args)
{
Expand Down
2 changes: 1 addition & 1 deletion TombEditor/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public void EnsureDefaults()
{
new DockGroupState
{
Contents = new List<string> { "TexturePanel" },
Contents = new List<string> { "TexturePanel", "ItemProperties" },
VisibleContent = "TexturePanel",
Order = 0,
Size = new Size(286,700)
Expand Down
13 changes: 12 additions & 1 deletion TombEditor/Forms/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion TombEditor/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public partial class FormMain : DarkForm
new Palette(),
new TexturePanel(),
new ObjectList(),
new ToolPalette()
new ToolPalette(),
new ItemProperties()
};

// Floating tool boxes are placed on 3D view at runtime
Expand Down Expand Up @@ -587,6 +588,7 @@ private void ToolWindow_BuildMenu()
lightingToolStripMenuItem.Checked = dockArea.ContainsContent(GetWindow<Lighting>());
paletteToolStripMenuItem.Checked = dockArea.ContainsContent(GetWindow<Palette>());
texturePanelToolStripMenuItem.Checked = dockArea.ContainsContent(GetWindow<TexturePanel>());
luaPropertiesToolStripMenuItem.Checked = dockArea.ContainsContent(GetWindow<ItemProperties>());
dockableToolStripMenuItem.Checked = dockArea.ContainsContent(GetWindow<ToolPalette>());
}

Expand Down
31 changes: 31 additions & 0 deletions TombEditor/ToolWindows/ItemProperties.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

144 changes: 144 additions & 0 deletions TombEditor/ToolWindows/ItemProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
using DarkUI.Docking;
using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using TombLib.Forms.ViewModels;
using TombLib.Forms.Views;
using TombLib.LevelData;
using TombLib.LuaProperties;

namespace TombEditor.ToolWindows
{
public partial class ItemProperties : DarkToolWindow
{
private readonly Editor _editor;

// WPF hosting
private readonly ElementHost _elementHost;
private readonly LuaPropertyGridControl _wpfControl;
private readonly LuaPropertyGridViewModel _viewModel;

// Tracked selection
private ObjectInstance _currentObject;

public ItemProperties()
{
InitializeComponent();

_editor = Editor.Instance;

// Create WPF control + view model.
_viewModel = new LuaPropertyGridViewModel();
_viewModel.PropertyValueChanged += OnPropertyValueChanged;

_wpfControl = new LuaPropertyGridControl();
_wpfControl.ViewModel = _viewModel;

// ElementHost bridges WPF into the DarkToolWindow.
_elementHost = new ElementHost
{
Dock = DockStyle.Fill,
Child = _wpfControl
};
this.Controls.Add(_elementHost);

_editor.EditorEventRaised += EditorEventRaised;
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
_editor.EditorEventRaised -= EditorEventRaised;
_viewModel.PropertyValueChanged -= OnPropertyValueChanged;
_elementHost?.Dispose();
}
if (disposing && components != null)
components.Dispose();
base.Dispose(disposing);
}

private void EditorEventRaised(IEditorEvent obj)
{
// Respond to selection changes.
if (obj is Editor.SelectedObjectChangedEvent ||
obj is Editor.SelectedRoomChangedEvent)
{
UpdatePropertyGrid();
}

// Respond to object property changes (e.g. if OCB or slot changed externally).
if (obj is Editor.ObjectChangedEvent objEvent)
{
if (objEvent.Object == _currentObject)
UpdatePropertyGrid();
}

// Listen for wad/game version changes to update catalog.
if (obj is Editor.LoadedWadsChangedEvent ||
obj is Editor.GameVersionChangedEvent ||
obj is Editor.LevelChangedEvent ||
obj is Editor.InitEvent)
{
UpdatePropertyGrid();
}
}

private void UpdatePropertyGrid()
{
var selected = _editor.SelectedObject;

// Only show for TombEngine levels.
if (!_editor.Level.IsTombEngine)
{
_viewModel.Clear();
_viewModel.Title = "Item Properties";
_viewModel.StatusMessage = "Not supported for this engine target.";
_currentObject = null;
return;
}

if (selected is MoveableInstance moveable)
{
_currentObject = moveable;
var typeId = moveable.WadObjectId.TypeId;
var definitions = LuaPropertyCatalog.GetDefinitions(LuaPropertyObjectKind.Moveable, typeId);

// Get wad2 global defaults for this moveable type (if available).
var wadMoveable = _editor.Level.Settings.WadTryGetMoveable(moveable.WadObjectId);
var globalDefaults = wadMoveable?.LuaProperties;

_viewModel.Title = $"Properties: {moveable.ItemType.ToString()}";
_viewModel.Load(definitions, moveable.LuaProperties, globalDefaults);
_viewModel.StatusMessage = "No properties defined for this moveable type.";
}
else if (selected is StaticInstance staticObj)
{
_currentObject = staticObj;
var typeId = staticObj.WadObjectId.TypeId;
var definitions = LuaPropertyCatalog.GetDefinitions(LuaPropertyObjectKind.Static, typeId);

// Get wad2 global defaults for this static type (if available).
var wadStatic = _editor.Level.Settings.WadTryGetStatic(staticObj.WadObjectId);
var globalDefaults = wadStatic?.LuaProperties;

_viewModel.Title = $"Properties: {staticObj.ItemType.ToString()}";
_viewModel.Load(definitions, staticObj.LuaProperties, globalDefaults);
_viewModel.StatusMessage = "No properties defined for this static mesh slot.";
}
else
{
_currentObject = null;
_viewModel.Clear();
_viewModel.Title = "Item Properties";
_viewModel.StatusMessage = "Select a valid object to edit properties.";
}
}

private void OnPropertyValueChanged(object sender, EventArgs e)
{
if (_currentObject != null)
_editor.ObjectChange(_currentObject, ObjectChangeType.Change);
}
}
}
Loading