Merge remote-tracking branch 'origin/master' into 1.5
This commit is contained in:
@@ -225,7 +225,8 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static HashSet<PropertiesList> _visibleIfPropertiesListsCache;
|
private static HashSet<PropertiesList> _visibleIfPropertiesListsCache;
|
||||||
private static Dictionary<string, GroupElement> _groups;
|
private static Stack<Dictionary<string, GroupElement>> _groups;
|
||||||
|
private static List<Dictionary<string, GroupElement>> _groupsPool;
|
||||||
private VisibleIfCache[] _visibleIfCaches;
|
private VisibleIfCache[] _visibleIfCaches;
|
||||||
private bool _isNull;
|
private bool _isNull;
|
||||||
|
|
||||||
@@ -514,17 +515,38 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
menu.Show(groupPanel, location);
|
menu.Show(groupPanel, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void OnGroupUsage()
|
internal static void OnGroupsBegin()
|
||||||
{
|
{
|
||||||
if (_groups != null)
|
if (_groups == null)
|
||||||
_groups.Clear();
|
_groups = new Stack<Dictionary<string, GroupElement>>();
|
||||||
|
if (_groupsPool == null)
|
||||||
|
_groupsPool = new List<Dictionary<string, GroupElement>>();
|
||||||
|
Dictionary<string, GroupElement> group;
|
||||||
|
if (_groupsPool.Count != 0)
|
||||||
|
{
|
||||||
|
group = _groupsPool[0];
|
||||||
|
_groupsPool.RemoveAt(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
group = new Dictionary<string, GroupElement>();
|
||||||
|
}
|
||||||
|
_groups.Push(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void OnGroupsEnd()
|
||||||
|
{
|
||||||
|
var groups = _groups.Pop();
|
||||||
|
groups.Clear();
|
||||||
|
_groupsPool.Add(groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static LayoutElementsContainer OnGroup(LayoutElementsContainer layout, EditorDisplayAttribute display)
|
internal static LayoutElementsContainer OnGroup(LayoutElementsContainer layout, EditorDisplayAttribute display)
|
||||||
{
|
{
|
||||||
if (display?.Group != null)
|
if (display?.Group != null)
|
||||||
{
|
{
|
||||||
if (_groups != null && _groups.TryGetValue(display.Group, out var group))
|
var groups = _groups.Peek();
|
||||||
|
if (groups.TryGetValue(display.Group, out var group))
|
||||||
{
|
{
|
||||||
// Reuse group
|
// Reuse group
|
||||||
layout = group;
|
layout = group;
|
||||||
@@ -532,12 +554,10 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add new group
|
// Add new group
|
||||||
if (_groups == null)
|
|
||||||
_groups = new Dictionary<string, GroupElement>();
|
|
||||||
group = layout.Group(display.Group);
|
group = layout.Group(display.Group);
|
||||||
group.Panel.Tag = group;
|
group.Panel.Tag = group;
|
||||||
group.Panel.MouseButtonRightClicked += OnGroupPanelMouseButtonRightClicked;
|
group.Panel.MouseButtonRightClicked += OnGroupPanelMouseButtonRightClicked;
|
||||||
_groups.Add(display.Group, group);
|
groups.Add(display.Group, group);
|
||||||
layout = group;
|
layout = group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,7 +733,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
items.Sort();
|
items.Sort();
|
||||||
|
|
||||||
// Add items
|
// Add items
|
||||||
OnGroupUsage();
|
OnGroupsBegin();
|
||||||
for (int i = 0; i < items.Count; i++)
|
for (int i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
@@ -759,7 +779,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
} while (c != null);
|
} while (c != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnGroupUsage();
|
OnGroupsEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ namespace FlaxEditor.Surface
|
|||||||
|
|
||||||
internal static void DisplayGraphParameters(LayoutElementsContainer layout, GraphParameterData[] data, GetGraphParameterDelegate getter, SetGraphParameterDelegate setter, ValueContainer values, GetGraphParameterDelegate defaultValueGetter = null, CustomPropertySpawnDelegate propertySpawn = null)
|
internal static void DisplayGraphParameters(LayoutElementsContainer layout, GraphParameterData[] data, GetGraphParameterDelegate getter, SetGraphParameterDelegate setter, ValueContainer values, GetGraphParameterDelegate defaultValueGetter = null, CustomPropertySpawnDelegate propertySpawn = null)
|
||||||
{
|
{
|
||||||
CustomEditors.Editors.GenericEditor.OnGroupUsage();
|
CustomEditors.Editors.GenericEditor.OnGroupsBegin();
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
ref var e = ref data[i];
|
ref var e = ref data[i];
|
||||||
@@ -332,7 +332,7 @@ namespace FlaxEditor.Surface
|
|||||||
else
|
else
|
||||||
propertySpawn(itemLayout, valueContainer, ref e);
|
propertySpawn(itemLayout, valueContainer, ref e);
|
||||||
}
|
}
|
||||||
CustomEditors.Editors.GenericEditor.OnGroupUsage();
|
CustomEditors.Editors.GenericEditor.OnGroupsEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetMethodDisplayName(string methodName)
|
internal static string GetMethodDisplayName(string methodName)
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ namespace FlaxEditor.Surface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parameters = window.VisjectSurface.Parameters;
|
var parameters = window.VisjectSurface.Parameters;
|
||||||
CustomEditors.Editors.GenericEditor.OnGroupUsage();
|
CustomEditors.Editors.GenericEditor.OnGroupsBegin();
|
||||||
for (int i = 0; i < parameters.Count; i++)
|
for (int i = 0; i < parameters.Count; i++)
|
||||||
{
|
{
|
||||||
var p = parameters[i];
|
var p = parameters[i];
|
||||||
@@ -429,7 +429,7 @@ namespace FlaxEditor.Surface
|
|||||||
var property = itemLayout.AddPropertyItem(propertyLabel, tooltipText);
|
var property = itemLayout.AddPropertyItem(propertyLabel, tooltipText);
|
||||||
property.Property("Value", propertyValue);
|
property.Property("Value", propertyValue);
|
||||||
}
|
}
|
||||||
CustomEditors.Editors.GenericEditor.OnGroupUsage();
|
CustomEditors.Editors.GenericEditor.OnGroupsEnd();
|
||||||
|
|
||||||
// Parameters creating
|
// Parameters creating
|
||||||
var newParameterTypes = window.NewParameterTypes;
|
var newParameterTypes = window.NewParameterTypes;
|
||||||
|
|||||||
@@ -621,7 +621,11 @@ DragDropEffect WindowsWindow::DoDragDrop(const StringView& data)
|
|||||||
|
|
||||||
// Fix hanging mouse state (Windows doesn't send WM_LBUTTONUP when we end the drag and drop)
|
// Fix hanging mouse state (Windows doesn't send WM_LBUTTONUP when we end the drag and drop)
|
||||||
if (Input::GetMouseButton(MouseButton::Left))
|
if (Input::GetMouseButton(MouseButton::Left))
|
||||||
Input::Mouse->OnMouseUp(Input::Mouse->GetPosition(), MouseButton::Left, this);
|
{
|
||||||
|
::POINT point;
|
||||||
|
::GetCursorPos(&point);
|
||||||
|
Input::Mouse->OnMouseUp(Float2((float)point.x, (float)point.y), MouseButton::Left, this);
|
||||||
|
}
|
||||||
|
|
||||||
return SUCCEEDED(result) ? dropEffectFromOleEnum(dwEffect) : DragDropEffect::None;
|
return SUCCEEDED(result) ? dropEffectFromOleEnum(dwEffect) : DragDropEffect::None;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,18 +248,6 @@ bool ProcessMesh(ImportedModelData& result, AssimpImporterData& data, const aiMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normals
|
|
||||||
if (aMesh->mNormals)
|
|
||||||
{
|
|
||||||
mesh.Normals.Set((const Float3*)aMesh->mNormals, aMesh->mNumVertices);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tangents
|
|
||||||
if (aMesh->mTangents)
|
|
||||||
{
|
|
||||||
mesh.Tangents.Set((const Float3*)aMesh->mTangents, aMesh->mNumVertices);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Indices
|
// Indices
|
||||||
const int32 indicesCount = aMesh->mNumFaces * 3;
|
const int32 indicesCount = aMesh->mNumFaces * 3;
|
||||||
mesh.Indices.Resize(indicesCount, false);
|
mesh.Indices.Resize(indicesCount, false);
|
||||||
@@ -277,6 +265,27 @@ bool ProcessMesh(ImportedModelData& result, AssimpImporterData& data, const aiMe
|
|||||||
mesh.Indices[i++] = face->mIndices[2];
|
mesh.Indices[i++] = face->mIndices[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normals
|
||||||
|
if (data.Options.CalculateNormals || !aMesh->mNormals)
|
||||||
|
{
|
||||||
|
// Support generation of normals when using assimp.
|
||||||
|
if (mesh.GenerateNormals(data.Options.SmoothingNormalsAngle))
|
||||||
|
{
|
||||||
|
errorMsg = TEXT("Failed to generate normals.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aMesh->mNormals)
|
||||||
|
{
|
||||||
|
mesh.Normals.Set((const Float3*)aMesh->mNormals, aMesh->mNumVertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tangents
|
||||||
|
if (aMesh->mTangents)
|
||||||
|
{
|
||||||
|
mesh.Tangents.Set((const Float3*)aMesh->mTangents, aMesh->mNumVertices);
|
||||||
|
}
|
||||||
|
|
||||||
// Lightmap UVs
|
// Lightmap UVs
|
||||||
if (data.Options.LightmapUVsSource == ModelLightmapUVsSource::Disable)
|
if (data.Options.LightmapUVsSource == ModelLightmapUVsSource::Disable)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user