GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Protected Member Functions | List of all members
gd::CustomBehavior Class Reference

A gd::Behavior that stores its content in JSON. More...

#include <CustomBehavior.h>

Inherits gd::Behavior.

Public Member Functions

 CustomBehavior (const gd::String &name, const Project &project_, const gd::String &fullType)
 
CustomBehaviorClone () const override
 
- Public Member Functions inherited from gd::Behavior
 Behavior (const gd::String &name_, const gd::String &type_)
 
bool IsDefaultBehavior () const
 
void SetDefaultBehavior (bool isDefaultBehavior_)
 
- Public Member Functions inherited from gd::BehaviorConfigurationContainer
 BehaviorConfigurationContainer (const gd::String &name_, const gd::String &type_)
 
const gd::StringGetName () const
 Return the name identifying the behavior.
 
void SetName (const gd::String &name_)
 Change the name identifying the behavior.
 
const gd::StringGetTypeName () const
 Return the type of the behavior.
 
void SetTypeName (const gd::String &type_)
 Set the type of the behavior.
 
std::map< gd::String, gd::PropertyDescriptorGetProperties () const
 Called when the IDE wants to know about the custom properties of the behavior. More...
 
bool UpdateProperty (const gd::String &name, const gd::String &value)
 Called when the IDE wants to update a custom property of the behavior. More...
 
virtual void InitializeContent ()
 Called to initialize the content with the default properties for the behavior.
 
virtual void SerializeTo (gd::SerializerElement &element) const
 Serialize the behavior content.
 
virtual void UnserializeFrom (const gd::SerializerElement &element)
 Unserialize the behavior content.
 
const gd::SerializerElementGetContent () const
 
gd::SerializerElementGetContent ()
 
void SetFolded (bool fold=true)
 Set if the behavior configuration panel should be folded in the UI.
 
bool IsFolded () const
 True if the behavior configuration panel should be folded in the UI.
 
void SetQuickCustomizationVisibility (QuickCustomization::Visibility visibility)
 Set if the whole behavior should be visible or not in the Quick Customization.
 
QuickCustomization::Visibility GetQuickCustomizationVisibility () const
 Get if the whole behavior should be visible or not in the Quick Customization.
 
QuickCustomizationVisibilitiesContainerGetPropertiesQuickCustomizationVisibilities ()
 Get the map of properties and their visibility in the Quick Customization.
 
const QuickCustomizationVisibilitiesContainerGetPropertiesQuickCustomizationVisibilities () const
 Get the map of properties and their visibility in the Quick Customization.
 
void ExposeResources (gd::ArbitraryResourceWorker &worker)
 Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example: More...
 

Protected Member Functions

std::map< gd::String, gd::PropertyDescriptorGetProperties (const gd::SerializerElement &behaviorContent) const override
 Called when the IDE wants to know about the custom properties of the behavior. More...
 
bool UpdateProperty (gd::SerializerElement &behaviorContent, const gd::String &name, const gd::String &value) override
 Called when the IDE wants to update a custom property of the behavior. More...
 
void InitializeContent (gd::SerializerElement &behaviorContent) override
 Called to initialize the content with the default properties for the behavior.
 

Detailed Description

A gd::Behavior that stores its content in JSON.

Member Function Documentation

◆ GetProperties()

std::map< gd::String, gd::PropertyDescriptor > CustomBehavior::GetProperties ( const gd::SerializerElement behaviorContent) const
overrideprotectedvirtual

Called when the IDE wants to know about the custom properties of the behavior.

Implementation example:

std::map<gd::String, gd::PropertyDescriptor> properties;
properties[_("Initial speed")].SetValue(gd::String::From(initialSpeed));
return properties;
static String From(T value)
Method to create a gd::String from a number (float, double, int, ...)
Definition: String.h:221
Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

Reimplemented from gd::BehaviorConfigurationContainer.

◆ UpdateProperty()

bool CustomBehavior::UpdateProperty ( gd::SerializerElement behaviorContent,
const gd::String name,
const gd::String value 
)
overrideprotectedvirtual

Called when the IDE wants to update a custom property of the behavior.

Returns
false if the new value cannot be set
See also
gd::InitialInstance

Reimplemented from gd::BehaviorConfigurationContainer.


The documentation for this class was generated from the following files: