Skip to content

Commit 10c74fa

Browse files
authored
1 parent b2122ed commit 10c74fa

3 files changed

Lines changed: 305 additions & 112 deletions

File tree

game/addons/tools/Code/Scene/Mesh/Widgets/ActiveMaterialWidget.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Editor.MeshEditor;
1+
using Sandbox.UI;
2+
3+
namespace Editor.MeshEditor;
24

35
class ActiveMaterialWidget : ControlWidget
46
{
@@ -10,29 +12,26 @@ class ActiveMaterialWidget : ControlWidget
1012
public ActiveMaterialWidget( SerializedProperty property ) : base( property )
1113
{
1214
FixedHeight = 220;
13-
1415
Layout = Layout.Row();
15-
Layout.Margin = 8;
1616

1717
ToolTip = "";
1818

19-
_materialWidget = Layout.Add( new MaterialWidget() );
20-
_materialWidget.ToolTip = "Active Material";
21-
_materialWidget.FixedSize = FixedHeight - 26;
22-
_materialWidget.Cursor = CursorShape.Finger;
23-
24-
Layout.AddStretchCell( 1 );
25-
2619
_paletteStrip = Layout.Add( new MaterialPaletteWidget() );
2720
_paletteStrip.MaterialClicked += OnPaletteMaterialClicked;
28-
_paletteStrip.FixedHeight = FixedHeight - 26;
21+
_paletteStrip.FixedHeight = FixedHeight - 8;
22+
_paletteStrip.FixedWidth = 64;
2923
_paletteStrip.GetActiveMaterial = () => _materialWidget.Material;
3024

31-
Layout.AddStretchCell( 1 );
25+
Layout.AddSpacingCell( 1 );
26+
27+
_materialWidget = Layout.Add( new MaterialWidget() );
28+
_materialWidget.ToolTip = "Active Material";
29+
_materialWidget.FixedSize = FixedHeight - 22;
30+
_materialWidget.Cursor = CursorShape.Finger;
31+
3232

3333
Frame();
3434
}
35-
3635
protected override void OnPaint()
3736
{
3837
// nothing
@@ -99,7 +98,7 @@ protected override void OnMouseClick( MouseEvent e )
9998
base.OnMouseClick( e );
10099

101100
// If we are selecting the Material Widget continue. (Probably better way of doing this)
102-
if ( !_materialWidget.LocalRect.IsInside( e.LocalPosition ) )
101+
if ( _materialWidget.ContentRect.IsInside( e.LocalPosition ) )
103102
return;
104103

105104
if ( ReadOnly ) return;

game/addons/tools/Code/Scene/Mesh/Widgets/MaterialWidget.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ protected override void OnPaint()
3333

3434
if ( icon is not null )
3535
{
36-
Paint.Draw( LocalRect.Shrink( 2 ), icon );
36+
Paint.Draw( LocalRect, icon );
3737
}
3838

3939
if ( ShowFilename && asset is not null )
4040
{
4141
Paint.SetDefaultFont( 7 );
42-
Theme.DrawFilename( LocalRect.Shrink( 4 ), asset.RelativePath, TextFlag.LeftBottom, Color.White );
42+
Theme.DrawFilename( LocalRect, asset.RelativePath, TextFlag.LeftBottom, Color.White );
4343
}
4444

4545
}

0 commit comments

Comments
 (0)