Files
GDevelop/GDevelop.js/Bindings/ObjectJsImplementation.h
Florian Rival 43f5bd1c0e Allow to edit object properties, behaviors, variables and effects directly from the properties panel (#6898)
* When an object is selected (or when "Edit object" button is clicked in the properties panel after choosing an instance), the properties panel will show the properties of the object.
* This allows for fast edition of most elements of an object: appearance, properties, but also behaviors, variables and effects. Most workflow and iterations on your game should be faster, from adapting the appearance of a text to tweaking behaviors and updating the preview to check the result in realtime.
2024-09-27 10:56:39 +02:00

42 lines
1.5 KiB
C++

#include <GDCore/Project/Object.h>
#include <GDCore/Project/ObjectConfiguration.h>
#include <GDCore/Project/Project.h>
#include <GDCore/Project/PropertyDescriptor.h>
#include <GDCore/Serialization/Serializer.h>
#include <GDCore/Serialization/SerializerElement.h>
#include <emscripten.h>
using namespace gd;
/**
* \brief A gd::ObjectConfiguration that wraps a Javascript object:
* the content of the object is stored in JavaScript in a "content" property,
* allowing both fast access in JavaScript and still ability to access properties
* via the usual methods.
*
* It also implements "ExposeResources" to expose the properties of type
* "resource".
*/
class ObjectJsImplementation : public gd::ObjectConfiguration {
public:
ObjectJsImplementation() {}
std::unique_ptr<gd::ObjectConfiguration> Clone() const override;
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
bool UpdateProperty(const gd::String& name, const gd::String& value) override;
std::map<gd::String, gd::PropertyDescriptor> GetInitialInstanceProperties(
const gd::InitialInstance& instance) override;
bool UpdateInitialInstanceProperty(gd::InitialInstance& instance,
const gd::String& name,
const gd::String& value) override;
void __destroy__();
void ExposeResources(gd::ArbitraryResourceWorker& worker) override;
protected:
void DoSerializeTo(SerializerElement& arg0) const override;
void DoUnserializeFrom(Project& arg0, const SerializerElement& arg1) override;
};