|
@@ -6,8 +6,17 @@
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Renders, updates and manipulates handles declared in managed code.
|
|
|
|
|
+ * Managed code handles have a [CustomHandle] attribute and must implement
|
|
|
|
|
+ * BansheeEditor.Handle.
|
|
|
|
|
+ */
|
|
|
class BS_SCR_BED_EXPORT ScriptHandleManager : public HandleManager
|
|
class BS_SCR_BED_EXPORT ScriptHandleManager : public HandleManager
|
|
|
{
|
|
{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Contains data about a manage type that draws and handles
|
|
|
|
|
+ * interaction with a custom handle.
|
|
|
|
|
+ */
|
|
|
struct CustomHandleData
|
|
struct CustomHandleData
|
|
|
{
|
|
{
|
|
|
MonoClass* handleType;
|
|
MonoClass* handleType;
|
|
@@ -15,12 +24,23 @@ namespace BansheeEngine
|
|
|
MonoMethod* ctor;
|
|
MonoMethod* ctor;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Data about an active instance of a managed custom handle object.
|
|
|
|
|
+ * Active handle means its scene object is currently selected and the
|
|
|
|
|
+ * handle is displayed and can be interacted with.
|
|
|
|
|
+ */
|
|
|
struct ActiveCustomHandleData
|
|
struct ActiveCustomHandleData
|
|
|
{
|
|
{
|
|
|
MonoObject* object;
|
|
MonoObject* object;
|
|
|
uint32_t gcHandle;
|
|
uint32_t gcHandle;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Data about all active managed custom handle objects
|
|
|
|
|
+ * for a specific scene object. Active handle means its
|
|
|
|
|
+ * scene object is currently selected and the handle is displayed
|
|
|
|
|
+ * and can be interacted with.
|
|
|
|
|
+ */
|
|
|
struct ActiveCustomHandles
|
|
struct ActiveCustomHandles
|
|
|
{
|
|
{
|
|
|
HSceneObject selectedObject;
|
|
HSceneObject selectedObject;
|
|
@@ -32,16 +52,64 @@ namespace BansheeEngine
|
|
|
~ScriptHandleManager();
|
|
~ScriptHandleManager();
|
|
|
|
|
|
|
|
protected:
|
|
protected:
|
|
|
- void refreshHandles();
|
|
|
|
|
- void triggerHandles();
|
|
|
|
|
- void queueDrawCommands();
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc HandleManager::refreshHandles
|
|
|
|
|
+ */
|
|
|
|
|
+ void refreshHandles() override;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc HandleManager::triggerHandles
|
|
|
|
|
+ */
|
|
|
|
|
+ void triggerHandles() override;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @copydoc HandleManager::queueDrawCommands
|
|
|
|
|
+ */
|
|
|
|
|
+ void queueDrawCommands() override;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Reloads internal managed assembly types and finds all custom handle classes.
|
|
|
|
|
+ * Must be called after construction and after assembly reload.
|
|
|
|
|
+ */
|
|
|
void reloadAssemblyData();
|
|
void reloadAssemblyData();
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Checks is the provided type a valid custom handle class. Custom handles
|
|
|
|
|
+ * must have a [CustomHandle] attribute and must implement BansheeEditor.Handle.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param type Type to check.
|
|
|
|
|
+ * @param componentType Component type for which the handle should be displayed for. Handle will not
|
|
|
|
|
+ * be displayed unless a component of this type is selected. Only valid if method returns true.
|
|
|
|
|
+ * @param ctor Constructor method for the handle type. Only valid if method returns true.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return True if the type is a valid custom handle type.
|
|
|
|
|
+ */
|
|
|
bool isValidHandleType(MonoClass* type, MonoClass*& componentType, MonoMethod*& ctor);
|
|
bool isValidHandleType(MonoClass* type, MonoClass*& componentType, MonoMethod*& ctor);
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Triggers the PreInput method on the provided Handle object. Pre
|
|
|
|
|
+ * input happens before any handles are selected or moved and allows you
|
|
|
|
|
+ * to position the handles or prepare them in some other way.
|
|
|
|
|
+ */
|
|
|
void callPreInput(MonoObject* instance);
|
|
void callPreInput(MonoObject* instance);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Triggers the PostInput method on the provided Handle object.
|
|
|
|
|
+ * Post input happens after we know in what way has the user interacted
|
|
|
|
|
+ * with the handles this frame.
|
|
|
|
|
+ */
|
|
|
void callPostInput(MonoObject* instance);
|
|
void callPostInput(MonoObject* instance);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Triggers the Draw method on the provided Handle object. Draw allows
|
|
|
|
|
+ * you to draw the visual representation of the handles. Called after PostInput.
|
|
|
|
|
+ */
|
|
|
void callDraw(MonoObject* instance);
|
|
void callDraw(MonoObject* instance);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief Triggers the Destroy method on the provided Handle object. Destroy
|
|
|
|
|
+ * is called when the handle is no longer being displayed.
|
|
|
|
|
+ */
|
|
|
void callDestroy(MonoObject* instance);
|
|
void callDestroy(MonoObject* instance);
|
|
|
|
|
|
|
|
ScriptAssemblyManager& mScriptObjectManager;
|
|
ScriptAssemblyManager& mScriptObjectManager;
|