Merge remote-tracking branch 'origin/master' into 1.7
# Conflicts: # Source/Engine/Level/Actors/SplineModel.cpp # Source/Engine/Level/Actors/SplineModel.h
This commit is contained in:
@@ -29,7 +29,7 @@ namespace FlaxEditor.Content
|
||||
if (asset)
|
||||
{
|
||||
var source = Editor.GetShaderSourceCode(asset);
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source", item.RootWindow.Window);
|
||||
Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source", item.RootWindow?.Window);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -102,5 +102,7 @@ public class Editor : EditorModule
|
||||
files.Add(Path.Combine(FolderPath, "Cooker/GameCooker.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Cooker/PlatformTools.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Cooker/Steps/CookAssetsStep.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Utilities/ScreenUtilities.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Utilities/ViewportIconsRenderer.h"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ namespace FlaxEditor.Viewport.Previews
|
||||
{
|
||||
UseTimeScale = false,
|
||||
UpdateWhenOffscreen = true,
|
||||
//_previewModel.BoundsScale = 1000.0f;
|
||||
UpdateMode = AnimatedModel.AnimationUpdateMode.Manual
|
||||
BoundsScale = 100.0f,
|
||||
UpdateMode = AnimatedModel.AnimationUpdateMode.Manual,
|
||||
};
|
||||
Task.AddCustomActor(_previewModel);
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ void AnimGraphExecutor::ProcessAnimation(AnimGraphImpulse* nodes, AnimGraphNode*
|
||||
const float animPrevPos = GetAnimSamplePos(length, anim, prevPos, speed);
|
||||
|
||||
// Evaluate nested animations
|
||||
bool hasNested = false;
|
||||
if (anim->NestedAnims.Count() != 0)
|
||||
{
|
||||
for (auto& e : anim->NestedAnims)
|
||||
@@ -239,6 +240,7 @@ void AnimGraphExecutor::ProcessAnimation(AnimGraphImpulse* nodes, AnimGraphNode*
|
||||
GetAnimSamplePos(nestedAnim.Loop, nestedAnimLength, nestedAnim.StartTime, nestedAnimPrevPos, nestedAnimPos, nestedAnimPos, nestedAnimPrevPos);
|
||||
|
||||
ProcessAnimation(nodes, node, true, nestedAnimLength, nestedAnimPos, nestedAnimPrevPos, nestedAnim.Anim, 1.0f, weight, mode);
|
||||
hasNested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,7 +293,7 @@ void AnimGraphExecutor::ProcessAnimation(AnimGraphImpulse* nodes, AnimGraphNode*
|
||||
dstNode.Scale = srcNode.Scale * weight;
|
||||
dstNode.Orientation = srcNode.Orientation * weight;
|
||||
}
|
||||
else
|
||||
else if (!hasNested)
|
||||
{
|
||||
dstNode = srcNode;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ public class Content : EngineModule
|
||||
files.AddRange(Directory.GetFiles(FolderPath, "*.h", SearchOption.TopDirectoryOnly));
|
||||
files.AddRange(Directory.GetFiles(Path.Combine(FolderPath, "Assets"), "*.h", SearchOption.TopDirectoryOnly));
|
||||
files.AddRange(Directory.GetFiles(Path.Combine(FolderPath, "Cache"), "*.h", SearchOption.TopDirectoryOnly));
|
||||
files.AddRange(Directory.GetFiles(Path.Combine(FolderPath, "Factories"), "*.h", SearchOption.TopDirectoryOnly));
|
||||
files.AddRange(Directory.GetFiles(Path.Combine(FolderPath, "Storage"), "*.h", SearchOption.TopDirectoryOnly));
|
||||
files.Add(Path.Combine(FolderPath, "Upgraders/BinaryAssetUpgrader.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Upgraders/IAssetUpgrader.h"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
using Flax.Build.NativeCpp;
|
||||
|
||||
@@ -23,5 +24,7 @@ public class ContentExporters : EngineModule
|
||||
/// <inheritdoc />
|
||||
public override void GetFilesToDeploy(List<string> files)
|
||||
{
|
||||
files.Add(Path.Combine(FolderPath, "AssetsExportingManager.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Types.h"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
using Flax.Build.NativeCpp;
|
||||
|
||||
@@ -31,5 +32,7 @@ public class ContentImporters : EngineModule
|
||||
/// <inheritdoc />
|
||||
public override void GetFilesToDeploy(List<string> files)
|
||||
{
|
||||
files.Add(Path.Combine(FolderPath, "AssetsImportingManager.h"));
|
||||
files.Add(Path.Combine(FolderPath, "Types.h"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1066,6 +1066,23 @@ void AnimatedModel::Deserialize(DeserializeStream& stream, ISerializeModifier* m
|
||||
DrawModes |= DrawPass::GlobalSurfaceAtlas;
|
||||
}
|
||||
|
||||
MaterialBase* AnimatedModel::GetMaterial(int32 entryIndex)
|
||||
{
|
||||
if (SkinnedModel)
|
||||
SkinnedModel->WaitForLoaded();
|
||||
else
|
||||
return nullptr;
|
||||
CHECK_RETURN(entryIndex >= 0 && entryIndex < Entries.Count(), nullptr);
|
||||
MaterialBase* material = Entries[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
{
|
||||
material = SkinnedModel->MaterialSlots[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
material = GPUDevice::Instance->GetDefaultMaterial();
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
||||
bool AnimatedModel::IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal)
|
||||
{
|
||||
auto model = SkinnedModel.Get();
|
||||
|
||||
@@ -384,6 +384,7 @@ public:
|
||||
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
MaterialBase* GetMaterial(int32 entryIndex) override;
|
||||
bool IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal) override;
|
||||
bool IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex) override;
|
||||
bool GetMeshData(const MeshReference& mesh, MeshBufferType type, BytesContainer& result, int32& count) const override;
|
||||
|
||||
@@ -39,10 +39,9 @@ void ModelInstanceActor::SetMaterial(int32 entryIndex, MaterialBase* material)
|
||||
MaterialInstance* ModelInstanceActor::CreateAndSetVirtualMaterialInstance(int32 entryIndex)
|
||||
{
|
||||
WaitForModelLoad();
|
||||
CHECK_RETURN(entryIndex >= 0 && entryIndex < Entries.Count(), nullptr);
|
||||
auto material = Entries[entryIndex].Material.Get();
|
||||
MaterialBase* material = GetMaterial(entryIndex);
|
||||
CHECK_RETURN(material && !material->WaitForLoaded(), nullptr);
|
||||
const auto result = material->CreateVirtualInstance();
|
||||
MaterialInstance* result = material->CreateVirtualInstance();
|
||||
Entries[entryIndex].Material = result;
|
||||
if (_sceneRenderingKey != -1)
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||
|
||||
@@ -52,6 +52,12 @@ public:
|
||||
/// </summary>
|
||||
API_PROPERTY() void SetEntries(const Array<ModelInstanceEntry>& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the material used to draw the meshes which are assigned to that slot (set in Entries or model's default).
|
||||
/// </summary>
|
||||
/// <param name="entryIndex">The material slot entry index.</param>
|
||||
API_FUNCTION(Sealed) virtual MaterialBase* GetMaterial(int32 entryIndex) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the material to the entry slot. Can be used to override the material of the meshes using this slot.
|
||||
/// </summary>
|
||||
|
||||
@@ -341,6 +341,23 @@ void SplineModel::OnParentChanged()
|
||||
OnSplineUpdated();
|
||||
}
|
||||
|
||||
MaterialBase* SplineModel::GetMaterial(int32 entryIndex)
|
||||
{
|
||||
if (Model)
|
||||
Model->WaitForLoaded();
|
||||
else
|
||||
return nullptr;
|
||||
CHECK_RETURN(entryIndex >= 0 && entryIndex < Entries.Count(), nullptr);
|
||||
MaterialBase* material = Entries[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
{
|
||||
material = Model->MaterialSlots[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
material = GPUDevice::Instance->GetDefaultDeformableMaterial();
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
||||
void SplineModel::UpdateBounds()
|
||||
{
|
||||
OnSplineUpdated();
|
||||
|
||||
@@ -115,6 +115,7 @@ public:
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
void OnParentChanged() override;
|
||||
MaterialBase* GetMaterial(int32 entryIndex) override;
|
||||
void UpdateBounds() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -543,6 +543,23 @@ void StaticModel::Deserialize(DeserializeStream& stream, ISerializeModifier* mod
|
||||
}
|
||||
}
|
||||
|
||||
MaterialBase* StaticModel::GetMaterial(int32 entryIndex)
|
||||
{
|
||||
if (Model)
|
||||
Model->WaitForLoaded();
|
||||
else
|
||||
return nullptr;
|
||||
CHECK_RETURN(entryIndex >= 0 && entryIndex < Entries.Count(), nullptr);
|
||||
MaterialBase* material = Entries[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
{
|
||||
material = Model->MaterialSlots[entryIndex].Material.Get();
|
||||
if (!material)
|
||||
material = GPUDevice::Instance->GetDefaultMaterial();
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
||||
bool StaticModel::IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal)
|
||||
{
|
||||
auto model = Model.Get();
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
/// <param name="meshIndex">The zero-based mesh index.</param>
|
||||
/// <param name="lodIndex">The LOD index.</param>
|
||||
/// <returns>Material or null if not assigned.</returns>
|
||||
API_FUNCTION() MaterialBase* GetMaterial(int32 meshIndex, int32 lodIndex = 0) const;
|
||||
API_FUNCTION() MaterialBase* GetMaterial(int32 meshIndex, int32 lodIndex) const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the painter vertex (this model instance).
|
||||
@@ -166,6 +166,7 @@ public:
|
||||
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
MaterialBase* GetMaterial(int32 entryIndex) override;
|
||||
bool IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal) override;
|
||||
bool IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex) override;
|
||||
bool GetMeshData(const MeshReference& mesh, MeshBufferType type, BytesContainer& result, int32& count) const override;
|
||||
|
||||
@@ -847,6 +847,9 @@ namespace Flax.Build.Bindings
|
||||
case "hidden":
|
||||
desc.IsHidden = true;
|
||||
break;
|
||||
case "sealed":
|
||||
desc.IsVirtual = false;
|
||||
break;
|
||||
case "tag":
|
||||
ParseTag(ref desc.Tags, tag);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user