Merge remote-tracking branch 'origin/master' into 1.12
# Conflicts: # Content/Editor/Camera/M_Camera.flax # Content/Editor/CubeTexturePreviewMaterial.flax # Content/Editor/DebugMaterials/DDGIDebugProbes.flax # Content/Editor/DebugMaterials/SingleColor/Decal.flax # Content/Editor/DebugMaterials/SingleColor/Particle.flax # Content/Editor/DebugMaterials/SingleColor/Surface.flax # Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax # Content/Editor/DebugMaterials/SingleColor/Terrain.flax # Content/Editor/DefaultFontMaterial.flax # Content/Editor/Gizmo/FoliageBrushMaterial.flax # Content/Editor/Gizmo/Material.flax # Content/Editor/Gizmo/MaterialWire.flax # Content/Editor/Gizmo/SelectionOutlineMaterial.flax # Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax # Content/Editor/Highlight Material.flax # Content/Editor/Icons/IconsMaterial.flax # Content/Editor/IesProfilePreviewMaterial.flax # Content/Editor/MaterialTemplates/Features/ForwardShading.hlsl # Content/Editor/Particles/Particle Material Color.flax # Content/Editor/Particles/Smoke Material.flax # Content/Editor/SpriteMaterial.flax # Content/Editor/Terrain/Circle Brush Material.flax # Content/Editor/Terrain/Highlight Terrain Material.flax # Content/Editor/TexturePreviewMaterial.flax # Content/Editor/Wires Debug Material.flax # Content/Engine/DefaultDeformableMaterial.flax # Content/Engine/DefaultMaterial.flax # Content/Engine/DefaultRadialMenu.flax # Content/Engine/DefaultTerrainMaterial.flax # Content/Engine/SingleColorMaterial.flax # Content/Engine/SkyboxMaterial.flax # Flax.flaxproj # Source/Engine/Graphics/Materials/MaterialShader.h # Source/Engine/Graphics/Materials/MaterialShaderFeatures.cpp # Source/Engine/Renderer/RenderList.h # Source/Shaders/Reflections.shader # Source/Shaders/ReflectionsCommon.hlsl # Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs
This commit is contained in:
@@ -683,6 +683,8 @@ BinaryModule* BinaryModule::GetModule(const StringAnsiView& name)
|
||||
|
||||
BinaryModule::BinaryModule()
|
||||
{
|
||||
CanReload = USE_EDITOR;
|
||||
|
||||
// Register
|
||||
GetModules().Add(this);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,11 @@ public:
|
||||
/// </summary>
|
||||
Dictionary<StringAnsi, int32> TypeNameToTypeIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Determinates whether module can be hot-reloaded at runtime. For example, in Editor after scripts recompilation. Some modules such as engine and class library modules are static.
|
||||
/// </summary>
|
||||
bool CanReload;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
|
||||
int32 _isLoaded : 1;
|
||||
int32 _isLoading : 1;
|
||||
int32 _canReload : 1;
|
||||
mutable int32 _hasCachedClasses : 1;
|
||||
|
||||
mutable ClassesDictionary _classes;
|
||||
@@ -125,6 +126,14 @@ public:
|
||||
return _isLoaded != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if assembly can be hot-reloaded at runtime. For example, in Editor after scripts recompilation. Some assemblies such as engine and class library modules are static.
|
||||
/// </summary>
|
||||
FORCE_INLINE bool CanReload() const
|
||||
{
|
||||
return USE_EDITOR && _canReload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assembly name.
|
||||
/// </summary>
|
||||
|
||||
@@ -45,6 +45,7 @@ MAssembly::MAssembly(MDomain* domain, const StringAnsiView& name)
|
||||
: _domain(domain)
|
||||
, _isLoaded(false)
|
||||
, _isLoading(false)
|
||||
, _canReload(true)
|
||||
, _hasCachedClasses(false)
|
||||
, _reloadCount(0)
|
||||
, _name(name)
|
||||
@@ -59,6 +60,7 @@ MAssembly::MAssembly(MDomain* domain, const StringAnsiView& name, const StringAn
|
||||
, _domain(domain)
|
||||
, _isLoaded(false)
|
||||
, _isLoading(false)
|
||||
, _canReload(true)
|
||||
, _hasCachedClasses(false)
|
||||
, _reloadCount(0)
|
||||
, _name(name)
|
||||
|
||||
@@ -874,6 +874,7 @@ bool MAssembly::LoadCorlib()
|
||||
return true;
|
||||
}
|
||||
_hasCachedClasses = false;
|
||||
_canReload = false;
|
||||
CachedAssemblyHandles.Add(_handle, this);
|
||||
|
||||
// End
|
||||
|
||||
@@ -502,6 +502,7 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
|
||||
// C#
|
||||
if (managedPath.HasChars() && !((ManagedBinaryModule*)module)->Assembly->IsLoaded())
|
||||
{
|
||||
(((ManagedBinaryModule*)module)->Assembly)->_canReload = module->CanReload;
|
||||
if (((ManagedBinaryModule*)module)->Assembly->Load(managedPath, nativePath))
|
||||
{
|
||||
LOG(Error, "Failed to load C# assembly '{0}' for binary module {1}.", managedPath, name);
|
||||
@@ -528,6 +529,7 @@ bool Scripting::Load()
|
||||
#if USE_CSHARP
|
||||
// Load C# core assembly
|
||||
ManagedBinaryModule* corlib = GetBinaryModuleCorlib();
|
||||
corlib->CanReload = false;
|
||||
if (corlib->Assembly->LoadCorlib())
|
||||
{
|
||||
LOG(Error, "Failed to load corlib C# assembly.");
|
||||
@@ -581,6 +583,8 @@ bool Scripting::Load()
|
||||
LOG(Error, "Failed to load FlaxEngine C# assembly.");
|
||||
return true;
|
||||
}
|
||||
flaxEngineModule->CanReload = false;
|
||||
flaxEngineModule->Assembly->_canReload = false;
|
||||
onEngineLoaded(flaxEngineModule->Assembly);
|
||||
|
||||
// Insert type aliases for vector types that don't exist in C++ but are just typedef (properly redirect them to actual types)
|
||||
|
||||
Reference in New Issue
Block a user