account for surface node elements when auto resizing
This commit is contained in:
@@ -482,7 +482,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(bool))),
|
||||
Description = "Constant boolean value",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(90, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
@@ -516,7 +515,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(int))),
|
||||
Description = "Constant integer value",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(120, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
@@ -545,7 +543,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(float))),
|
||||
Description = "Constant floating point",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(120, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
@@ -753,7 +750,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Title = "PI",
|
||||
Description = "A value specifying the approximation of π which is 180 degrees",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(45, 20),
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -786,7 +782,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(uint))),
|
||||
Description = "Constant unsigned integer value",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(130, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
@@ -829,7 +824,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(double))),
|
||||
Description = "Constant floating point",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(120, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
|
||||
@@ -134,7 +134,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new Constants.ConvertToParameterNode(id, context, arch, groupArch, new ScriptType(typeof(Texture))),
|
||||
Description = "Two dimensional texture object",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(140, 140),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
@@ -159,7 +158,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
AlternativeTitles = new string[] { "UV", "UVs" },
|
||||
Description = "Texture coordinates",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
UseFixedSize = true,
|
||||
Size = new Float2(160, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEditor.Surface.Elements;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.Surface
|
||||
@@ -205,6 +206,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.BoolValue,
|
||||
Position = new Float2(x, y),
|
||||
Size = new Float2(16f),
|
||||
Text = null,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
@@ -229,6 +231,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.IntegerValue,
|
||||
Position = new Float2(Constants.NodeMarginX + x, Constants.NodeMarginY + Constants.NodeHeaderHeight + y),
|
||||
Size = new Float2(50f, IntegerValue.DefaultHeight),
|
||||
Text = null,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
@@ -255,6 +258,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.UnsignedIntegerValue,
|
||||
Position = new Float2(Constants.NodeMarginX + x, Constants.NodeMarginY + Constants.NodeHeaderHeight + y),
|
||||
Size = new Float2(50f, UnsignedIntegerValue.DefaultHeight),
|
||||
Text = null,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
@@ -281,6 +285,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.FloatValue,
|
||||
Position = new Float2(Constants.NodeMarginX + x, Constants.NodeMarginY + Constants.NodeHeaderHeight + y),
|
||||
Size = new Float2(50f, FloatValueBox.DefaultHeight),
|
||||
Text = null,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
@@ -360,6 +365,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.ColorValue,
|
||||
Position = new Float2(Constants.NodeMarginX + x, Constants.NodeMarginY + Constants.NodeHeaderHeight + y),
|
||||
Size = new Float2(32, 18),
|
||||
Text = null,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
@@ -382,6 +388,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Asset,
|
||||
Position = new Float2(x, y),
|
||||
Size = new Float2(78f, 90f),
|
||||
Text = type.FullName,
|
||||
Single = false,
|
||||
ValueIndex = valueIndex,
|
||||
|
||||
@@ -242,6 +242,17 @@ namespace FlaxEditor.Surface
|
||||
rightWidth = Mathf.Max(rightWidth, boxLabelFont.MeasureText(outputBox.Text).X + 20);
|
||||
rightHeight = Mathf.Max(rightHeight, outputBox.Archetype.Position.Y - Constants.NodeMarginY - Constants.NodeHeaderHeight + 20.0f);
|
||||
}
|
||||
// Elements (Float-, int-, uint- value boxes, asset pickers, etc.)
|
||||
else if (child is ISurfaceNodeElement surfaceElement)
|
||||
{
|
||||
leftWidth = Mathf.Max(leftWidth, surfaceElement.Archetype.Size.X + 8f);
|
||||
leftHeight = Mathf.Max(leftHeight, surfaceElement.Archetype.Size.Y + 8f);
|
||||
}
|
||||
else if (child is SurfaceNodeElementControl elementControl)
|
||||
{
|
||||
leftWidth = Mathf.Max(leftWidth, elementControl.Width + 8f);
|
||||
leftHeight = Mathf.Max(leftHeight, elementControl.Height + 8f);
|
||||
}
|
||||
// Other controls in the node
|
||||
else if (child is Control control)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user