GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Public Attributes | List of all members

Contains user-friendly information about a behavior type. More...

#include <BehaviorMetadata.h>

Inherits gd::InstructionOrExpressionContainerMetadata.

Public Member Functions

 BehaviorMetadata (const gd::String &extensionNamespace, const gd::String &nameWithNamespace, const gd::String &fullname_, const gd::String &defaultName_, const gd::String &description_, const gd::String &group_, const gd::String &icon24x24_, const gd::String &className_, std::shared_ptr< gd::Behavior > instance, std::shared_ptr< gd::BehaviorsSharedData > sharedDatasInstance)
 
 BehaviorMetadata (const gd::String &extensionNamespace, const gd::String &nameWithNamespace, const gd::String &fullname_, const gd::String &defaultName_, const gd::String &description_, const gd::String &group_, const gd::String &icon24x24_)
 Construct a behavior metadata, without "blueprint" behavior. More...
 
gd::InstructionMetadataAddCondition (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_) override
 
gd::InstructionMetadataAddAction (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_) override
 
gd::InstructionMetadataAddScopedCondition (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_) override
 
gd::InstructionMetadataAddScopedAction (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &sentence_, const gd::String &group_, const gd::String &icon_, const gd::String &smallicon_) override
 
gd::ExpressionMetadataAddExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_) override
 
gd::ExpressionMetadataAddStrExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_) override
 
gd::MultipleInstructionMetadata AddExpressionAndCondition (const gd::String &type, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &sentenceName, const gd::String &group, const gd::String &icon) override
 Declare a new expression and condition as being part of the behavior. More...
 
gd::MultipleInstructionMetadata AddExpressionAndConditionAndAction (const gd::String &type, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &sentenceName, const gd::String &group, const gd::String &icon) override
 Declare a new expression, condition and action as being part of the behavior. More...
 
gd::InstructionMetadataAddDuplicatedAction (const gd::String &newActionName, const gd::String &copiedActionName) override
 Create a new action which is the duplicate of the specified one. More...
 
gd::InstructionMetadataAddDuplicatedCondition (const gd::String &newConditionName, const gd::String &copiedConditionName) override
 Create a new condition which is the duplicate of the specified one. More...
 
gd::ExpressionMetadataAddDuplicatedExpression (const gd::String &newExpressionName, const gd::String &copiedExpressionName)
 Create a new expression which is the duplicate of the specified one. More...
 
gd::ExpressionMetadataAddDuplicatedStrExpression (const gd::String &newExpressionName, const gd::String &copiedExpressionName)
 Create a new string expression which is the duplicate of the specified one. More...
 
BehaviorMetadataSetFullName (const gd::String &fullname_) override
 
BehaviorMetadataSetDefaultName (const gd::String &defaultName_)
 
BehaviorMetadataSetDescription (const gd::String &description_) override
 
BehaviorMetadataSetGroup (const gd::String &group_)
 
BehaviorMetadataSetIncludeFile (const gd::String &includeFile) override
 Erase any existing include file and add the specified include. More...
 
BehaviorMetadataAddIncludeFile (const gd::String &includeFile) override
 Add a file to the already existing include files.
 
BehaviorMetadataAddRequiredFile (const gd::String &requiredFile)
 Add a file to the already existing required files. More...
 
const gd::StringGetHelpPath () const override
 
BehaviorMetadataSetHelpPath (const gd::String &path) override
 
const gd::StringGetName () const override
 
const gd::StringGetFullName () const override
 
const gd::StringGetDefaultName () const
 
const gd::StringGetDescription () const override
 
const gd::StringGetGroup () const
 
const gd::StringGetIconFilename () const override
 
BehaviorMetadataSetObjectType (const gd::String &objectType_)
 Set the type of the object that this behavior can be used on.
 
const gd::StringGetObjectType () const
 Get the type of the object that this behavior can be used on. More...
 
const std::vector< gd::String > & GetRequiredBehaviorTypes () const
 Get the types of the behaviors that are required by this behavior.
 
bool IsPrivate () const
 
BehaviorMetadataSetPrivate ()
 
bool IsHidden () const
 
BehaviorMetadataSetHidden ()
 
gd::BehaviorGet () const
 Return the associated gd::Behavior, handling behavior contents. More...
 
std::map< gd::String, gd::PropertyDescriptorGetProperties () const
 Called when the IDE wants to know about the custom properties of the behavior. More...
 
gd::BehaviorsSharedDataGetSharedDataInstance () const
 Return the associated gd::BehaviorsSharedData, handling behavior shared data, if any (nullptr if none). More...
 
std::map< gd::String, gd::PropertyDescriptorGetSharedProperties () const
 Called when the IDE wants to know about the custom shared properties of the behavior. More...
 
std::map< gd::String, gd::InstructionMetadata > & GetAllActions () override
 Return a reference to a map containing the names of the actions (as keys) and the metadata associated with (as values).
 
std::map< gd::String, gd::InstructionMetadata > & GetAllConditions () override
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllExpressions () override
 
std::map< gd::String, gd::ExpressionMetadata > & GetAllStrExpressions () override
 

Public Attributes

std::map< gd::String, gd::InstructionMetadataconditionsInfos
 
std::map< gd::String, gd::InstructionMetadataactionsInfos
 
std::map< gd::String, gd::ExpressionMetadataexpressionsInfos
 
std::map< gd::String, gd::ExpressionMetadatastrExpressionsInfos
 
std::vector< gd::StringincludeFiles
 
std::vector< gd::StringrequiredFiles
 
gd::String className
 

Detailed Description

Contains user-friendly information about a behavior type.

Constructor & Destructor Documentation

◆ BehaviorMetadata()

gd::BehaviorMetadata::BehaviorMetadata ( const gd::String extensionNamespace,
const gd::String nameWithNamespace,
const gd::String fullname_,
const gd::String defaultName_,
const gd::String description_,
const gd::String group_,
const gd::String icon24x24_ 
)

Construct a behavior metadata, without "blueprint" behavior.

Note
This is used by events based behaviors.

Member Function Documentation

◆ AddAction()

gd::InstructionMetadata & gd::BehaviorMetadata::AddAction ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String sentence_,
const gd::String group_,
const gd::String icon_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new action as being part of the behavior.

Deprecated:
Prefer using AddScopedAction, to properly namespace the action.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddCondition()

gd::InstructionMetadata & gd::BehaviorMetadata::AddCondition ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String sentence_,
const gd::String group_,
const gd::String icon_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new condition as being part of the behavior.

Deprecated:
Prefer using AddScopedCondition, to properly namespace the condition.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddDuplicatedAction()

gd::InstructionMetadata & gd::BehaviorMetadata::AddDuplicatedAction ( const gd::String newActionName,
const gd::String copiedActionName 
)
overridevirtual

Create a new action which is the duplicate of the specified one.

Useful for handling a deprecated action that is just a "copy" of the new one.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddDuplicatedCondition()

gd::InstructionMetadata & gd::BehaviorMetadata::AddDuplicatedCondition ( const gd::String newConditionName,
const gd::String copiedConditionName 
)
overridevirtual

Create a new condition which is the duplicate of the specified one.

Useful for handling a deprecated condition that is just a "copy" of the new one.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddDuplicatedExpression()

gd::ExpressionMetadata & gd::BehaviorMetadata::AddDuplicatedExpression ( const gd::String newExpressionName,
const gd::String copiedExpressionName 
)

Create a new expression which is the duplicate of the specified one.

Useful for handling a deprecated expression that is just a "copy" of the new one.

◆ AddDuplicatedStrExpression()

gd::ExpressionMetadata & gd::BehaviorMetadata::AddDuplicatedStrExpression ( const gd::String newExpressionName,
const gd::String copiedExpressionName 
)

Create a new string expression which is the duplicate of the specified one.

Useful for handling a deprecated string expression that is just a "copy" of the new one.

◆ AddExpression()

gd::ExpressionMetadata & gd::BehaviorMetadata::AddExpression ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String group_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new action as being part of the extension.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddExpressionAndCondition()

gd::MultipleInstructionMetadata gd::BehaviorMetadata::AddExpressionAndCondition ( const gd::String type,
const gd::String name,
const gd::String fullname,
const gd::String description,
const gd::String sentenceName,
const gd::String group,
const gd::String icon 
)
overridevirtual

Declare a new expression and condition as being part of the behavior.

Note
It's recommended to use this function to avoid declaring twice a similar expression/condition.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddExpressionAndConditionAndAction()

gd::MultipleInstructionMetadata gd::BehaviorMetadata::AddExpressionAndConditionAndAction ( const gd::String type,
const gd::String name,
const gd::String fullname,
const gd::String description,
const gd::String sentenceName,
const gd::String group,
const gd::String icon 
)
overridevirtual

Declare a new expression, condition and action as being part of the behavior.

Note
The action name is prefixed by "Set" (and the namespace, as the condition).
It's recommended to use this function to avoid declaring 3 times a similar expression/condition/action.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddRequiredFile()

BehaviorMetadata & gd::BehaviorMetadata::AddRequiredFile ( const gd::String requiredFile)

Add a file to the already existing required files.

Note
These files are required for the behavior to work, but they are not executable.

◆ AddScopedAction()

gd::InstructionMetadata & gd::BehaviorMetadata::AddScopedAction ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String sentence_,
const gd::String group_,
const gd::String icon_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new action as being part of the behavior.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddScopedCondition()

gd::InstructionMetadata & gd::BehaviorMetadata::AddScopedCondition ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String sentence_,
const gd::String group_,
const gd::String icon_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new condition as being part of the behavior.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddStrExpression()

gd::ExpressionMetadata & gd::BehaviorMetadata::AddStrExpression ( const gd::String name_,
const gd::String fullname_,
const gd::String description_,
const gd::String group_,
const gd::String smallicon_ 
)
overridevirtual

Declare a new string expression as being part of the extension.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ Get()

gd::Behavior & gd::BehaviorMetadata::Get ( ) const

Return the associated gd::Behavior, handling behavior contents.

Note
Returns a dumb Behavior for events based behaviors as CustomBehavior are using EventBasedBehavior.

◆ GetAllConditions()

std::map<gd::String, gd::InstructionMetadata>& gd::BehaviorMetadata::GetAllConditions ( )
inlineoverridevirtual

◆ GetAllExpressions()

std::map<gd::String, gd::ExpressionMetadata>& gd::BehaviorMetadata::GetAllExpressions ( )
inlineoverridevirtual

◆ GetAllStrExpressions()

std::map<gd::String, gd::ExpressionMetadata>& gd::BehaviorMetadata::GetAllStrExpressions ( )
inlineoverridevirtual

◆ GetHelpPath()

const gd::String& gd::BehaviorMetadata::GetHelpPath ( ) const
inlineoverridevirtual

Get the help path of the behavior, relative to the GDevelop documentation root.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ GetObjectType()

const gd::String& gd::BehaviorMetadata::GetObjectType ( ) const
inline

Get the type of the object that this behavior can be used on.

Note
An empty string means the base object, so any object.

◆ GetProperties()

std::map< gd::String, gd::PropertyDescriptor > gd::BehaviorMetadata::GetProperties ( ) const

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

Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

◆ GetSharedDataInstance()

gd::BehaviorsSharedData * gd::BehaviorMetadata::GetSharedDataInstance ( ) const

Return the associated gd::BehaviorsSharedData, handling behavior shared data, if any (nullptr if none).

Note
Returns nullptr for events based behaviors as they don't declare shared data yet.

◆ GetSharedProperties()

std::map< gd::String, gd::PropertyDescriptor > gd::BehaviorMetadata::GetSharedProperties ( ) const

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

Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

◆ IsHidden()

bool gd::BehaviorMetadata::IsHidden ( ) const
inline

Check if the behavior is hidden - it can be used but not attached to objects by users.

◆ IsPrivate()

bool gd::BehaviorMetadata::IsPrivate ( ) const
inline

Check if the behavior is private - it can't be used outside of its extension.

◆ SetHelpPath()

BehaviorMetadata& gd::BehaviorMetadata::SetHelpPath ( const gd::String path)
inlineoverridevirtual

Set the help path of the behavior, relative to the GDevelop documentation root.

The behavior instructions will have this help path set by default, unless you call SetHelpPath on them.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ SetHidden()

BehaviorMetadata& gd::BehaviorMetadata::SetHidden ( )
inline

Set that the behavior is hidden - it can be used but not attached to objects by users.

◆ SetIncludeFile()

BehaviorMetadata & gd::BehaviorMetadata::SetIncludeFile ( const gd::String includeFile)
overridevirtual

Erase any existing include file and add the specified include.

Note
The requirement may vary depending on the platform: Most of the time, the include file contains the declaration of the behavior.
Deprecated:
Use AddIncludeFile instead as clearing the list is more error prone.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ SetPrivate()

BehaviorMetadata& gd::BehaviorMetadata::SetPrivate ( )
inline

Set that the behavior is private - it can't be used outside of its extension.


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