Merge remote-tracking branch 'origin/master' into gi

This commit is contained in:
Wojciech Figat
2022-04-21 12:57:08 +02:00
78 changed files with 604 additions and 311 deletions

View File

@@ -258,6 +258,24 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Output(0, string.Empty, null, 1)
}
},
new NodeArchetype
{
TypeID = 14,
Title = "Array Add Unique",
Description = "Adds the unique item to the array (to the end). Does nothing it specified item was already added.",
Flags = NodeFlags.VisualScriptGraph | NodeFlags.AnimGraph,
Size = new Vector2(170, 40),
ConnectionsHints = ConnectionsHint.Array,
IndependentBoxes = new int[] { 0 },
DependentBoxes = new int[] { 1, 2 },
DependentBoxFilter = GetArrayItemType,
Elements = new[]
{
NodeElementArchetype.Factory.Input(0, "Array", true, null, 0),
NodeElementArchetype.Factory.Input(1, "Item", true, typeof(object), 1),
NodeElementArchetype.Factory.Output(0, string.Empty, null, 2)
}
},
// first 100 IDs reserved for arrays
};
}

View File

@@ -192,7 +192,7 @@ namespace FlaxEditor.Surface.Archetypes
GetBox(MaterialNodeBoxes.SubsurfaceColor).Enabled = false;
break;
}
default: throw new ArgumentOutOfRangeException();
default: throw new ArgumentOutOfRangeException();
}
}
@@ -807,7 +807,26 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Input(0, "RGB", true, typeof(Vector3), 0, 0),
NodeElementArchetype.Factory.Output(0, "HSV", typeof(Vector3), 1),
}
}
},
new NodeArchetype
{
TypeID = 38,
Title = "Custom Global Code",
Description = "Custom global HLSL shader code expression (placed before material shader code). Can contain includes to shader utilities or declare functions to reuse later.",
Flags = NodeFlags.MaterialGraph,
Size = new Vector2(300, 220),
DefaultValues = new object[]
{
"// Here you can add HLSL code\nfloat4 GetCustomColor()\n{\n\treturn float4(1, 0, 0, 1);\n}",
true,
},
Elements = new[]
{
NodeElementArchetype.Factory.Bool(0, 0, 1),
NodeElementArchetype.Factory.Text(20, 0, "Enabled"),
NodeElementArchetype.Factory.TextBox(0, 20, 300, 200, 0),
}
},
};
}
}

View File

@@ -317,7 +317,7 @@ namespace FlaxEditor.Surface
// Header
if (e.Header != null)
itemLayout.Header(e.Header.Text);
itemLayout.Header(e.Header);
// Values container
var valueType = new ScriptType(e.Type);

View File

@@ -410,7 +410,7 @@ namespace FlaxEditor.Surface
// Header
var header = (HeaderAttribute)attributes.FirstOrDefault(x => x is HeaderAttribute);
if (header != null)
itemLayout.Header(header.Text);
itemLayout.Header(header);
var propertyValue = new CustomValueContainer
(