Cleaned up MMTransform.

This commit is contained in:
Relintai 2022-06-16 19:26:46 +02:00
parent 20af76c795
commit 9ff5be15e5
5 changed files with 223 additions and 291 deletions

View File

@ -54,6 +54,7 @@ sources = [
"nodes/uniform/greyscale_uniform.cpp", "nodes/uniform/greyscale_uniform.cpp",
"nodes/transform/translate.cpp", "nodes/transform/translate.cpp",
"nodes/transform/transform.cpp",
] ]
if env["tools"]: if env["tools"]:

View File

@ -24,6 +24,7 @@ def get_doc_classes():
"MMGreyscaleUniform", "MMGreyscaleUniform",
"MMTranslate", "MMTranslate",
"MMTransform",
] ]
def get_doc_path(): def get_doc_path():

View File

@ -1,296 +1,233 @@
#include "transform.h" #include "transform.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
Ref<Resource> Transform::get_image() { Ref<MMNodeUniversalProperty> MMTransform::get_image() {
return image; return image;
} }
void Transform::set_image(const Ref<Resource> &val) { void MMTransform::set_image(const Ref<MMNodeUniversalProperty> &val) {
image = val; image = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_input() {
Ref<Resource> Transform::get_input() { return input;
return input;
} }
void Transform::set_input(const Ref<Resource> &val) { void MMTransform::set_input(const Ref<MMNodeUniversalProperty> &val) {
input = val; input = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_translate_x() {
Ref<Resource> Transform::get_translate_x() { return translate_x;
return translate_x;
} }
void Transform::set_translate_x(const Ref<Resource> &val) { void MMTransform::set_translate_x(const Ref<MMNodeUniversalProperty> &val) {
translate_x = val; translate_x = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_translate_y() {
Ref<Resource> Transform::get_translate_y() { return translate_y;
return translate_y;
} }
void Transform::set_translate_y(const Ref<Resource> &val) { void MMTransform::set_translate_y(const Ref<MMNodeUniversalProperty> &val) {
translate_y = val; translate_y = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_rotate() {
Ref<Resource> Transform::get_rotate() { return rotate;
return rotate;
} }
void Transform::set_rotate(const Ref<Resource> &val) { void MMTransform::set_rotate(const Ref<MMNodeUniversalProperty> &val) {
rotate = val; rotate = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_scale_x() {
Ref<Resource> Transform::get_scale_x() { return scale_x;
return scale_x;
} }
void Transform::set_scale_x(const Ref<Resource> &val) { void MMTransform::set_scale_x(const Ref<MMNodeUniversalProperty> &val) {
scale_x = val; scale_x = val;
} }
Ref<MMNodeUniversalProperty> MMTransform::get_scale_y() {
Ref<Resource> Transform::get_scale_y() { return scale_y;
return scale_y;
} }
void Transform::set_scale_y(const Ref<Resource> &val) { void MMTransform::set_scale_y(const Ref<MMNodeUniversalProperty> &val) {
scale_y = val; scale_y = val;
} }
int MMTransform::get_mode() const {
int Transform::get_mode() const { return mode;
return mode;
} }
void Transform::set_mode(const int val) { void MMTransform::set_mode(const int val) {
mode = val; mode = val;
set_dirty(true);
} }
void MMTransform::_init_properties() {
if (!input.is_valid()) {
input.instance();
input->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_COLOR);
input->set_default_value(Color(0, 0, 0, 1));
}
input->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
input->set_slot_name(">>> Input ");
//tool; if (!image.is_valid()) {
//export(Resource) ; image.instance();
Ref<Resource> image; image->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_IMAGE);
//export(Resource) ; }
Ref<Resource> input;
//export(Resource) ;
Ref<Resource> translate_x;
//export(Resource) ;
Ref<Resource> translate_y;
//export(Resource) ;
Ref<Resource> rotate;
//export(Resource) ;
Ref<Resource> scale_x;
//export(Resource) ;
Ref<Resource> scale_y;
//export(int, "Clamp,Repeat,Extend") ;
int mode = 0;
void Transform::_init_properties() { //image.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
image->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_IMAGE);
//image.force_override = true;
if (!input) { if (!translate_x.is_valid()) {
input = MMNodeUniversalProperty.new(); translate_x.instance();
input.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_COLOR; translate_x->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
input.set_default_value(Color(0, 0, 0, 1)); translate_x->set_default_value(0);
translate_x->set_value_step(0.01);
}
translate_x->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
translate_x->set_slot_name("Translate X");
if (!translate_y.is_valid()) {
translate_y.instance();
translate_y->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
translate_y->set_default_value(0);
translate_y->set_value_step(0.01);
}
translate_y->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
translate_y->set_slot_name("Translate Y");
if (!rotate.is_valid()) {
rotate.instance();
rotate->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
rotate->set_default_value(0);
rotate->set_value_step(0.01);
}
rotate->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
rotate->set_slot_name("Rotate");
if (!scale_x.is_valid()) {
scale_x.instance();
scale_x->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
scale_x->set_default_value(1);
scale_x->set_value_step(0.01);
}
scale_x->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
scale_x->set_slot_name("Scale X");
if (!scale_y.is_valid()) {
scale_y.instance();
scale_y->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
scale_y->set_default_value(1);
scale_y->set_value_step(0.01);
}
scale_y->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
scale_y->set_slot_name("Scale Y");
register_input_property(input);
register_output_property(image);
register_input_property(translate_x);
register_input_property(translate_y);
register_input_property(rotate);
register_input_property(scale_x);
register_input_property(scale_y);
} }
input.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL; void MMTransform::_register_methods(MMGraphNode *mm_graph_node) {
input.slot_name = ">>> Input "; mm_graph_node->add_slot_label_universal(input);
mm_graph_node->add_slot_texture_universal(image);
mm_graph_node->add_slot_float_universal(translate_x);
mm_graph_node->add_slot_float_universal(translate_y);
mm_graph_node->add_slot_float_universal(rotate);
mm_graph_node->add_slot_float_universal(scale_x);
mm_graph_node->add_slot_float_universal(scale_y);
if (!image) { Array arr;
image = MMNodeUniversalProperty.new(); arr.push_back("Clamp");
image.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_IMAGE; arr.push_back("Repeat");
arr.push_back("Extend");
mm_graph_node->add_slot_enum("get_mode", "set_mode", "Mode", arr);
} }
//image.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT; void MMTransform::_render(const Ref<MMMaterial> &material) {
image.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_IMAGE; Ref<Image> img = render_image(material);
//image.force_override = true; image->set_value(img);
if (!translate_x) {
translate_x = MMNodeUniversalProperty.new();
translate_x.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
translate_x.set_default_value(0);
translate_x.value_step = 0.01;
} }
translate_x.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL; Color MMTransform::_get_value_for(const Vector2 &uv, const int pseed) {
translate_x.slot_name = "Translate X"; //$i($mode(transform2($uv, vec2($translate_x*(2.0*$tx($uv)-1.0), $translate_y*(2.0*$ty($uv)-1.0)), $rotate*0.01745329251*(2.0*$r($uv)-1.0), vec2($scale_x*(2.0*$sx($uv)-1.0), $scale_y*(2.0*$sy($uv)-1.0)))))",;
//Mode:;
//Clamp -> transform2_clamp;
//Repeat -> fract;
//Extend -> "";
Vector2 tr = Vector2(float(translate_x->get_default_value()) * (2.0 * float(translate_x->get_value_or_zero(uv)) - 1.0), float(translate_y->get_default_value()) * (2.0 * float(translate_y->get_value_or_zero(uv)) - 1.0));
float rot = float(rotate->get_default_value()) * 0.01745329251 * (2.0 * float(rotate->get_value_or_zero(uv)) - 1.0);
Vector2 sc = Vector2(float(scale_x->get_default_value()) * (2.0 * float(scale_x->get_value_or_zero(uv)) - 1.0), float(scale_y->get_default_value()) * (2.0 * float(scale_y->get_value_or_zero(uv)) - 1.0));
Vector2 nuv = MMAlgos::transform2(uv, tr, rot, sc);
if (!translate_y) { if (mode == 0) {
translate_y = MMNodeUniversalProperty.new(); nuv = MMAlgos::transform2_clamp(nuv);
translate_y.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT; }
translate_y.set_default_value(0);
translate_y.value_step = 0.01; else if (mode == 1) {
nuv = MMAlgos::fractv2(nuv);
}
return input->get_value(nuv);
} }
translate_y.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL; MMTransform::MMTransform() {
translate_y.slot_name = "Translate Y"; mode = 0;
if (!rotate) {
rotate = MMNodeUniversalProperty.new();
rotate.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
rotate.set_default_value(0);
rotate.value_step = 0.01;
} }
rotate.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL; MMTransform::~MMTransform() {
rotate.slot_name = "Rotate";
if (!scale_x) {
scale_x = MMNodeUniversalProperty.new();
scale_x.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
scale_x.set_default_value(1);
scale_x.value_step = 0.01;
} }
scale_x.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL; void MMTransform::_bind_methods() {
scale_x.slot_name = "Scale X"; ClassDB::bind_method(D_METHOD("get_image"), &MMTransform::get_image);
ClassDB::bind_method(D_METHOD("set_image", "value"), &MMTransform::set_image);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_image", "get_image");
if (!scale_y) { ClassDB::bind_method(D_METHOD("get_input"), &MMTransform::get_input);
scale_y = MMNodeUniversalProperty.new(); ClassDB::bind_method(D_METHOD("set_input", "value"), &MMTransform::set_input);
scale_y.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT; ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_input", "get_input");
scale_y.set_default_value(1);
scale_y.value_step = 0.01; ClassDB::bind_method(D_METHOD("get_translate_x"), &MMTransform::get_translate_x);
ClassDB::bind_method(D_METHOD("set_translate_x", "value"), &MMTransform::set_translate_x);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "translate_x", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_translate_x", "get_translate_x");
ClassDB::bind_method(D_METHOD("get_translate_y"), &MMTransform::get_translate_y);
ClassDB::bind_method(D_METHOD("set_translate_y", "value"), &MMTransform::set_translate_y);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "translate_y", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_translate_y", "get_translate_y");
ClassDB::bind_method(D_METHOD("get_rotate"), &MMTransform::get_rotate);
ClassDB::bind_method(D_METHOD("set_rotate", "value"), &MMTransform::set_rotate);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "rotate", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_rotate", "get_rotate");
ClassDB::bind_method(D_METHOD("get_scale_x"), &MMTransform::get_scale_x);
ClassDB::bind_method(D_METHOD("set_scale_x", "value"), &MMTransform::set_scale_x);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scale_x", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_scale_x", "get_scale_x");
ClassDB::bind_method(D_METHOD("get_scale_y"), &MMTransform::get_scale_y);
ClassDB::bind_method(D_METHOD("set_scale_y", "value"), &MMTransform::set_scale_y);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scale_y", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_scale_y", "get_scale_y");
ClassDB::bind_method(D_METHOD("get_mode"), &MMTransform::get_mode);
ClassDB::bind_method(D_METHOD("set_mode", "value"), &MMTransform::set_mode);
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode"), "set_mode", "get_mode");
} }
scale_y.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
scale_y.slot_name = "Scale Y";
register_input_property(input);
register_output_property(image);
register_input_property(translate_x);
register_input_property(translate_y);
register_input_property(rotate);
register_input_property(scale_x);
register_input_property(scale_y);
}
void Transform::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(input);
mm_graph_node.add_slot_texture_universal(image);
mm_graph_node.add_slot_float_universal(translate_x);
mm_graph_node.add_slot_float_universal(translate_y);
mm_graph_node.add_slot_float_universal(rotate);
mm_graph_node.add_slot_float_universal(scale_x);
mm_graph_node.add_slot_float_universal(scale_y);
mm_graph_node.add_slot_enum("get_mode", "set_mode", "Mode", [ "Clamp", "Repeat", "Extend" ]);
}
void Transform::_render(const Variant &material) {
Ref<Image> img = render_image(material);
image.set_value(img);
}
Color Transform::_get_value_for(const Vector2 &uv, const int pseed) {
//$i($mode(transform2($uv, vec2($translate_x*(2.0*$tx($uv)-1.0), $translate_y*(2.0*$ty($uv)-1.0)), $rotate*0.01745329251*(2.0*$r($uv)-1.0), vec2($scale_x*(2.0*$sx($uv)-1.0), $scale_y*(2.0*$sy($uv)-1.0)))))",;
//Mode:;
//Clamp -> transform2_clamp;
//Repeat -> fract;
//Extend -> "";
Vector2 tr = Vector2(translate_x.get_default_value() * (2.0 * translate_x.get_value_or_zero(uv) - 1.0), translate_y.get_default_value() *(2.0 * translate_y.get_value_or_zero(uv) - 1.0));
float rot = rotate.get_default_value() * 0.01745329251*(2.0 * rotate.get_value_or_zero(uv) - 1.0);
Vector2 sc = Vector2(scale_x.get_default_value() *(2.0 * scale_x.get_value_or_zero(uv) - 1.0), scale_y.get_default_value() *(2.0 * scale_y.get_value_or_zero(uv) - 1.0));
Vector2 nuv = MMAlgos.transform2(uv, tr, rot, sc);
if (mode == 0) {
nuv = MMAlgos.transform2_clamp(nuv);
}
else if (mode == 1) {
nuv = MMAlgos.fractv2(nuv);
}
return input.get_value(nuv);
}
//mode;
int Transform::get_mode() {
return mode;
}
void Transform::set_mode(const int val) {
mode = val;
set_dirty(true);
}
}
Transform::Transform() {
image;
input;
translate_x;
translate_y;
rotate;
scale_x;
scale_y;
mode = 0;
}
Transform::~Transform() {
}
static void Transform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_image"), &Transform::get_image);
ClassDB::bind_method(D_METHOD("set_image", "value"), &Transform::set_image);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_image", "get_image");
ClassDB::bind_method(D_METHOD("get_input"), &Transform::get_input);
ClassDB::bind_method(D_METHOD("set_input", "value"), &Transform::set_input);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input", "get_input");
ClassDB::bind_method(D_METHOD("get_translate_x"), &Transform::get_translate_x);
ClassDB::bind_method(D_METHOD("set_translate_x", "value"), &Transform::set_translate_x);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "translate_x", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_translate_x", "get_translate_x");
ClassDB::bind_method(D_METHOD("get_translate_y"), &Transform::get_translate_y);
ClassDB::bind_method(D_METHOD("set_translate_y", "value"), &Transform::set_translate_y);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "translate_y", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_translate_y", "get_translate_y");
ClassDB::bind_method(D_METHOD("get_rotate"), &Transform::get_rotate);
ClassDB::bind_method(D_METHOD("set_rotate", "value"), &Transform::set_rotate);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "rotate", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_rotate", "get_rotate");
ClassDB::bind_method(D_METHOD("get_scale_x"), &Transform::get_scale_x);
ClassDB::bind_method(D_METHOD("set_scale_x", "value"), &Transform::set_scale_x);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scale_x", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_scale_x", "get_scale_x");
ClassDB::bind_method(D_METHOD("get_scale_y"), &Transform::get_scale_y);
ClassDB::bind_method(D_METHOD("set_scale_y", "value"), &Transform::set_scale_y);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scale_y", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_scale_y", "get_scale_y");
ClassDB::bind_method(D_METHOD("get_mode"), &Transform::get_mode);
ClassDB::bind_method(D_METHOD("set_mode", "value"), &Transform::set_mode);
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode"), "set_mode", "get_mode");
ClassDB::bind_method(D_METHOD("_init_properties"), &Transform::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &Transform::_register_methods);
ClassDB::bind_method(D_METHOD("_render", "material"), &Transform::_render);
ClassDB::bind_method(D_METHOD("_get_value_for", "uv", "pseed"), &Transform::_get_value_for);
ClassDB::bind_method(D_METHOD("get_mode"), &Transform::get_mode);
ClassDB::bind_method(D_METHOD("set_mode", "val"), &Transform::set_mode);
}

View File

@ -1,68 +1,57 @@
#ifndef TRANSFORM_H #ifndef MM_TRANSFORM_H
#define TRANSFORM_H #define MM_TRANSFORM_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class Transform : public MMNode { class MMTransform : public MMNode {
GDCLASS(Transform, MMNode); GDCLASS(MMTransform, MMNode);
public: public:
Ref<MMNodeUniversalProperty> get_image();
void set_image(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_image(); Ref<MMNodeUniversalProperty> get_input();
void set_image(const Ref<Resource> &val); void set_input(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input(); Ref<MMNodeUniversalProperty> get_translate_x();
void set_input(const Ref<Resource> &val); void set_translate_x(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_translate_x(); Ref<MMNodeUniversalProperty> get_translate_y();
void set_translate_x(const Ref<Resource> &val); void set_translate_y(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_translate_y(); Ref<MMNodeUniversalProperty> get_rotate();
void set_translate_y(const Ref<Resource> &val); void set_rotate(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_rotate(); Ref<MMNodeUniversalProperty> get_scale_x();
void set_rotate(const Ref<Resource> &val); void set_scale_x(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_scale_x(); Ref<MMNodeUniversalProperty> get_scale_y();
void set_scale_x(const Ref<Resource> &val); void set_scale_y(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_scale_y(); int get_mode() const;
void set_scale_y(const Ref<Resource> &val); void set_mode(const int val);
int get_mode() const; void _init_properties();
void set_mode(const int val); void _register_methods(MMGraphNode *mm_graph_node);
void _render(const Ref<MMMaterial> &material);
Color _get_value_for(const Vector2 &uv, const int pseed);
void _init_properties(); MMTransform();
void _register_methods(const Variant &mm_graph_node); ~MMTransform();
void _render(const Variant &material);
Color _get_value_for(const Vector2 &uv, const int pseed);
int get_mode();
void set_mode(const int val);
Transform(); protected:
~Transform(); static void _bind_methods();
protected: Ref<MMNodeUniversalProperty> image;
static void _bind_methods(); Ref<MMNodeUniversalProperty> input;
Ref<MMNodeUniversalProperty> translate_x;
//tool Ref<MMNodeUniversalProperty> translate_y;
//export(Resource) Ref<MMNodeUniversalProperty> rotate;
Ref<Resource> image; Ref<MMNodeUniversalProperty> scale_x;
//export(Resource) Ref<MMNodeUniversalProperty> scale_y;
Ref<Resource> input; //export(int, "Clamp,Repeat,Extend")
//export(Resource) int mode;
Ref<Resource> translate_x;
//export(Resource)
Ref<Resource> translate_y;
//export(Resource)
Ref<Resource> rotate;
//export(Resource)
Ref<Resource> scale_x;
//export(Resource)
Ref<Resource> scale_y;
//export(int, "Clamp,Repeat,Extend")
int mode = 0;
//mode
}; };
#endif #endif

View File

@ -45,6 +45,7 @@ SOFTWARE.
#include "nodes/uniform/greyscale_uniform.h" #include "nodes/uniform/greyscale_uniform.h"
#include "nodes/uniform/uniform.h" #include "nodes/uniform/uniform.h"
#include "nodes/transform/transform.h"
#include "nodes/transform/translate.h" #include "nodes/transform/translate.h"
static _MMAlgos *_mm_algos_singleton = nullptr; static _MMAlgos *_mm_algos_singleton = nullptr;
@ -71,6 +72,9 @@ void register_material_maker_types() {
ClassDB::register_class<MMTranslate>(); ClassDB::register_class<MMTranslate>();
MMAlgos::register_node_class("Transform", "MMTranslate"); MMAlgos::register_node_class("Transform", "MMTranslate");
ClassDB::register_class<MMTransform>();
MMAlgos::register_node_class("Transform", "MMTransform");
_mm_algos_singleton = memnew(_MMAlgos); _mm_algos_singleton = memnew(_MMAlgos);
Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton()));