8 #include "GDCore/Project/ObjectConfiguration.h"
12 #include <unordered_set>
13 #include "GDCore/Project/Object.h"
14 #include "GDCore/Project/Project.h"
15 #include "GDCore/Project/EventsBasedObject.h"
16 #include "GDCore/Project/PropertyDescriptor.h"
17 #include "GDCore/Serialization/Serializer.h"
18 #include "GDCore/Serialization/SerializerElement.h"
19 #include "GDCore/Extensions/Builtin/SpriteExtension/SpriteAnimationList.h"
34 : project(&project_), isMarkedAsOverridingEventsBasedObjectChildrenConfiguration(
false) {
37 std::unique_ptr<gd::ObjectConfiguration>
Clone()
const override;
51 if ((
this) != &
object) {
52 ObjectConfiguration::operator=(
object);
58 std::map<gd::String, gd::PropertyDescriptor>
GetProperties()
const override;
69 bool IsForcedToOverrideEventsBasedObjectChildrenConfiguration()
const;
71 bool IsMarkedAsOverridingEventsBasedObjectChildrenConfiguration()
const {
72 return isMarkedAsOverridingEventsBasedObjectChildrenConfiguration;
75 void SetMarkedAsOverridingEventsBasedObjectChildrenConfiguration(
76 bool isOverridingEventsBasedObjectChildrenConfiguration_) {
77 isMarkedAsOverridingEventsBasedObjectChildrenConfiguration =
78 isOverridingEventsBasedObjectChildrenConfiguration_;
81 void ClearChildrenConfiguration();
84 GetChildObjectConfiguration(
const gd::String &objectName);
110 static const gd::CustomObjectConfiguration::EdgeAnchor
111 GetEdgeAnchorFromString(
const gd::String &value);
119 return unfoldedChildren.find(childName) == unfoldedChildren.end();
129 unfoldedChildren.insert(childName);
131 unfoldedChildren.erase(childName);
141 bool IsOverridingEventsBasedObjectChildrenConfiguration()
const;
143 const Project* project =
nullptr;
146 std::unordered_set<gd::String> unfoldedChildren;
148 bool isMarkedAsOverridingEventsBasedObjectChildrenConfiguration =
false;
149 mutable std::map<gd::String, std::unique_ptr<gd::ObjectConfiguration>> childObjectConfigurations;
ArbitraryResourceWorker is used so as to inventory resources and sometimes update them.
Definition: ArbitraryResourceWorker.h:44
A gd::ObjectConfiguration that stores its content in JSON and is composed of other configuration acco...
Definition: CustomObjectConfiguration.h:31
void SetChildObjectFolded(const gd::String &childName, bool folded)
Definition: CustomObjectConfiguration.h:127
void ExposeResources(gd::ArbitraryResourceWorker &worker) override
Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their f...
Definition: CustomObjectConfiguration.cpp:200
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.
Definition: CustomObjectConfiguration.cpp:118
void DoUnserializeFrom(Project &project, const SerializerElement &element) override
Derived object configuration can redefine this method to load custom attributes.
Definition: CustomObjectConfiguration.cpp:178
void DoSerializeTo(SerializerElement &element) const override
Derived object configuration can redefine this method to save custom attributes.
Definition: CustomObjectConfiguration.cpp:158
std::size_t GetAnimationsCount() const override
Return the number of animations declared in this object configuration.
Definition: CustomObjectConfiguration.cpp:256
CustomObjectConfiguration(const gd::CustomObjectConfiguration &object)
Definition: CustomObjectConfiguration.h:42
std::map< gd::String, gd::PropertyDescriptor > GetProperties() const override
Called when the IDE wants to know about the custom properties of the object configuration.
Definition: CustomObjectConfiguration.cpp:107
const SpriteAnimationList & GetAnimations() const
Return the animation configuration for Animatable custom objects.
Definition: CustomObjectConfiguration.cpp:270
bool IsChildObjectFolded(const gd::String &childName) const
Definition: CustomObjectConfiguration.h:118
std::map< gd::String, gd::PropertyDescriptor > GetInitialInstanceProperties(const gd::InitialInstance &instance) override
Called when the IDE wants to know about the custom properties of an initial instance of this object c...
Definition: CustomObjectConfiguration.cpp:134
CustomObjectConfiguration & operator=(const gd::CustomObjectConfiguration &object)
Definition: CustomObjectConfiguration.h:50
const gd::String & GetAnimationName(size_t index) const override
Return the name of an animation declared in this object configuration.
Definition: CustomObjectConfiguration.cpp:261
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 configura...
Definition: CustomObjectConfiguration.cpp:147
bool HasAnimationNamed(const gd::String &animationName) const override
Return true if an animation is declared in this object configuration for a given name.
Definition: CustomObjectConfiguration.cpp:265
std::unique_ptr< gd::ObjectConfiguration > Clone() const override
Definition: CustomObjectConfiguration.cpp:37
Represents an object that is implemented with events.
Definition: EventsBasedObject.h:30
Represents an instance of an object to be created on a layout start up.
Definition: InitialInstance.h:26
Base class used to represent an object configuration. For example, this can be the animations in a sp...
Definition: ObjectConfiguration.h:38
void SetType(const gd::String &type_)
Change the type of the object.
Definition: ObjectConfiguration.h:64
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
A list of animations, containing directions with images and collision mask.
Definition: SpriteAnimationList.h:30
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24