Refactor Plugins system to support plugins in C++ scripts

This commit is contained in:
Wojtek Figat
2022-07-28 21:05:03 +02:00
parent 6f35b27c29
commit bdb69d57dd
23 changed files with 522 additions and 485 deletions

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#pragma once
#include "PluginDescription.h"
#include "Engine/Scripting/ScriptingObject.h"
/// <summary>
/// Base class for game engine editor plugins.
/// </summary>
API_CLASS(Abstract) class FLAXENGINE_API Plugin : public ScriptingObject
{
DECLARE_SCRIPTING_TYPE(Plugin);
private:
friend class PluginManagerService;
bool _initialized = false;
protected:
/// <remarks>
/// Plugin description. Should be a constant part of the plugin created in constructor and valid before calling <see cref="Initialize"/>.
/// </remarks>
API_FIELD() PluginDescription _description;
public:
/// <summary>
/// Gets the description.
/// </summary>
API_PROPERTY() const PluginDescription& GetDescription() const
{
return _description;
}
/// <summary>
/// Initialization method called when this plugin is loaded to the memory and can be used.
/// </summary>
API_FUNCTION() virtual void Initialize()
{
}
/// <summary>
/// Cleanup method called when this plugin is being unloaded or reloaded or engine is closing.
/// </summary>
API_FUNCTION() virtual void Deinitialize()
{
}
};