GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Types | Public Member Functions | Static 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 Types

enum  EdgeAnchor {
  NoAnchor = 0 , MinEdge = 1 , MaxEdge = 2 , Proportional = 3 ,
  Center = 4
}
 

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) 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) 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...
 
bool IsForcedToOverrideEventsBasedObjectChildrenConfiguration () const
 
bool IsMarkedAsOverridingEventsBasedObjectChildrenConfiguration () const
 
void SetMarkedAsOverridingEventsBasedObjectChildrenConfiguration (bool isOverridingEventsBasedObjectChildrenConfiguration_)
 
void ClearChildrenConfiguration ()
 
gd::ObjectConfigurationGetChildObjectConfiguration (const gd::String &objectName)
 
std::size_t GetAnimationsCount () const override
 Return the number of animations declared in this object configuration.
 
const gd::StringGetAnimationName (size_t index) const override
 Return the name of an animation declared in this object configuration.
 
bool HasAnimationNamed (const gd::String &animationName) const override
 Return true if an animation is declared in this object configuration for a given name.
 
const SpriteAnimationListGetAnimations () const
 Return the animation configuration for Animatable custom objects.
 
SpriteAnimationListGetAnimations ()
 Return the animation configuration for Animatable custom objects.
 
bool IsChildObjectFolded (const gd::String &childName) const
 
void SetChildObjectFolded (const gd::String &childName, bool folded)
 
- 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...
 

Static Public Member Functions

static const gd::CustomObjectConfiguration::EdgeAnchor GetEdgeAnchorFromString (const gd::String &value)
 

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)
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.

◆ IsChildObjectFolded()

bool gd::CustomObjectConfiguration::IsChildObjectFolded ( const gd::String childName) const
inline

Check if a child object properties must be displayed as folded in the editor. This is only useful when the object can override its children configuration (which is something being deprecated).

◆ operator=()

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

Assignment operator. Calls Init().

◆ SetChildObjectFolded()

void gd::CustomObjectConfiguration::SetChildObjectFolded ( const gd::String childName,
bool  folded 
)
inline

Set if a child object properties must be displayed as folded in the editor. This is only useful when the object can override its children configuration (which is something being deprecated).

◆ UpdateInitialInstanceProperty()

bool CustomObjectConfiguration::UpdateInitialInstanceProperty ( gd::InitialInstance instance,
const gd::String name,
const gd::String value 
)
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: