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

A gd::ObjectConfiguration that stores its content in JSON and is composed of other configuration according to it's object children. More...

#include <CustomObjectConfiguration.h>

Inherits gd::ObjectConfiguration.

Public Member Functions

 CustomObjectConfiguration (const Project &project_, const String &type_)
 
std::unique_ptr< gd::ObjectConfigurationClone () const override
 
 CustomObjectConfiguration (const gd::CustomObjectConfiguration &object)
 
CustomObjectConfigurationoperator= (const gd::CustomObjectConfiguration &object)
 
std::map< gd::String, gd::PropertyDescriptorGetProperties () const override
 Called when the IDE wants to know about the custom properties of the object configuration. More...
 
bool UpdateProperty (const gd::String &name, const gd::String &value) override
 Called when the IDE wants to update a custom property of the object configuration. More...
 
std::map< gd::String, gd::PropertyDescriptorGetInitialInstanceProperties (const gd::InitialInstance &instance, gd::Project &project, gd::Layout &scene) override
 Called when the IDE wants to know about the custom properties of an initial instance of this object configuration. More...
 
bool UpdateInitialInstanceProperty (gd::InitialInstance &instance, const gd::String &name, const gd::String &value, gd::Project &project, gd::Layout &scene) override
 Called when the IDE wants to update a custom property of an initial instance of this object configuration. More...
 
void ExposeResources (gd::ArbitraryResourceWorker &worker) override
 Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example: More...
 
gd::ObjectConfigurationGetChildObjectConfiguration (const gd::String &objectName)
 
const SpriteAnimationListGetAnimations () const
 Return the animation configuration for Animatable custom objects.
 
SpriteAnimationListGetAnimations ()
 Return the animation configuration for Animatable custom objects.
 
- Public Member Functions inherited from gd::ObjectConfiguration
 ObjectConfiguration ()
 
virtual ~ObjectConfiguration ()
 
void SetType (const gd::String &type_)
 Change the type of the object.
 
const gd::StringGetType () const
 Return the type of the object.
 
void SerializeTo (SerializerElement &element) const
 Serialize the object configuration. More...
 
void UnserializeFrom (gd::Project &project, const SerializerElement &element)
 Unserialize the object configuration. More...
 

Protected Member Functions

void DoSerializeTo (SerializerElement &element) const override
 Derived object configuration can redefine this method to save custom attributes.
 
void DoUnserializeFrom (Project &project, const SerializerElement &element) override
 Derived object configuration can redefine this method to load custom attributes.
 

Additional Inherited Members

- Protected Attributes inherited from gd::ObjectConfiguration
gd::String type
 

Detailed Description

A gd::ObjectConfiguration that stores its content in JSON and is composed of other configuration according to it's object children.

It also implements "ExposeResources" to expose the properties of type "resource".

Constructor & Destructor Documentation

◆ CustomObjectConfiguration()

gd::CustomObjectConfiguration::CustomObjectConfiguration ( const gd::CustomObjectConfiguration object)
inline

Copy constructor. Calls Init().

Member Function Documentation

◆ Clone()

std::unique_ptr< gd::ObjectConfiguration > CustomObjectConfiguration::Clone ( ) const
overridevirtual

Must return a pointer to a copy of the configuration. This method is needed to do polymorphic copies. Just redefine this method in your derived object class like this:

return gd::make_unique<MyObjectConfiguration>(*this);

Reimplemented from gd::ObjectConfiguration.

◆ ExposeResources()

void CustomObjectConfiguration::ExposeResources ( gd::ArbitraryResourceWorker worker)
overridevirtual

Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example:

worker.ExposeImage(myImage);
worker.ExposeFile(myResourceFile);
See also
ArbitraryResourceWorker

Reimplemented from gd::ObjectConfiguration.

◆ GetInitialInstanceProperties()

std::map< gd::String, gd::PropertyDescriptor > CustomObjectConfiguration::GetInitialInstanceProperties ( const gd::InitialInstance instance,
gd::Project project,
gd::Layout layout 
)
overridevirtual

Called when the IDE wants to know about the custom properties of an initial instance of this object configuration.

Returns
a std::map with properties names as key and values.
See also
gd::InitialInstance

Reimplemented from gd::ObjectConfiguration.

◆ GetProperties()

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

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

Usage example:

std::map<gd::String, gd::PropertyDescriptor> properties;
properties[ToString(_("Text"))].SetValue("Hello world!");
return properties;
Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

Reimplemented from gd::ObjectConfiguration.

◆ operator=()

CustomObjectConfiguration& gd::CustomObjectConfiguration::operator= ( const gd::CustomObjectConfiguration object)
inline

Assignment operator. Calls Init().

◆ UpdateInitialInstanceProperty()

bool CustomObjectConfiguration::UpdateInitialInstanceProperty ( gd::InitialInstance instance,
const gd::String name,
const gd::String value,
gd::Project project,
gd::Layout layout 
)
overridevirtual

Called when the IDE wants to update a custom property of an initial instance of this object configuration.

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

Reimplemented from gd::ObjectConfiguration.

◆ UpdateProperty()

bool CustomObjectConfiguration::UpdateProperty ( const gd::String name,
const gd::String value 
)
overridevirtual

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

Returns
false if the new value cannot be set

Reimplemented from gd::ObjectConfiguration.


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