2022-06-06 22:04:36 +02:00
|
|
|
#ifndef MM_NODE_UNIVERSAL_PROPERTY_H
|
|
|
|
#define MM_NODE_UNIVERSAL_PROPERTY_H
|
|
|
|
|
2022-06-06 23:01:34 +02:00
|
|
|
#include "core/image.h"
|
|
|
|
#include "core/math/vector2.h"
|
|
|
|
#include "core/math/vector3.h"
|
2022-06-07 10:55:42 +02:00
|
|
|
#include "core/method_bind.h"
|
2022-06-06 23:01:34 +02:00
|
|
|
#include "core/variant.h"
|
|
|
|
|
|
|
|
#include "core/resource.h"
|
|
|
|
|
|
|
|
class MMNode;
|
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
class MMNodeUniversalProperty : public Resource {
|
|
|
|
GDCLASS(MMNodeUniversalProperty, Resource);
|
|
|
|
|
|
|
|
public:
|
2022-06-06 23:01:34 +02:00
|
|
|
enum SlotTypes {
|
|
|
|
SLOT_TYPE_NONE = -1,
|
|
|
|
SLOT_TYPE_IMAGE = 0,
|
|
|
|
SLOT_TYPE_INT = 1,
|
|
|
|
SLOT_TYPE_FLOAT = 2,
|
|
|
|
SLOT_TYPE_VECTOR2 = 3,
|
|
|
|
SLOT_TYPE_VECTOR3 = 4,
|
|
|
|
SLOT_TYPE_COLOR = 5,
|
|
|
|
SLOT_TYPE_UNIVERSAL = 6,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MMNodeUniversalPropertyDefaultType {
|
|
|
|
DEFAULT_TYPE_INT = 0,
|
|
|
|
DEFAULT_TYPE_FLOAT = 1,
|
|
|
|
DEFAULT_TYPE_VECTOR2 = 2,
|
|
|
|
DEFAULT_TYPE_VECTOR3 = 3,
|
|
|
|
DEFAULT_TYPE_COLOR = 4,
|
|
|
|
DEFAULT_TYPE_IMAGE = 5,
|
|
|
|
};
|
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
int get_default_type() const;
|
|
|
|
void set_default_type(const int val);
|
|
|
|
|
|
|
|
int get_default_int() const;
|
|
|
|
void set_default_int(const int val);
|
|
|
|
|
|
|
|
float get_default_float() const;
|
|
|
|
void set_default_float(const float val);
|
|
|
|
|
2022-06-08 21:22:05 +02:00
|
|
|
Vector2 get_default_vector2() const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_default_vector2(const Vector2 &val);
|
|
|
|
|
2022-06-08 21:22:05 +02:00
|
|
|
Vector3 get_default_vector3() const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_default_vector3(const Vector3 &val);
|
|
|
|
|
2022-06-08 21:22:05 +02:00
|
|
|
Color get_default_color() const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_default_color(const Color &val);
|
|
|
|
|
|
|
|
Ref<Image> get_default_image();
|
|
|
|
void set_default_image(const Ref<Image> &val);
|
|
|
|
|
|
|
|
bool get_get_value_from_owner() const;
|
|
|
|
void set_get_value_from_owner(const bool val);
|
|
|
|
|
|
|
|
bool get_force_override() const;
|
|
|
|
void set_force_override(const bool val);
|
|
|
|
|
|
|
|
Ref<Image> get_override_image();
|
|
|
|
void set_override_image(const Ref<Image> &val);
|
|
|
|
|
|
|
|
int get_input_slot_type() const;
|
|
|
|
void set_input_slot_type(const int val);
|
|
|
|
|
|
|
|
int get_output_slot_type() const;
|
|
|
|
void set_output_slot_type(const int val);
|
|
|
|
|
2022-06-08 21:22:05 +02:00
|
|
|
String get_slot_name() const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_slot_name(const String &val);
|
|
|
|
|
|
|
|
float get_value_step() const;
|
|
|
|
void set_value_step(const float val);
|
|
|
|
|
2022-06-08 21:22:05 +02:00
|
|
|
Vector2 get_value_range() const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_value_range(const Vector2 &val);
|
|
|
|
|
2022-06-06 23:01:34 +02:00
|
|
|
Ref<MMNodeUniversalProperty> get_input_property();
|
|
|
|
void set_input_property(const Ref<MMNodeUniversalProperty> &val);
|
|
|
|
void unset_input_property();
|
|
|
|
void on_input_property_changed();
|
2022-06-06 22:04:36 +02:00
|
|
|
|
2022-06-06 23:01:34 +02:00
|
|
|
Ref<MMNode> get_owner();
|
|
|
|
void set_owner(const Ref<MMNode> &val);
|
2022-06-06 22:04:36 +02:00
|
|
|
|
2022-06-06 23:01:34 +02:00
|
|
|
Variant get_value(const Vector2 &uv, const bool skip_owner_val = false);
|
|
|
|
Variant get_owner_value(const Vector2 &uv);
|
|
|
|
Variant get_value_or_zero(const Vector2 &uv, const bool skip_owner_val = false);
|
2022-06-06 22:04:36 +02:00
|
|
|
Vector2 get_value_sdf3d(const Vector3 &uv3, const bool skip_owner_val = false);
|
2022-06-06 23:01:34 +02:00
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
int to_int(const Variant &val);
|
|
|
|
float to_float(const Variant &val);
|
|
|
|
Vector2 to_vector2(const Variant &val);
|
|
|
|
Vector3 to_vector3(const Variant &val);
|
|
|
|
Color to_color(const Variant &val);
|
|
|
|
void set_value(const Variant &val);
|
2022-06-06 23:01:34 +02:00
|
|
|
Variant get_zero_value();
|
|
|
|
Variant get_default_value(const Vector2 &uv = Vector2());
|
2022-06-08 21:22:05 +02:00
|
|
|
Variant get_default_value_const(const Vector2 &uv = Vector2()) const;
|
2022-06-06 22:04:36 +02:00
|
|
|
void set_default_value(const Variant &val);
|
2022-06-06 23:01:34 +02:00
|
|
|
Ref<Image> get_active_image();
|
2022-06-06 22:04:36 +02:00
|
|
|
|
|
|
|
MMNodeUniversalProperty();
|
|
|
|
~MMNodeUniversalProperty();
|
|
|
|
|
|
|
|
protected:
|
2022-06-07 10:55:42 +02:00
|
|
|
void _notification(int p_what);
|
2022-06-06 22:04:36 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2022-06-06 23:01:34 +02:00
|
|
|
//export(int, "Int,Float,Vector2,Vector3,Color,Image")
|
|
|
|
int default_type;
|
|
|
|
//export(int)
|
|
|
|
int default_int;
|
|
|
|
//export(float)
|
|
|
|
float default_float;
|
|
|
|
//export(Vector2)
|
|
|
|
Vector2 default_vector2;
|
|
|
|
//export(Vector3)
|
|
|
|
Vector3 default_vector3;
|
|
|
|
//export(Color)
|
|
|
|
Color default_color;
|
|
|
|
//export(Image)
|
|
|
|
Ref<Image> default_image;
|
|
|
|
bool get_value_from_owner;
|
|
|
|
bool force_override;
|
|
|
|
|
|
|
|
//This is not exported on purpose!
|
|
|
|
Ref<Image> override_image;
|
|
|
|
|
|
|
|
Ref<MMNodeUniversalProperty> input_property;
|
|
|
|
|
|
|
|
int input_slot_type;
|
|
|
|
int output_slot_type;
|
|
|
|
String slot_name;
|
|
|
|
float value_step;
|
|
|
|
Vector2 value_range;
|
|
|
|
|
|
|
|
Ref<MMNode> owner;
|
2022-06-06 22:04:36 +02:00
|
|
|
};
|
|
|
|
|
2022-06-07 10:55:42 +02:00
|
|
|
VARIANT_ENUM_CAST(MMNodeUniversalProperty::SlotTypes);
|
|
|
|
VARIANT_ENUM_CAST(MMNodeUniversalProperty::MMNodeUniversalPropertyDefaultType);
|
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
#endif
|