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 an object type, and a function to create a new gd::Object of this type. More...

#include <ObjectMetadata.h>

Inherits gd::InstructionOrExpressionContainerMetadata.

Public Member Functions

 ObjectMetadata (const gd::String &extensionNamespace_, const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon24x24_, std::shared_ptr< gd::ObjectConfiguration > blueprintObject_)
 Construct an object metadata, using a "blueprint" object that will be copied when a new object is requested. More...
 
 ObjectMetadata (const gd::String &extensionNamespace_, const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon24x24_)
 Construct an object metadata. More...
 
 ObjectMetadata (const gd::String &extensionNamespace_, const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &icon24x24_, CreateFunPtr createFunPtr_)
 Construct an object metadata, with a function that will be called to instantiate a new object. More...
 
gd::InstructionMetadata & 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_) override
 Declare a new condition as being part of the extension. More...
 
gd::InstructionMetadata & 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_) override
 Declare a new action as being part of the extension. More...
 
gd::InstructionMetadata & 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_) override
 
gd::InstructionMetadata & 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_) override
 
gd::ExpressionMetadata & AddExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_) override
 Declare a new expression as being part of the extension.
 
gd::ExpressionMetadata & AddStrExpression (const gd::String &name_, const gd::String &fullname_, const gd::String &description_, const gd::String &group_, const gd::String &smallicon_) override
 Declare a new string expression as being part of the extension.
 
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 object. 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 object. More...
 
gd::InstructionMetadata & AddDuplicatedAction (const gd::String &newActionName, const gd::String &copiedActionName) override
 Create a new action which is the duplicate of the specified one. More...
 
gd::InstructionMetadata & AddDuplicatedCondition (const gd::String &newConditionName, const gd::String &copiedConditionName) override
 Create a new condition which is the duplicate of the specified one. More...
 
ObjectMetadata & SetFullName (const gd::String &fullname_) override
 Set the name shown to the user.
 
ObjectMetadata & SetDescription (const gd::String &description_) override
 Set the description shown to the user.
 
const gd::String & GetHelpPath () const override
 Get the help path of the object, relative to the GDevelop documentation root.
 
ObjectMetadata & SetHelpPath (const gd::String &path) override
 Set the help path of the object, relative to the GDevelop documentation root. More...
 
ObjectMetadata & SetCategory (const gd::String &category_)
 Set the name of the group identifier this object must be categorized in.
 
const gd::String & GetAssetStoreTag () const
 Get the tag from which to choose assets from when creating a new object.
 
ObjectMetadata & SetAssetStoreTag (const gd::String &assetStoreTag_)
 Set the tag from which to choose assets from when creating a new object.
 
const std::set< gd::String > & GetDefaultBehaviors () const
 The "capabilities" that are offered by through behaviors.
 
bool HasDefaultBehavior (const gd::String &behaviorType) const
 Return true if object has a default behavior of the given type.
 
ObjectMetadata & AddDefaultBehavior (const gd::String &behaviorType)
 Add a "capability" that is offered by through a behavior.
 
ObjectMetadata & ResetDefaultBehaviorsJustForTesting ()
 
const gd::String & GetName () const override
 
const gd::String & GetFullName () const override
 
const gd::String & GetCategory () const
 
const gd::String & GetHelpUrl () const
 
const gd::String & GetDescription () const override
 
const gd::String & GetIconFilename () const override
 
ObjectMetadata & SetHelpUrl (const gd::String &url)
 Set the URL pointing to the help page about this object. More...
 
ObjectMetadata & SetIncludeFile (const gd::String &includeFile) override
 Erase any existing include file and add the specified include. More...
 
ObjectMetadata & AddIncludeFile (const gd::String &includeFile) override
 Add a file to the already existing include files.
 
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
 
bool IsPrivate () const override
 
ObjectMetadata & SetPrivate ()
 
ObjectMetadata & SetHidden ()
 Set the object to be hidden in the IDE. More...
 
bool IsHidden () const
 Return true if the object must be hidden in the IDE.
 
ObjectMetadata & MarkAsRenderedIn3D ()
 Declare a usage of the 3D renderer.
 
bool IsRenderedIn3D () const
 Return true if the object uses the 3D renderer.
 
ObjectMetadata & SetOpenFullEditorLabel (const gd::String &label)
 
const gd::String & GetOpenFullEditorLabel () const
 
InGameEditorResourceMetadata & AddInGameEditorResource ()
 Declare a new resource to be used in the in-game editor.
 
const std::vector< gd::InGameEditorResourceMetadata > & GetInGameEditorResources () const
 

Public Attributes

std::map< gd::String, gd::InstructionMetadata > conditionsInfos
 
std::map< gd::String, gd::InstructionMetadata > actionsInfos
 
std::map< gd::String, gd::ExpressionMetadata > expressionsInfos
 
std::map< gd::String, gd::ExpressionMetadata > strExpressionsInfos
 
std::vector< gd::String > includeFiles
 
gd::String className
 
CreateFunPtr createFunPtr = nullptr
 

Detailed Description

Contains user-friendly information about an object type, and a function to create a new gd::Object of this type.

Constructor & Destructor Documentation

◆ ObjectMetadata() [1/3]

gd::ObjectMetadata::ObjectMetadata ( const gd::String &  extensionNamespace_,
const gd::String &  name_,
const gd::String &  fullname_,
const gd::String &  description_,
const gd::String &  icon24x24_,
std::shared_ptr< gd::ObjectConfiguration >  blueprintObject_ 
)

Construct an object metadata, using a "blueprint" object that will be copied when a new object is requested.

Note
This is used for objects declared in JavaScript extensions.

◆ ObjectMetadata() [2/3]

gd::ObjectMetadata::ObjectMetadata ( const gd::String &  extensionNamespace_,
const gd::String &  name_,
const gd::String &  fullname_,
const gd::String &  description_,
const gd::String &  icon24x24_ 
)

Construct an object metadata.

Note
This is used by events based objects ("custom objects").

◆ ObjectMetadata() [3/3]

gd::ObjectMetadata::ObjectMetadata ( const gd::String &  extensionNamespace_,
const gd::String &  name_,
const gd::String &  fullname_,
const gd::String &  description_,
const gd::String &  icon24x24_,
CreateFunPtr  createFunPtr_ 
)

Construct an object metadata, with a function that will be called to instantiate a new object.

Note
This is used for objects declared in C++ extensions.

Member Function Documentation

◆ AddAction()

gd::InstructionMetadata & gd::ObjectMetadata::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 extension.

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

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddCondition()

gd::InstructionMetadata & gd::ObjectMetadata::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 extension.

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

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddDuplicatedAction()

gd::InstructionMetadata & gd::ObjectMetadata::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::ObjectMetadata::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.

◆ AddExpressionAndCondition()

gd::MultipleInstructionMetadata gd::ObjectMetadata::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 object.

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

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddExpressionAndConditionAndAction()

gd::MultipleInstructionMetadata gd::ObjectMetadata::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 object.

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.

◆ AddScopedAction()

gd::InstructionMetadata & gd::ObjectMetadata::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 object.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ AddScopedCondition()

gd::InstructionMetadata & gd::ObjectMetadata::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 object.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ GetAllConditions()

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

◆ GetAllExpressions()

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

◆ GetAllStrExpressions()

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

◆ IsPrivate()

bool gd::ObjectMetadata::IsPrivate ( ) const
inlineoverridevirtual

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

Implements gd::InstructionOrExpressionContainerMetadata.

◆ SetHelpPath()

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

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

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

Implements gd::InstructionOrExpressionContainerMetadata.

◆ SetHelpUrl()

ObjectMetadata & gd::ObjectMetadata::SetHelpUrl ( const gd::String &  url)

Set the URL pointing to the help page about this object.

Note
The path to the page must be relative to the wiki url.
Deprecated:
Use SetHelpPath instead

◆ SetHidden()

ObjectMetadata& gd::ObjectMetadata::SetHidden ( )
inline

Set the object to be hidden in the IDE.

Used mainly when an object is deprecated.

◆ SetIncludeFile()

ObjectMetadata & gd::ObjectMetadata::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 object.
Deprecated:
Use AddIncludeFile instead as clearing the list is more error prone.

Implements gd::InstructionOrExpressionContainerMetadata.

◆ SetPrivate()

ObjectMetadata& gd::ObjectMetadata::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: