diff --git a/Source/Engine/Animations/Animations.cpp b/Source/Engine/Animations/Animations.cpp index 1366e18cf..21235daa5 100644 --- a/Source/Engine/Animations/Animations.cpp +++ b/Source/Engine/Animations/Animations.cpp @@ -35,7 +35,7 @@ public: namespace { - FORCE_INLINE bool CanUpdateModel(AnimatedModel* animatedModel) + FORCE_INLINE bool CanUpdateModel(const AnimatedModel* animatedModel) { auto skinnedModel = animatedModel->SkinnedModel.Get(); auto animGraph = animatedModel->AnimationGraph.Get(); diff --git a/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp b/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp index 5d75b676c..b3e7a6e27 100644 --- a/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp +++ b/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp @@ -35,7 +35,7 @@ const BytesContainer& SceneAnimation::LoadTimeline() #if USE_EDITOR -bool SceneAnimation::SaveTimeline(BytesContainer& data) +bool SceneAnimation::SaveTimeline(const BytesContainer& data) { // Wait for asset to be loaded or don't if last load failed (eg. by shader source compilation error) if (LastLoadFailed()) diff --git a/Source/Engine/Animations/SceneAnimations/SceneAnimation.h b/Source/Engine/Animations/SceneAnimations/SceneAnimation.h index f6beeb416..e08f0c38c 100644 --- a/Source/Engine/Animations/SceneAnimations/SceneAnimation.h +++ b/Source/Engine/Animations/SceneAnimations/SceneAnimation.h @@ -454,10 +454,10 @@ public: /// /// Saves the serialized timeline data to the asset. /// - /// The cannot be used by virtual assets. + /// It cannot be used by virtual assets. /// The timeline data container. /// true failed to save data; otherwise, false. - API_FUNCTION() bool SaveTimeline(BytesContainer& data); + API_FUNCTION() bool SaveTimeline(const BytesContainer& data); #endif diff --git a/Source/Engine/Content/Assets/Material.cpp b/Source/Engine/Content/Assets/Material.cpp index 9a3f7bace..ad373d660 100644 --- a/Source/Engine/Content/Assets/Material.cpp +++ b/Source/Engine/Content/Assets/Material.cpp @@ -550,7 +550,7 @@ BytesContainer Material::LoadSurface(bool createDefaultIfMissing) #if USE_EDITOR -bool Material::SaveSurface(BytesContainer& data, const MaterialInfo& info) +bool Material::SaveSurface(const BytesContainer& data, const MaterialInfo& info) { // Wait for asset to be loaded or don't if last load failed (eg. by shader source compilation error) if (LastLoadFailed()) diff --git a/Source/Engine/Content/Assets/Material.h b/Source/Engine/Content/Assets/Material.h index 569c86d93..e8f398e3d 100644 --- a/Source/Engine/Content/Assets/Material.h +++ b/Source/Engine/Content/Assets/Material.h @@ -32,7 +32,7 @@ public: /// The surface graph data. /// The material info structure. /// True if cannot save it, otherwise false. - API_FUNCTION() bool SaveSurface(BytesContainer& data, const MaterialInfo& info); + API_FUNCTION() bool SaveSurface(const BytesContainer& data, const MaterialInfo& info); #endif diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 39fae81db..fa4517911 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -403,7 +403,7 @@ ContentStats Content::GetStats() return stats; } -Asset* Content::LoadAsyncInternal(const StringView& internalPath, MClass* type) +Asset* Content::LoadAsyncInternal(const StringView& internalPath, const MClass* type) { CHECK_RETURN(type, nullptr); const auto scriptingType = Scripting::FindScriptingType(type->GetFullName()); @@ -445,7 +445,7 @@ FLAXENGINE_API Asset* LoadAsset(const Guid& id, const ScriptingTypeHandle& type) return Content::LoadAsync(id, type); } -Asset* Content::LoadAsync(const StringView& path, MClass* type) +Asset* Content::LoadAsync(const StringView& path, const MClass* type) { CHECK_RETURN(type, nullptr); const auto scriptingType = Scripting::FindScriptingType(type->GetFullName()); @@ -832,7 +832,7 @@ void Content::UnloadAsset(Asset* asset) asset->DeleteObject(); } -Asset* Content::CreateVirtualAsset(MClass* type) +Asset* Content::CreateVirtualAsset(const MClass* type) { CHECK_RETURN(type, nullptr); const auto scriptingType = Scripting::FindScriptingType(type->GetFullName()); diff --git a/Source/Engine/Content/Content.h b/Source/Engine/Content/Content.h index 56363dd43..5697c17b0 100644 --- a/Source/Engine/Content/Content.h +++ b/Source/Engine/Content/Content.h @@ -164,7 +164,7 @@ public: /// The path of the asset (absolute or relative to the current workspace directory). /// The asset type. If loaded object has different type (excluding types derived from the given) the loading fails. /// Loaded asset or null if cannot - API_FUNCTION(Attributes="HideInEditor") static Asset* LoadAsync(const StringView& path, MClass* type); + API_FUNCTION(Attributes="HideInEditor") static Asset* LoadAsync(const StringView& path, const MClass* type); /// /// Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async. @@ -192,7 +192,7 @@ public: /// The path of the asset relative to the engine internal content (excluding the extension). /// The asset type. If loaded object has different type (excluding types derived from the given) the loading fails. /// The loaded asset or null if failed. - API_FUNCTION(Attributes="HideInEditor") static Asset* LoadAsyncInternal(const StringView& internalPath, MClass* type); + API_FUNCTION(Attributes="HideInEditor") static Asset* LoadAsyncInternal(const StringView& internalPath, const MClass* type); /// /// Loads internal engine asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async. @@ -342,7 +342,7 @@ public: /// /// The asset type klass. /// Created asset or null if failed. - API_FUNCTION() static Asset* CreateVirtualAsset(API_PARAM(Attributes="TypeReference(typeof(Asset))") MClass* type); + API_FUNCTION() static Asset* CreateVirtualAsset(API_PARAM(Attributes="TypeReference(typeof(Asset))") const MClass* type); /// /// Creates temporary and virtual asset of the given type. diff --git a/Source/Engine/Content/Storage/FlaxStorage.h b/Source/Engine/Content/Storage/FlaxStorage.h index cc04e24a6..3b982c32e 100644 --- a/Source/Engine/Content/Storage/FlaxStorage.h +++ b/Source/Engine/Content/Storage/FlaxStorage.h @@ -440,7 +440,7 @@ public: /// In silent mode don't reload opened storage container that is using target file. /// Custom options. /// True if cannot create package, otherwise false - FORCE_INLINE static bool Create(const StringView& path, AssetInitData& data, bool silentMode = false, const CustomData* customData = nullptr) + FORCE_INLINE static bool Create(const StringView& path, const AssetInitData& data, bool silentMode = false, const CustomData* customData = nullptr) { return Create(path, &data, 1, silentMode, customData); } diff --git a/Source/Engine/Core/Math/Matrix.cpp b/Source/Engine/Core/Math/Matrix.cpp index 8445bd84a..028cc70b0 100644 --- a/Source/Engine/Core/Math/Matrix.cpp +++ b/Source/Engine/Core/Math/Matrix.cpp @@ -773,7 +773,7 @@ void Matrix::Transformation(const Float3& scalingCenter, const Quaternion& scali result = Translation(-scalingCenter) * Transpose(sr) * Scaling(scaling) * sr * Translation(scalingCenter) * Translation(-rotationCenter) * RotationQuaternion(rotation) * Translation(rotationCenter) * Translation(translation); } -void Matrix::Transformation2D(Float2& scalingCenter, float scalingRotation, const Float2& scaling, const Float2& rotationCenter, float rotation, const Float2& translation, Matrix& result) +void Matrix::Transformation2D(const Float2& scalingCenter, float scalingRotation, const Float2& scaling, const Float2& rotationCenter, float rotation, const Float2& translation, Matrix& result) { result = Translation((Float3)-scalingCenter) * RotationZ(-scalingRotation) * Scaling((Float3)scaling) * RotationZ(scalingRotation) * Translation((Float3)scalingCenter) * Translation((Float3)-rotationCenter) * RotationZ(rotation) * Translation((Float3)rotationCenter) * Translation((Float3)translation); result.M33 = 1.0f; diff --git a/Source/Engine/Core/Math/Matrix.h b/Source/Engine/Core/Math/Matrix.h index 0a76a98d1..087d9602c 100644 --- a/Source/Engine/Core/Math/Matrix.h +++ b/Source/Engine/Core/Math/Matrix.h @@ -941,7 +941,7 @@ public: // @param rotation The rotation of the transformation. // @param translation The translation factor of the transformation. // @param result When the method completes, contains the created transformation matrix. - static void Transformation2D(Float2& scalingCenter, float scalingRotation, const Float2& scaling, const Float2& rotationCenter, float rotation, const Float2& translation, Matrix& result); + static void Transformation2D(const Float2& scalingCenter, float scalingRotation, const Float2& scaling, const Float2& rotationCenter, float rotation, const Float2& translation, Matrix& result); // Creates a world matrix with the specified parameters. // @param position Position of the object. This value is used in translation operations. diff --git a/Source/Engine/Core/Math/Rectangle.cpp b/Source/Engine/Core/Math/Rectangle.cpp index 53d56678b..b4d832288 100644 --- a/Source/Engine/Core/Math/Rectangle.cpp +++ b/Source/Engine/Core/Math/Rectangle.cpp @@ -99,7 +99,7 @@ Rectangle Rectangle::FromPoints(const Float2& p1, const Float2& p2) return Rectangle(upperLeft, Math::Max(rightBottom - upperLeft, Float2::Zero)); } -Rectangle Rectangle::FromPoints(Float2* points, int32 pointsCount) +Rectangle Rectangle::FromPoints(const Float2* points, int32 pointsCount) { ASSERT(pointsCount > 0); Float2 upperLeft = points[0]; diff --git a/Source/Engine/Core/Math/Rectangle.h b/Source/Engine/Core/Math/Rectangle.h index 496b8bb8a..6a41fbe0f 100644 --- a/Source/Engine/Core/Math/Rectangle.h +++ b/Source/Engine/Core/Math/Rectangle.h @@ -287,7 +287,7 @@ public: // @returns Rectangle that contains both p1 and p2 static Rectangle FromPoints(const Float2& p1, const Float2& p2); - static Rectangle FromPoints(Float2* points, int32 pointsCount); + static Rectangle FromPoints(const Float2* points, int32 pointsCount); }; template<> diff --git a/Source/Engine/Core/Types/DataContainer.h b/Source/Engine/Core/Types/DataContainer.h index 500041d1c..6ad6f75c9 100644 --- a/Source/Engine/Core/Types/DataContainer.h +++ b/Source/Engine/Core/Types/DataContainer.h @@ -320,7 +320,7 @@ public: /// /// The data. /// The length. - void Append(T* data, int32 length) + void Append(const T* data, int32 length) { if (length <= 0) return; diff --git a/Source/Engine/Core/Types/Variant.cpp b/Source/Engine/Core/Types/Variant.cpp index f30662f86..7061567f7 100644 --- a/Source/Engine/Core/Types/Variant.cpp +++ b/Source/Engine/Core/Types/Variant.cpp @@ -112,7 +112,7 @@ VariantType::VariantType(Types type, const StringAnsiView& typeName) } } -VariantType::VariantType(Types type, MClass* klass) +VariantType::VariantType(Types type, const MClass* klass) { Type = type; TypeName = nullptr; diff --git a/Source/Engine/Core/Types/Variant.h b/Source/Engine/Core/Types/Variant.h index 80205cd36..fa7f748fe 100644 --- a/Source/Engine/Core/Types/Variant.h +++ b/Source/Engine/Core/Types/Variant.h @@ -105,7 +105,7 @@ public: explicit VariantType(Types type, const StringView& typeName); explicit VariantType(Types type, const StringAnsiView& typeName); - explicit VariantType(Types type, MClass* klass); + explicit VariantType(Types type, const MClass* klass); explicit VariantType(const StringAnsiView& typeName); VariantType(const VariantType& other); VariantType(VariantType&& other) noexcept; diff --git a/Source/Engine/Scripting/Scripting.cpp b/Source/Engine/Scripting/Scripting.cpp index 23ac2a935..279e4d986 100644 --- a/Source/Engine/Scripting/Scripting.cpp +++ b/Source/Engine/Scripting/Scripting.cpp @@ -840,7 +840,7 @@ void ScriptingObjectReferenceBase::OnDeleted(ScriptingObject* obj) } } -ScriptingObject* Scripting::FindObject(Guid id, MClass* type) +ScriptingObject* Scripting::FindObject(Guid id, const MClass* type) { if (!id.IsValid()) return nullptr; @@ -894,7 +894,7 @@ ScriptingObject* Scripting::FindObject(Guid id, MClass* type) return nullptr; } -ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type) +ScriptingObject* Scripting::TryFindObject(Guid id, const MClass* type) { if (!id.IsValid()) return nullptr; @@ -930,7 +930,7 @@ ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type) return result; } -ScriptingObject* Scripting::TryFindObject(MClass* type) +ScriptingObject* Scripting::TryFindObject(const MClass* type) { if (type == nullptr) return nullptr; @@ -1000,7 +1000,7 @@ bool Scripting::IsEveryAssemblyLoaded() return true; } -bool Scripting::IsTypeFromGameScripts(MClass* type) +bool Scripting::IsTypeFromGameScripts(const MClass* type) { const auto binaryModule = ManagedBinaryModule::GetModule(type ? type->GetAssembly() : nullptr); return binaryModule && binaryModule != GetBinaryModuleCorlib() && binaryModule != GetBinaryModuleFlaxEngine(); diff --git a/Source/Engine/Scripting/Scripting.h b/Source/Engine/Scripting/Scripting.h index 41b0cbf4d..d9f2c5b4d 100644 --- a/Source/Engine/Scripting/Scripting.h +++ b/Source/Engine/Scripting/Scripting.h @@ -133,14 +133,14 @@ public: /// The object unique identifier. /// The type of the object to find (optional). /// The found object or null if missing. - static ScriptingObject* FindObject(Guid id, MClass* type = nullptr); + static ScriptingObject* FindObject(Guid id, const MClass* type = nullptr); /// /// Tries to find the object by the given class. /// /// The type of the object to find. /// The found object or null if missing. - static ScriptingObject* TryFindObject(MClass* type); + static ScriptingObject* TryFindObject(const MClass* type); /// /// Tries to find the object by the given identifier. @@ -159,7 +159,7 @@ public: /// The object unique identifier. /// The type of the object to find (optional). /// The found object or null if missing. - static ScriptingObject* TryFindObject(Guid id, MClass* type = nullptr); + static ScriptingObject* TryFindObject(Guid id, const MClass* type = nullptr); /// /// Finds the object by the given managed instance handle. Searches only registered scene objects. @@ -189,7 +189,7 @@ public: /// /// Returns true if given type is from one of the game scripts assemblies. /// - static bool IsTypeFromGameScripts(MClass* type); + static bool IsTypeFromGameScripts(const MClass* type); static void ProcessBuildInfoPath(String& path, const String& projectFolderPath);