|
|
@@ -11,83 +11,64 @@ namespace BansheeEngine
|
|
|
struct ComponentBackupData;
|
|
|
|
|
|
/**
|
|
|
- * @brief Component that internally wraps a managed component object
|
|
|
- * that can be of user-defined type. Acts as interop interop layer
|
|
|
- * between native Component and a managed user defined component type
|
|
|
- * since managed types cannot simply derive from Component
|
|
|
- * to implement its functionality.
|
|
|
+ * Component that internally wraps a managed component object that can be of user-defined type. Acts as interop interop
|
|
|
+ * layer between native Component and a managed user defined component type since managed types cannot simply derive
|
|
|
+ * from Component to implement its functionality.
|
|
|
*/
|
|
|
class BS_SCR_BE_EXPORT ManagedComponent : public Component
|
|
|
{
|
|
|
public:
|
|
|
~ManagedComponent();
|
|
|
|
|
|
- /**
|
|
|
- * @brief Returns managed component object instance.
|
|
|
- */
|
|
|
+ /** Returns managed component object instance. */
|
|
|
MonoObject* getManagedInstance() const { return mManagedInstance; }
|
|
|
|
|
|
- /**
|
|
|
- * @brief Returns managed type of the component.
|
|
|
- */
|
|
|
+ /** Returns managed type of the component. */
|
|
|
MonoReflectionType* getRuntimeType() const { return mRuntimeType; }
|
|
|
|
|
|
- /**
|
|
|
- * @brief Returns namespace of the managed component.
|
|
|
- */
|
|
|
+ /** Returns namespace of the managed component. */
|
|
|
const String& getManagedNamespace() const { return mNamespace; }
|
|
|
|
|
|
- /**
|
|
|
- * @brief Returns type name of the managed component.
|
|
|
- */
|
|
|
+ /** Returns type name of the managed component. */
|
|
|
const String& getManagedTypeName() const { return mTypeName; }
|
|
|
|
|
|
- /**
|
|
|
- * @brief Returns namespace and type name of the component in format "namespace.typename".
|
|
|
- */
|
|
|
+ /** Returns namespace and type name of the component in format "namespace.typename". */
|
|
|
const String& getManagedFullTypeName() const { return mFullTypeName; }
|
|
|
|
|
|
/**
|
|
|
- * @brief Serializes the internal managed component.
|
|
|
+ * Serializes the internal managed component.
|
|
|
*
|
|
|
- * @param clearExisting Should the managed component handle be released. (Will trigger a finalizer
|
|
|
- * if this is the last reference to it)
|
|
|
- *
|
|
|
- * @return An object containing the serialized component. You can provide this to ::restore
|
|
|
- * method to re-create the original component.
|
|
|
+ * @param[in] clearExisting Should the managed component handle be released. (Will trigger a finalizer if this
|
|
|
+ * is the last reference to it)
|
|
|
+ * @return An object containing the serialized component. You can provide this to restore()
|
|
|
+ * method to re-create the original component.
|
|
|
*/
|
|
|
ComponentBackupData backup(bool clearExisting = true);
|
|
|
|
|
|
/**
|
|
|
- * @brief Restores a component from previously serialized data.
|
|
|
+ * Restores a component from previously serialized data.
|
|
|
*
|
|
|
- * @param instance New instance of the managed component. Must be of the valid component type
|
|
|
- * or of BansheeEngine.MissingComponent type if the original type is missing.
|
|
|
- * @param data Serialized managed component data that will be used for initializing
|
|
|
- * the new managed instance.
|
|
|
- * @param missingType Is the component's type missing (can happen after assembly reload).
|
|
|
- * If true then the serialized data will be stored internally until later
|
|
|
- * date when user perhaps restores the type with another refresh.
|
|
|
- * \p instance must be null if this is true.
|
|
|
+ * @param[in] instance New instance of the managed component. Must be of the valid component type or of
|
|
|
+ * BansheeEngine.MissingComponent type if the original type is missing.
|
|
|
+ * @param[in] data Serialized managed component data that will be used for initializing the new managed
|
|
|
+ * instance.
|
|
|
+ * @param[in] missingType Is the component's type missing (can happen after assembly reload). If true then the
|
|
|
+ * serialized data will be stored internally until later date when user perhaps restores
|
|
|
+ * the type with another refresh. @p instance must be null if this is true.
|
|
|
*/
|
|
|
void restore(MonoObject* instance, const ComponentBackupData& data, bool missingType);
|
|
|
|
|
|
- /**
|
|
|
- * @brief Triggers the managed OnInitialize callback.
|
|
|
- */
|
|
|
+ /** Triggers the managed OnInitialize callback. */
|
|
|
void triggerOnInitialize();
|
|
|
|
|
|
- /**
|
|
|
- * @brief Triggers the managed OnReset callback.
|
|
|
- */
|
|
|
+ /** Triggers the managed OnReset callback. */
|
|
|
void triggerOnReset();
|
|
|
|
|
|
private:
|
|
|
/**
|
|
|
- * @brief Finalizes construction of the object. Must be called before use or when
|
|
|
- * the managed component instance changes.
|
|
|
+ * Finalizes construction of the object. Must be called before use or when the managed component instance changes.
|
|
|
*
|
|
|
- * @param object Managed component instance.
|
|
|
+ * @param[in] object Managed component instance.
|
|
|
*/
|
|
|
void initialize(MonoObject* object);
|
|
|
|
|
|
@@ -97,6 +78,7 @@ namespace BansheeEngine
|
|
|
typedef void(__stdcall *OnResetThunkDef) (MonoObject*, MonoException**);
|
|
|
typedef void(__stdcall *OnEnabledThunkDef) (MonoObject*, MonoException**);
|
|
|
typedef void(__stdcall *OnDisabledThunkDef) (MonoObject*, MonoException**);
|
|
|
+ typedef void(__stdcall *OnTransformChangedThunkDef) (MonoObject*, TransformChangedFlags, MonoException**);
|
|
|
|
|
|
MonoObject* mManagedInstance;
|
|
|
MonoReflectionType* mRuntimeType;
|
|
|
@@ -118,6 +100,7 @@ namespace BansheeEngine
|
|
|
OnDestroyedThunkDef mOnDestroyThunk;
|
|
|
OnDestroyedThunkDef mOnDisabledThunk;
|
|
|
OnDestroyedThunkDef mOnEnabledThunk;
|
|
|
+ OnTransformChangedThunkDef mOnTransformChangedThunk;
|
|
|
MonoMethod* mCalculateBoundsMethod;
|
|
|
|
|
|
/************************************************************************/
|
|
|
@@ -130,45 +113,32 @@ namespace BansheeEngine
|
|
|
|
|
|
ManagedComponent(const HSceneObject& parent, MonoReflectionType* runtimeType);
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::instantiate
|
|
|
- */
|
|
|
+ /** @copydoc Component::instantiate */
|
|
|
void instantiate() override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::onInitialized
|
|
|
- */
|
|
|
+ /** @copydoc Component::onInitialized */
|
|
|
void onInitialized() override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::onDestroyed
|
|
|
- */
|
|
|
+ /** @copydoc Component::onDestroyed */
|
|
|
void onDestroyed() override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::onEnabled
|
|
|
- */
|
|
|
+ /** @copydoc Component::onEnabled */
|
|
|
void onEnabled() override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::onDisabled
|
|
|
- */
|
|
|
+ /** @copydoc Component::onDisabled */
|
|
|
void onDisabled() override;
|
|
|
|
|
|
+ /** @copydoc Component::onTransformChanged */
|
|
|
+ void onTransformChanged(TransformChangedFlags flags) override;
|
|
|
+
|
|
|
public:
|
|
|
- /**
|
|
|
- * @copydoc Component::update
|
|
|
- */
|
|
|
+ /** @copydoc Component::update */
|
|
|
void update() override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::typeEquals
|
|
|
- */
|
|
|
+ /** @copydoc Component::typeEquals */
|
|
|
bool typeEquals(const Component& other) override;
|
|
|
|
|
|
- /**
|
|
|
- * @copydoc Component::calculateBounds
|
|
|
- */
|
|
|
+ /** @copydoc Component::calculateBounds */
|
|
|
bool calculateBounds(Bounds& bounds) override;
|
|
|
|
|
|
/************************************************************************/
|
|
|
@@ -183,9 +153,7 @@ namespace BansheeEngine
|
|
|
ManagedComponent(); // Serialization only
|
|
|
};
|
|
|
|
|
|
- /**
|
|
|
- * @brief Contains serialized component data buffer.
|
|
|
- */
|
|
|
+ /** Contains serialized component data buffer. */
|
|
|
struct ComponentBackupData
|
|
|
{
|
|
|
UINT8* data;
|