Cleaned up the sdf2d operations.

This commit is contained in:
Relintai 2022-06-17 21:38:22 +02:00
parent f2fb6b8b7d
commit efb00f2fbb
17 changed files with 720 additions and 1089 deletions

View File

@ -92,6 +92,8 @@ sources = [
"nodes/sdf3d/sdf3d_op_circle_repeat.cpp",
"nodes/sdf3d/sdf3d_op_bool.cpp",
"nodes/sdf2d/sd_show.cpp",
"nodes/sdf2d/sd_shape_rhombus.cpp",
"nodes/sdf2d/sd_shape_polygon.cpp",
"nodes/sdf2d/sd_shape_line.cpp",
@ -103,8 +105,13 @@ sources = [
"nodes/sdf2d/sd_tf_scale.cpp",
"nodes/sdf2d/sd_tf_rotate.cpp",
"nodes/sdf2d/sd_show.cpp",
"nodes/sdf2d/sd_op_smooth_bool.cpp",
"nodes/sdf2d/sd_op_rounded_shape.cpp",
"nodes/sdf2d/sd_op_repeat.cpp",
"nodes/sdf2d/sd_op_morph.cpp",
"nodes/sdf2d/sd_op_circle_repeat.cpp",
"nodes/sdf2d/sd_op_bool.cpp",
"nodes/sdf2d/sd_op_annular_shape.cpp",
]
if env["tools"]:

View File

@ -74,6 +74,14 @@ def get_doc_classes():
"MMSdShapeCircle",
"MMSdShapeBox",
"MMSdShapeArc",
"MMSdOpSmoothBool",
"MMSdOpRoundedShape",
"MMSdOpRepeat",
"MMSdOpMorph",
"MMSdOpCircleRepeat",
"MMSdOpBool",
"MMSdOpAnnularShape",
]
def get_doc_path():

View File

@ -1,135 +1,83 @@
#include "sd_op_annular_shape.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpAnnularShape::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpAnnularShape::get_output() {
return output;
}
void SdOpAnnularShape::set_output(const Ref<Resource> &val) {
void MMSdOpAnnularShape::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
float SdOpAnnularShape::get_width() const {
float MMSdOpAnnularShape::get_width() const {
return width;
}
void SdOpAnnularShape::set_width(const float val) {
void MMSdOpAnnularShape::set_width(const float val) {
width = val;
emit_changed();
output->do_emit_changed();
}
int SdOpAnnularShape::get_ripples() const {
int MMSdOpAnnularShape::get_ripples() const {
return ripples;
}
void SdOpAnnularShape::set_ripples(const int val) {
void MMSdOpAnnularShape::set_ripples(const int val) {
ripples = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> output;
//export(float) ;
float width = 0.1;
//export(int) ;
int ripples = 1;
void SdOpAnnularShape::_init_properties() {
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpAnnularShape::_init_properties() {
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
//output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = ">>> Apply >>>";
output.get_value_from_owner = true;
output->set_slot_name(">>> Apply >>>");
output->set_get_value_from_owner(true);
register_input_property(output);
register_output_property(output);
}
void SdOpAnnularShape::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_float("get_width", "set_width", "Width", 0.01);
mm_graph_node.add_slot_int("get_ripples", "set_ripples", "Ripples");
void MMSdOpAnnularShape::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(output);
mm_graph_node->add_slot_float("get_width", "set_width", "Width", 0.01);
mm_graph_node->add_slot_int("get_ripples", "set_ripples", "Ripples");
}
void SdOpAnnularShape::_get_property_value(const Vector2 &uv) {
float val = output.get_value(uv, true);
return MMAlgos.sdRipples(val, width, ripples);
Variant MMSdOpAnnularShape::_get_property_value(const Vector2 &uv) {
float val = output->get_value(uv, true);
return MMAlgos::sdRipples(val, width, ripples);
}
//width;
float SdOpAnnularShape::get_width() {
return width;
}
void SdOpAnnularShape::set_width(const float val) {
width = val;
emit_changed();
output.emit_changed();
}
//ripples;
int SdOpAnnularShape::get_ripples() {
return ripples;
}
void SdOpAnnularShape::set_ripples(const int val) {
ripples = val;
emit_changed();
output.emit_changed();
}
}
SdOpAnnularShape::SdOpAnnularShape() {
output;
MMSdOpAnnularShape::MMSdOpAnnularShape() {
width = 0.1;
ripples = 1;
}
SdOpAnnularShape::~SdOpAnnularShape() {
MMSdOpAnnularShape::~MMSdOpAnnularShape() {
}
void MMSdOpAnnularShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpAnnularShape::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpAnnularShape::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
static void SdOpAnnularShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &SdOpAnnularShape::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpAnnularShape::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_width"), &SdOpAnnularShape::get_width);
ClassDB::bind_method(D_METHOD("set_width", "value"), &SdOpAnnularShape::set_width);
ClassDB::bind_method(D_METHOD("get_width"), &MMSdOpAnnularShape::get_width);
ClassDB::bind_method(D_METHOD("set_width", "value"), &MMSdOpAnnularShape::set_width);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "width"), "set_width", "get_width");
ClassDB::bind_method(D_METHOD("get_ripples"), &SdOpAnnularShape::get_ripples);
ClassDB::bind_method(D_METHOD("set_ripples", "value"), &SdOpAnnularShape::set_ripples);
ClassDB::bind_method(D_METHOD("get_ripples"), &MMSdOpAnnularShape::get_ripples);
ClassDB::bind_method(D_METHOD("set_ripples", "value"), &MMSdOpAnnularShape::set_ripples);
ADD_PROPERTY(PropertyInfo(Variant::INT, "ripples"), "set_ripples", "get_ripples");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpAnnularShape::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpAnnularShape::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpAnnularShape::_get_property_value);
ClassDB::bind_method(D_METHOD("get_width"), &SdOpAnnularShape::get_width);
ClassDB::bind_method(D_METHOD("set_width", "val"), &SdOpAnnularShape::set_width);
ClassDB::bind_method(D_METHOD("get_ripples"), &SdOpAnnularShape::get_ripples);
ClassDB::bind_method(D_METHOD("set_ripples", "val"), &SdOpAnnularShape::set_ripples);
}

View File

@ -1,14 +1,15 @@
#ifndef SD_OP_ANNULAR_SHAPE_H
#define SD_OP_ANNULAR_SHAPE_H
#ifndef MM_SD_OP_ANNULAR_SHAPE_H
#define MM_SD_OP_ANNULAR_SHAPE_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpAnnularShape : public MMNode {
GDCLASS(SdOpAnnularShape, MMNode);
class MMSdOpAnnularShape : public MMNode {
GDCLASS(MMSdOpAnnularShape, MMNode);
public:
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
float get_width() const;
void set_width(const float val);
@ -17,29 +18,18 @@ class SdOpAnnularShape : public MMNode {
void set_ripples(const int val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
void _get_property_value(const Vector2 &uv);
float get_width();
void set_width(const float val);
int get_ripples();
void set_ripples(const int val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
SdOpAnnularShape();
~SdOpAnnularShape();
MMSdOpAnnularShape();
~MMSdOpAnnularShape();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> output;
//export(float)
float width = 0.1;
//export(int)
int ripples = 1;
//width
//ripples
Ref<MMNodeUniversalProperty> output;
float width;
int ripples;
};
#endif

View File

@ -1,187 +1,139 @@
#include "sd_op_bool.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpBool::get_input1() {
Ref<MMNodeUniversalProperty> MMSdOpBool::get_input1() {
return input1;
}
void SdOpBool::set_input1(const Ref<Resource> &val) {
void MMSdOpBool::set_input1(const Ref<MMNodeUniversalProperty> &val) {
input1 = val;
}
Ref<Resource> SdOpBool::get_input2() {
Ref<MMNodeUniversalProperty> MMSdOpBool::get_input2() {
return input2;
}
void SdOpBool::set_input2(const Ref<Resource> &val) {
void MMSdOpBool::set_input2(const Ref<MMNodeUniversalProperty> &val) {
input2 = val;
}
Ref<Resource> SdOpBool::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpBool::get_output() {
return output;
}
void SdOpBool::set_output(const Ref<Resource> &val) {
void MMSdOpBool::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
int SdOpBool::get_operation() const {
int MMSdOpBool::get_operation() const {
return operation;
}
void SdOpBool::set_operation(const int val) {
void MMSdOpBool::set_operation(const int val) {
operation = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> input1;
//export(Resource) ;
Ref<Resource> input2;
//export(Resource) ;
Ref<Resource> output;
//export(int, "Union,Substraction,Intersection") ;
int operation = 0;
void SdOpBool::_init_properties() {
if (!input1) {
input1 = MMNodeUniversalProperty.new();
input1.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpBool::_init_properties() {
if (!input1.is_valid()) {
input1.instance();
input1->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input1->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input1.slot_name = ">>> Input 1 ";
input1->set_slot_name(">>> Input 1 ");
if (!input1.is_connected("changed", self, "on_input_changed")) {
input1.connect("changed", self, "on_input_changed");
if (!input1->is_connected("changed", this, "on_input_changed")) {
input1->connect("changed", this, "on_input_changed");
}
if (!input2) {
input2 = MMNodeUniversalProperty.new();
input2.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!input2.is_valid()) {
input2.instance();
input2->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input2->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input2.slot_name = ">>> Input 2 ";
input2->set_slot_name(">>> Input 2 ");
if (!input2.is_connected("changed", self, "on_input_changed")) {
input2.connect("changed", self, "on_input_changed");
if (!input2->is_connected("changed", this, "on_input_changed")) {
input2->connect("changed", this, "on_input_changed");
}
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = " Output >>>";
output.get_value_from_owner = true;
output->set_slot_name(" Output >>>");
output->set_get_value_from_owner(true);
register_input_property(input1);
register_input_property(input2);
register_output_property(output);
}
void MMSdOpBool::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(input1);
mm_graph_node->add_slot_label_universal(input2);
mm_graph_node->add_slot_label_universal(output);
void SdOpBool::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(input1);
mm_graph_node.add_slot_label_universal(input2);
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_enum("get_operation", "set_operation", "Operation", [ "Union", "Substraction", "Intersection" ]);
Array arr;
arr.push_back("Union");
arr.push_back("Substraction");
arr.push_back("Intersection");
mm_graph_node->add_slot_enum("get_operation", "set_operation", "Operation", arr);
}
float SdOpBool::_get_property_value(const Vector2 &uv) {
Variant MMSdOpBool::_get_property_value(const Vector2 &uv) {
if (operation == 0) {
return MMAlgos.sdf_boolean_union(input1.get_value(uv), input2.get_value(uv));
}
else if (operation == 1) {
return MMAlgos.sdf_boolean_substraction(input1.get_value(uv), input2.get_value(uv));
}
else if (operation == 2) {
return MMAlgos.sdf_boolean_intersection(input1.get_value(uv), input2.get_value(uv));
return MMAlgos::sdf_boolean_union(input1->get_value(uv), input2->get_value(uv));
} else if (operation == 1) {
return MMAlgos::sdf_boolean_substraction(input1->get_value(uv), input2->get_value(uv));
} else if (operation == 2) {
return MMAlgos::sdf_boolean_intersection(input1->get_value(uv), input2->get_value(uv));
}
return 0.0;
}
//operation;
int SdOpBool::get_operation() {
return operation;
}
void SdOpBool::set_operation(const int val) {
operation = val;
void MMSdOpBool::on_input_changed() {
emit_changed();
output.emit_changed();
output->do_emit_changed();
}
void SdOpBool::on_input_changed() {
emit_changed();
output.emit_changed();
}
}
SdOpBool::SdOpBool() {
input1;
input2;
output;
MMSdOpBool::MMSdOpBool() {
operation = 0;
}
SdOpBool::~SdOpBool() {
MMSdOpBool::~MMSdOpBool() {
}
void MMSdOpBool::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &MMSdOpBool::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &MMSdOpBool::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input1", "get_input1");
static void SdOpBool::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &SdOpBool::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &SdOpBool::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input1", "get_input1");
ClassDB::bind_method(D_METHOD("get_input2"), &MMSdOpBool::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &MMSdOpBool::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpBool::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpBool::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_input2"), &SdOpBool::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &SdOpBool::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &SdOpBool::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpBool::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_operation"), &SdOpBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "value"), &SdOpBool::set_operation);
ClassDB::bind_method(D_METHOD("get_operation"), &MMSdOpBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "value"), &MMSdOpBool::set_operation);
ADD_PROPERTY(PropertyInfo(Variant::INT, "operation"), "set_operation", "get_operation");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpBool::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpBool::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpBool::_get_property_value);
ClassDB::bind_method(D_METHOD("get_operation"), &SdOpBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "val"), &SdOpBool::set_operation);
ClassDB::bind_method(D_METHOD("on_input_changed"), &SdOpBool::on_input_changed);
ClassDB::bind_method(D_METHOD("on_input_changed"), &MMSdOpBool::on_input_changed);
}

View File

@ -1,48 +1,42 @@
#ifndef SD_OP_BOOL_H
#define SD_OP_BOOL_H
#ifndef MM_SD_OP_BOOL_H
#define MM_SD_OP_BOOL_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpBool : public MMNode {
GDCLASS(SdOpBool, MMNode);
class MMSdOpBool : public MMNode {
GDCLASS(MMSdOpBool, MMNode);
public:
Ref<MMNodeUniversalProperty> get_input1();
void set_input1(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input1();
void set_input1(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_input2();
void set_input2(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input2();
void set_input2(const Ref<Resource> &val);
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
int get_operation() const;
void set_operation(const int val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
float _get_property_value(const Vector2 &uv);
int get_operation();
void set_operation(const int val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
void on_input_changed();
SdOpBool();
~SdOpBool();
MMSdOpBool();
~MMSdOpBool();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> input1;
//export(Resource)
Ref<Resource> input2;
//export(Resource)
Ref<Resource> output;
Ref<MMNodeUniversalProperty> input1;
Ref<MMNodeUniversalProperty> input2;
Ref<MMNodeUniversalProperty> output;
//export(int, "Union,Substraction,Intersection")
int operation = 0;
//operation
int operation;
};
#endif

View File

@ -1,103 +1,69 @@
#include "sd_op_circle_repeat.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpCircleRepeat::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpCircleRepeat::get_output() {
return output;
}
void SdOpCircleRepeat::set_output(const Ref<Resource> &val) {
void MMSdOpCircleRepeat::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
int SdOpCircleRepeat::get_count() const {
int MMSdOpCircleRepeat::get_count() const {
return count;
}
void SdOpCircleRepeat::set_count(const int val) {
void MMSdOpCircleRepeat::set_count(const int val) {
count = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> output;
//export(int) ;
int count = 6;
void SdOpCircleRepeat::_init_properties() {
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpCircleRepeat::_init_properties() {
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
//output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = ">>> Apply >>>";
output.get_value_from_owner = true;
output->set_slot_name(">>> Apply >>>");
output->set_get_value_from_owner(true);
register_input_property(output);
register_output_property(output);
}
void SdOpCircleRepeat::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_int("get_count", "set_count", "Count");
void MMSdOpCircleRepeat::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(output);
mm_graph_node->add_slot_int("get_count", "set_count", "Count");
}
void SdOpCircleRepeat::_get_property_value(const Vector2 &uv) {
Variant MMSdOpCircleRepeat::_get_property_value(const Vector2 &uv) {
//$in(circle_repeat_transform_2d($uv-vec2(0.5), $c)+vec2(0.5));
Vector2 new_uv = MMAlgos.circle_repeat_transform_2d(uv - Vector2(0.5, 0.5), count) + Vector2(0.5, 0.5);
return output.get_value(new_uv, true);
Vector2 new_uv = MMAlgos::circle_repeat_transform_2d(uv - Vector2(0.5, 0.5), count) + Vector2(0.5, 0.5);
return output->get_value(new_uv, true);
}
//count;
int SdOpCircleRepeat::get_count() {
return count;
}
void SdOpCircleRepeat::set_count(const int val) {
count = val;
emit_changed();
output.emit_changed();
}
}
SdOpCircleRepeat::SdOpCircleRepeat() {
output;
MMSdOpCircleRepeat::MMSdOpCircleRepeat() {
count = 6;
}
SdOpCircleRepeat::~SdOpCircleRepeat() {
MMSdOpCircleRepeat::~MMSdOpCircleRepeat() {
}
void MMSdOpCircleRepeat::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpCircleRepeat::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpCircleRepeat::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
static void SdOpCircleRepeat::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &SdOpCircleRepeat::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpCircleRepeat::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_count"), &SdOpCircleRepeat::get_count);
ClassDB::bind_method(D_METHOD("set_count", "value"), &SdOpCircleRepeat::set_count);
ClassDB::bind_method(D_METHOD("get_count"), &MMSdOpCircleRepeat::get_count);
ClassDB::bind_method(D_METHOD("set_count", "value"), &MMSdOpCircleRepeat::set_count);
ADD_PROPERTY(PropertyInfo(Variant::INT, "count"), "set_count", "get_count");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpCircleRepeat::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpCircleRepeat::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpCircleRepeat::_get_property_value);
ClassDB::bind_method(D_METHOD("get_count"), &SdOpCircleRepeat::get_count);
ClassDB::bind_method(D_METHOD("set_count", "val"), &SdOpCircleRepeat::set_count);
}

View File

@ -1,37 +1,31 @@
#ifndef SD_OP_CIRCLE_REPEAT_H
#define SD_OP_CIRCLE_REPEAT_H
#ifndef MM_SD_OP_CIRCLE_REPEAT_H
#define MM_SD_OP_CIRCLE_REPEAT_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpCircleRepeat : public MMNode {
GDCLASS(SdOpCircleRepeat, MMNode);
class MMSdOpCircleRepeat : public MMNode {
GDCLASS(MMSdOpCircleRepeat, MMNode);
public:
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
int get_count() const;
void set_count(const int val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
void _get_property_value(const Vector2 &uv);
int get_count();
void set_count(const int val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
SdOpCircleRepeat();
~SdOpCircleRepeat();
MMSdOpCircleRepeat();
~MMSdOpCircleRepeat();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> output;
//export(int)
int count = 6;
//count
Ref<MMNodeUniversalProperty> output;
int count;
};
#endif

View File

@ -1,172 +1,125 @@
#include "sd_op_morph.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpMorph::get_input1() {
Ref<MMNodeUniversalProperty> MMSdOpMorph::get_input1() {
return input1;
}
void SdOpMorph::set_input1(const Ref<Resource> &val) {
void MMSdOpMorph::set_input1(const Ref<MMNodeUniversalProperty> &val) {
input1 = val;
}
Ref<Resource> SdOpMorph::get_input2() {
Ref<MMNodeUniversalProperty> MMSdOpMorph::get_input2() {
return input2;
}
void SdOpMorph::set_input2(const Ref<Resource> &val) {
void MMSdOpMorph::set_input2(const Ref<MMNodeUniversalProperty> &val) {
input2 = val;
}
Ref<Resource> SdOpMorph::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpMorph::get_output() {
return output;
}
void SdOpMorph::set_output(const Ref<Resource> &val) {
void MMSdOpMorph::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
float SdOpMorph::get_amount() const {
float MMSdOpMorph::get_amount() const {
return amount;
}
void SdOpMorph::set_amount(const float val) {
void MMSdOpMorph::set_amount(const float val) {
amount = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> input1;
//export(Resource) ;
Ref<Resource> input2;
//export(Resource) ;
Ref<Resource> output;
//export(float) ;
float amount = 0.5;
void SdOpMorph::_init_properties() {
if (!input1) {
input1 = MMNodeUniversalProperty.new();
input1.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpMorph::_init_properties() {
if (!input1.is_valid()) {
input1.instance();
input1->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input1->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input1.slot_name = ">>> Input 1 ";
input1->set_slot_name(">>> Input 1 ");
if (!input1.is_connected("changed", self, "on_input_changed")) {
input1.connect("changed", self, "on_input_changed");
if (!input1->is_connected("changed", this, "on_input_changed")) {
input1->connect("changed", this, "on_input_changed");
}
if (!input2) {
input2 = MMNodeUniversalProperty.new();
input2.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!input2.is_valid()) {
input2.instance();
input2->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input2->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input2.slot_name = ">>> Input 2 ";
input2->set_slot_name(">>> Input 2 ");
if (!input2.is_connected("changed", self, "on_input_changed")) {
input2.connect("changed", self, "on_input_changed");
if (!input2->is_connected("changed", this, "on_input_changed")) {
input2->connect("changed", this, "on_input_changed");
}
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = " Output >>>";
output.get_value_from_owner = true;
output->set_slot_name(" Output >>>");
output->set_get_value_from_owner(true);
register_input_property(input1);
register_input_property(input2);
register_output_property(output);
}
void SdOpMorph::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(input1);
mm_graph_node.add_slot_label_universal(input2);
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_float("get_amount", "set_amount", "Amount", 0.01);
void MMSdOpMorph::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(input1);
mm_graph_node->add_slot_label_universal(input2);
mm_graph_node->add_slot_label_universal(output);
mm_graph_node->add_slot_float("get_amount", "set_amount", "Amount", 0.01);
}
float SdOpMorph::_get_property_value(const Vector2 &uv) {
return MMAlgos.sdf_morph(input1.get_value(uv), input2.get_value(uv), amount);
Variant MMSdOpMorph::_get_property_value(const Vector2 &uv) {
return MMAlgos::sdf_morph(input1->get_value(uv), input2->get_value(uv), amount);
}
//amount;
float SdOpMorph::get_amount() {
return amount;
}
void SdOpMorph::set_amount(const float val) {
amount = val;
void MMSdOpMorph::on_input_changed() {
emit_changed();
output.emit_changed();
output->do_emit_changed();
}
void SdOpMorph::on_input_changed() {
emit_changed();
output.emit_changed();
}
}
SdOpMorph::SdOpMorph() {
input1;
input2;
output;
MMSdOpMorph::MMSdOpMorph() {
amount = 0.5;
}
SdOpMorph::~SdOpMorph() {
MMSdOpMorph::~MMSdOpMorph() {
}
void MMSdOpMorph::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &MMSdOpMorph::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &MMSdOpMorph::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input1", "get_input1");
static void SdOpMorph::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &SdOpMorph::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &SdOpMorph::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input1", "get_input1");
ClassDB::bind_method(D_METHOD("get_input2"), &MMSdOpMorph::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &MMSdOpMorph::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpMorph::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpMorph::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_input2"), &SdOpMorph::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &SdOpMorph::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &SdOpMorph::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpMorph::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_amount"), &SdOpMorph::get_amount);
ClassDB::bind_method(D_METHOD("set_amount", "value"), &SdOpMorph::set_amount);
ClassDB::bind_method(D_METHOD("get_amount"), &MMSdOpMorph::get_amount);
ClassDB::bind_method(D_METHOD("set_amount", "value"), &MMSdOpMorph::set_amount);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "amount"), "set_amount", "get_amount");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpMorph::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpMorph::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpMorph::_get_property_value);
ClassDB::bind_method(D_METHOD("get_amount"), &SdOpMorph::get_amount);
ClassDB::bind_method(D_METHOD("set_amount", "val"), &SdOpMorph::set_amount);
ClassDB::bind_method(D_METHOD("on_input_changed"), &SdOpMorph::on_input_changed);
ClassDB::bind_method(D_METHOD("on_input_changed"), &MMSdOpMorph::on_input_changed);
}

View File

@ -1,48 +1,41 @@
#ifndef SD_OP_MORPH_H
#define SD_OP_MORPH_H
#ifndef MM_SD_OP_MORPH_H
#define MM_SD_OP_MORPH_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpMorph : public MMNode {
GDCLASS(SdOpMorph, MMNode);
class MMSdOpMorph : public MMNode {
GDCLASS(MMSdOpMorph, MMNode);
public:
Ref<MMNodeUniversalProperty> get_input1();
void set_input1(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input1();
void set_input1(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_input2();
void set_input2(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input2();
void set_input2(const Ref<Resource> &val);
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
float get_amount() const;
void set_amount(const float val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
float _get_property_value(const Vector2 &uv);
float get_amount();
void set_amount(const float val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
void on_input_changed();
SdOpMorph();
~SdOpMorph();
MMSdOpMorph();
~MMSdOpMorph();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> input1;
//export(Resource)
Ref<Resource> input2;
//export(Resource)
Ref<Resource> output;
//export(float)
float amount = 0.5;
//amount
Ref<MMNodeUniversalProperty> input1;
Ref<MMNodeUniversalProperty> input2;
Ref<MMNodeUniversalProperty> output;
float amount;
};
#endif

View File

@ -1,171 +1,102 @@
#include "sd_op_repeat.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpRepeat::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpRepeat::get_output() {
return output;
}
void SdOpRepeat::set_output(const Ref<Resource> &val) {
void MMSdOpRepeat::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
int SdOpRepeat::get_x() const {
int MMSdOpRepeat::get_x() const {
return x;
}
void SdOpRepeat::set_x(const int val) {
void MMSdOpRepeat::set_x(const int val) {
x = val;
emit_changed();
output->do_emit_changed();
}
int SdOpRepeat::get_y() const {
int MMSdOpRepeat::get_y() const {
return y;
}
void SdOpRepeat::set_y(const int val) {
void MMSdOpRepeat::set_y(const int val) {
y = val;
emit_changed();
output->do_emit_changed();
}
float SdOpRepeat::get_random_rotation() const {
float MMSdOpRepeat::get_random_rotation() const {
return random_rotation;
}
void SdOpRepeat::set_random_rotation(const float val) {
void MMSdOpRepeat::set_random_rotation(const float val) {
random_rotation = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> output;
//export(int) ;
int x = 3;
//export(int) ;
int y = 3;
//export(float) ;
float random_rotation = 0.5;
void SdOpRepeat::_init_properties() {
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpRepeat::_init_properties() {
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
//output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = ">>> Apply >>>";
output.get_value_from_owner = true;
output->set_slot_name(">>> Apply >>>");
output->set_get_value_from_owner(true);
register_input_property(output);
register_output_property(output);
}
void SdOpRepeat::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_int("get_x", "set_x", "X");
mm_graph_node.add_slot_int("get_y", "set_y", "Y");
mm_graph_node.add_slot_float("get_random_rotation", "set_random_rotation", "Random rotation", 0.01);
void MMSdOpRepeat::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(output);
mm_graph_node->add_slot_int("get_x", "set_x", "X");
mm_graph_node->add_slot_int("get_y", "set_y", "Y");
mm_graph_node->add_slot_float("get_random_rotation", "set_random_rotation", "Random rotation", 0.01);
}
void SdOpRepeat::_get_property_value(const Vector2 &uv) {
Variant MMSdOpRepeat::_get_property_value(const Vector2 &uv) {
//todo add this as a parameter;
int pseed = 123123;
//$in(repeat_2d($uv, vec2(1.0/$rx, 1.0/$ry), float($seed), $r));
Vector2 new_uv = MMAlgos.repeat_2d(uv, Vector2(1.0 / float(x), 1.0/ float(y)), 1.0/float(pseed), random_rotation);
return output.get_value(new_uv, true);
Vector2 new_uv = MMAlgos::repeat_2d(uv, Vector2(1.0 / float(x), 1.0 / float(y)), 1.0 / float(pseed), random_rotation);
return output->get_value(new_uv, true);
}
//x;
int SdOpRepeat::get_x() {
return x;
}
void SdOpRepeat::set_x(const int val) {
x = val;
emit_changed();
output.emit_changed();
}
//y;
int SdOpRepeat::get_y() {
return y;
}
void SdOpRepeat::set_y(const int val) {
y = val;
emit_changed();
output.emit_changed();
}
//random_rotation;
float SdOpRepeat::get_random_rotation() {
return random_rotation;
}
void SdOpRepeat::set_random_rotation(const float val) {
random_rotation = val;
emit_changed();
output.emit_changed();
}
}
SdOpRepeat::SdOpRepeat() {
output;
MMSdOpRepeat::MMSdOpRepeat() {
x = 3;
y = 3;
random_rotation = 0.5;
}
SdOpRepeat::~SdOpRepeat() {
MMSdOpRepeat::~MMSdOpRepeat() {
}
void MMSdOpRepeat::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpRepeat::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpRepeat::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
static void SdOpRepeat::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &SdOpRepeat::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpRepeat::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_x"), &SdOpRepeat::get_x);
ClassDB::bind_method(D_METHOD("set_x", "value"), &SdOpRepeat::set_x);
ClassDB::bind_method(D_METHOD("get_x"), &MMSdOpRepeat::get_x);
ClassDB::bind_method(D_METHOD("set_x", "value"), &MMSdOpRepeat::set_x);
ADD_PROPERTY(PropertyInfo(Variant::INT, "x"), "set_x", "get_x");
ClassDB::bind_method(D_METHOD("get_y"), &SdOpRepeat::get_y);
ClassDB::bind_method(D_METHOD("set_y", "value"), &SdOpRepeat::set_y);
ClassDB::bind_method(D_METHOD("get_y"), &MMSdOpRepeat::get_y);
ClassDB::bind_method(D_METHOD("set_y", "value"), &MMSdOpRepeat::set_y);
ADD_PROPERTY(PropertyInfo(Variant::INT, "y"), "set_y", "get_y");
ClassDB::bind_method(D_METHOD("get_random_rotation"), &SdOpRepeat::get_random_rotation);
ClassDB::bind_method(D_METHOD("set_random_rotation", "value"), &SdOpRepeat::set_random_rotation);
ClassDB::bind_method(D_METHOD("get_random_rotation"), &MMSdOpRepeat::get_random_rotation);
ClassDB::bind_method(D_METHOD("set_random_rotation", "value"), &MMSdOpRepeat::set_random_rotation);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "random_rotation"), "set_random_rotation", "get_random_rotation");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpRepeat::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpRepeat::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpRepeat::_get_property_value);
ClassDB::bind_method(D_METHOD("get_x"), &SdOpRepeat::get_x);
ClassDB::bind_method(D_METHOD("set_x", "val"), &SdOpRepeat::set_x);
ClassDB::bind_method(D_METHOD("get_y"), &SdOpRepeat::get_y);
ClassDB::bind_method(D_METHOD("set_y", "val"), &SdOpRepeat::set_y);
ClassDB::bind_method(D_METHOD("get_random_rotation"), &SdOpRepeat::get_random_rotation);
ClassDB::bind_method(D_METHOD("set_random_rotation", "val"), &SdOpRepeat::set_random_rotation);
}

View File

@ -1,14 +1,15 @@
#ifndef SD_OP_REPEAT_H
#define SD_OP_REPEAT_H
#ifndef MM_SD_OP_REPEAT_H
#define MM_SD_OP_REPEAT_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpRepeat : public MMNode {
GDCLASS(SdOpRepeat, MMNode);
class MMSdOpRepeat : public MMNode {
GDCLASS(MMSdOpRepeat, MMNode);
public:
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
int get_x() const;
void set_x(const int val);
@ -20,34 +21,19 @@ class SdOpRepeat : public MMNode {
void set_random_rotation(const float val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
void _get_property_value(const Vector2 &uv);
int get_x();
void set_x(const int val);
int get_y();
void set_y(const int val);
float get_random_rotation();
void set_random_rotation(const float val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
SdOpRepeat();
~SdOpRepeat();
MMSdOpRepeat();
~MMSdOpRepeat();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> output;
//export(int)
int x = 3;
//export(int)
int y = 3;
//export(float)
float random_rotation = 0.5;
//x
//y
//random_rotation
Ref<MMNodeUniversalProperty> output;
int x;
int y;
float random_rotation;
};
#endif

View File

@ -1,102 +1,67 @@
#include "sd_op_rounded_shape.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpRoundedShape::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpRoundedShape::get_output() {
return output;
}
void SdOpRoundedShape::set_output(const Ref<Resource> &val) {
void MMSdOpRoundedShape::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
float SdOpRoundedShape::get_radius() const {
float MMSdOpRoundedShape::get_radius() const {
return radius;
}
void SdOpRoundedShape::set_radius(const float val) {
void MMSdOpRoundedShape::set_radius(const float val) {
radius = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> output;
//export(float) ;
float radius = 0;
void SdOpRoundedShape::_init_properties() {
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpRoundedShape::_init_properties() {
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
//output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = ">>> Apply >>>";
output.get_value_from_owner = true;
output->set_slot_name(">>> Apply >>>");
output->set_get_value_from_owner(true);
register_input_property(output);
register_output_property(output);
}
void SdOpRoundedShape::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_float("get_radius", "set_radius", "Radius", 0.01);
void MMSdOpRoundedShape::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(output);
mm_graph_node->add_slot_float("get_radius", "set_radius", "Radius", 0.01);
}
void SdOpRoundedShape::_get_property_value(const Vector2 &uv) {
float val = output.get_value(uv, true);
return MMAlgos.sdf_rounded_shape(val, radius);
Variant MMSdOpRoundedShape::_get_property_value(const Vector2 &uv) {
float val = output->get_value(uv, true);
return MMAlgos::sdf_rounded_shape(val, radius);
}
//radius;
float SdOpRoundedShape::get_radius() {
return radius;
}
void SdOpRoundedShape::set_radius(const float val) {
radius = val;
emit_changed();
output.emit_changed();
}
}
SdOpRoundedShape::SdOpRoundedShape() {
output;
MMSdOpRoundedShape::MMSdOpRoundedShape() {
radius = 0;
}
SdOpRoundedShape::~SdOpRoundedShape() {
MMSdOpRoundedShape::~MMSdOpRoundedShape() {
}
void MMSdOpRoundedShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpRoundedShape::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpRoundedShape::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
static void SdOpRoundedShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_output"), &SdOpRoundedShape::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpRoundedShape::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_radius"), &SdOpRoundedShape::get_radius);
ClassDB::bind_method(D_METHOD("set_radius", "value"), &SdOpRoundedShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &MMSdOpRoundedShape::get_radius);
ClassDB::bind_method(D_METHOD("set_radius", "value"), &MMSdOpRoundedShape::set_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius"), "set_radius", "get_radius");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpRoundedShape::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpRoundedShape::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpRoundedShape::_get_property_value);
ClassDB::bind_method(D_METHOD("get_radius"), &SdOpRoundedShape::get_radius);
ClassDB::bind_method(D_METHOD("set_radius", "val"), &SdOpRoundedShape::set_radius);
}

View File

@ -1,37 +1,31 @@
#ifndef SD_OP_ROUNDED_SHAPE_H
#define SD_OP_ROUNDED_SHAPE_H
#ifndef MM_SD_OP_ROUNDED_SHAPE_H
#define MM_SD_OP_ROUNDED_SHAPE_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpRoundedShape : public MMNode {
GDCLASS(SdOpRoundedShape, MMNode);
class MMSdOpRoundedShape : public MMNode {
GDCLASS(MMSdOpRoundedShape, MMNode);
public:
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
float get_radius() const;
void set_radius(const float val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
void _get_property_value(const Vector2 &uv);
float get_radius();
void set_radius(const float val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
SdOpRoundedShape();
~SdOpRoundedShape();
MMSdOpRoundedShape();
~MMSdOpRoundedShape();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> output;
//export(float)
float radius = 0;
//radius
Ref<MMNodeUniversalProperty> output;
float radius;
};
#endif

View File

@ -1,220 +1,155 @@
#include "sd_op_smooth_bool.h"
#include "../../algos/mm_algos.h"
#include "../../editor/mm_graph_node.h"
#include "../mm_material.h"
Ref<Resource> SdOpSmoothBool::get_input1() {
Ref<MMNodeUniversalProperty> MMSdOpSmoothBool::get_input1() {
return input1;
}
void SdOpSmoothBool::set_input1(const Ref<Resource> &val) {
void MMSdOpSmoothBool::set_input1(const Ref<MMNodeUniversalProperty> &val) {
input1 = val;
}
Ref<Resource> SdOpSmoothBool::get_input2() {
Ref<MMNodeUniversalProperty> MMSdOpSmoothBool::get_input2() {
return input2;
}
void SdOpSmoothBool::set_input2(const Ref<Resource> &val) {
void MMSdOpSmoothBool::set_input2(const Ref<MMNodeUniversalProperty> &val) {
input2 = val;
}
Ref<Resource> SdOpSmoothBool::get_output() {
Ref<MMNodeUniversalProperty> MMSdOpSmoothBool::get_output() {
return output;
}
void SdOpSmoothBool::set_output(const Ref<Resource> &val) {
void MMSdOpSmoothBool::set_output(const Ref<MMNodeUniversalProperty> &val) {
output = val;
}
int SdOpSmoothBool::get_operation() const {
int MMSdOpSmoothBool::get_operation() const {
return operation;
}
void SdOpSmoothBool::set_operation(const int val) {
void MMSdOpSmoothBool::set_operation(const int val) {
operation = val;
emit_changed();
output->do_emit_changed();
}
float SdOpSmoothBool::get_smoothness() const {
float MMSdOpSmoothBool::get_smoothness() const {
return smoothness;
}
void SdOpSmoothBool::set_smoothness(const float val) {
void MMSdOpSmoothBool::set_smoothness(const float val) {
smoothness = val;
emit_changed();
output->do_emit_changed();
}
//tool;
//export(Resource) ;
Ref<Resource> input1;
//export(Resource) ;
Ref<Resource> input2;
//export(Resource) ;
Ref<Resource> output;
//export(int, "Union,Substraction,Intersection") ;
int operation = 0;
//export(float) ;
float smoothness = 0.15;
void SdOpSmoothBool::_init_properties() {
if (!input1) {
input1 = MMNodeUniversalProperty.new();
input1.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
void MMSdOpSmoothBool::_init_properties() {
if (!input1.is_valid()) {
input1.instance();
input1->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input1->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input1.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input1.slot_name = ">>> Input 1 ";
input1->set_slot_name(">>> Input 1 ");
if (!input1.is_connected("changed", self, "on_input_changed")) {
input1.connect("changed", self, "on_input_changed");
if (!input1->is_connected("changed", this, "on_input_changed")) {
input1->connect("changed", this, "on_input_changed");
}
if (!input2) {
input2 = MMNodeUniversalProperty.new();
input2.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!input2.is_valid()) {
input2.instance();
input2->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
input2->set_input_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// input2.input_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
input2.slot_name = ">>> Input 2 ";
input2->set_slot_name(">>> Input 2 ");
if (!input2.is_connected("changed", self, "on_input_changed")) {
input2.connect("changed", self, "on_input_changed");
if (!input2->is_connected("changed", this, "on_input_changed")) {
input2->connect("changed", this, "on_input_changed");
}
if (!output) {
output = MMNodeUniversalProperty.new();
output.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_FLOAT;
if (!output.is_valid()) {
output.instance();
output->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
}
output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_UNIVERSAL;
output->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
// output.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_FLOAT;
output.slot_name = " Output >>>";
output.get_value_from_owner = true;
output->set_slot_name(" Output >>>");
output->set_get_value_from_owner(true);
register_input_property(input1);
register_input_property(input2);
register_output_property(output);
}
void MMSdOpSmoothBool::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_label_universal(input1);
mm_graph_node->add_slot_label_universal(input2);
mm_graph_node->add_slot_label_universal(output);
void SdOpSmoothBool::_register_methods(const Variant &mm_graph_node) {
mm_graph_node.add_slot_label_universal(input1);
mm_graph_node.add_slot_label_universal(input2);
mm_graph_node.add_slot_label_universal(output);
mm_graph_node.add_slot_enum("get_operation", "set_operation", "Operation", [ "Union", "Substraction", "Intersection" ]);
mm_graph_node.add_slot_float("get_smoothness", "set_smoothness", "Smoothness", 0.01);
Array arr;
arr.push_back("Union");
arr.push_back("Substraction");
arr.push_back("Intersection");
mm_graph_node->add_slot_enum("get_operation", "set_operation", "Operation", arr);
mm_graph_node->add_slot_float("get_smoothness", "set_smoothness", "Smoothness", 0.01);
}
float SdOpSmoothBool::_get_property_value(const Vector2 &uv) {
Variant MMSdOpSmoothBool::_get_property_value(const Vector2 &uv) {
if (operation == 0) {
return MMAlgos.sdf_smooth_boolean_union(input1.get_value(uv), input2.get_value(uv), smoothness);
}
else if (operation == 1) {
return MMAlgos.sdf_smooth_boolean_substraction(input1.get_value(uv), input2.get_value(uv), smoothness);
}
else if (operation == 2) {
return MMAlgos.sdf_smooth_boolean_intersection(input1.get_value(uv), input2.get_value(uv), smoothness);
return MMAlgos::sdf_smooth_boolean_union(input1->get_value(uv), input2->get_value(uv), smoothness);
} else if (operation == 1) {
return MMAlgos::sdf_smooth_boolean_substraction(input1->get_value(uv), input2->get_value(uv), smoothness);
} else if (operation == 2) {
return MMAlgos::sdf_smooth_boolean_intersection(input1->get_value(uv), input2->get_value(uv), smoothness);
}
return 0.0;
}
//operation;
int SdOpSmoothBool::get_operation() {
return operation;
}
void SdOpSmoothBool::set_operation(const int val) {
operation = val;
void MMSdOpSmoothBool::on_input_changed() {
emit_changed();
output.emit_changed();
output->do_emit_changed();
}
//smoothness;
float SdOpSmoothBool::get_smoothness() {
return smoothness;
}
void SdOpSmoothBool::set_smoothness(const float val) {
smoothness = val;
emit_changed();
output.emit_changed();
}
void SdOpSmoothBool::on_input_changed() {
emit_changed();
output.emit_changed();
}
}
SdOpSmoothBool::SdOpSmoothBool() {
input1;
input2;
output;
MMSdOpSmoothBool::MMSdOpSmoothBool() {
operation = 0;
smoothness = 0.15;
}
SdOpSmoothBool::~SdOpSmoothBool() {
MMSdOpSmoothBool::~MMSdOpSmoothBool() {
}
void MMSdOpSmoothBool::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &MMSdOpSmoothBool::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &MMSdOpSmoothBool::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input1", "get_input1");
static void SdOpSmoothBool::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input1"), &SdOpSmoothBool::get_input1);
ClassDB::bind_method(D_METHOD("set_input1", "value"), &SdOpSmoothBool::set_input1);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input1", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input1", "get_input1");
ClassDB::bind_method(D_METHOD("get_input2"), &MMSdOpSmoothBool::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &MMSdOpSmoothBool::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &MMSdOpSmoothBool::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdOpSmoothBool::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_input2"), &SdOpSmoothBool::get_input2);
ClassDB::bind_method(D_METHOD("set_input2", "value"), &SdOpSmoothBool::set_input2);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input2", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_input2", "get_input2");
ClassDB::bind_method(D_METHOD("get_output"), &SdOpSmoothBool::get_output);
ClassDB::bind_method(D_METHOD("set_output", "value"), &SdOpSmoothBool::set_output);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_output", "get_output");
ClassDB::bind_method(D_METHOD("get_operation"), &SdOpSmoothBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "value"), &SdOpSmoothBool::set_operation);
ClassDB::bind_method(D_METHOD("get_operation"), &MMSdOpSmoothBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "value"), &MMSdOpSmoothBool::set_operation);
ADD_PROPERTY(PropertyInfo(Variant::INT, "operation"), "set_operation", "get_operation");
ClassDB::bind_method(D_METHOD("get_smoothness"), &SdOpSmoothBool::get_smoothness);
ClassDB::bind_method(D_METHOD("set_smoothness", "value"), &SdOpSmoothBool::set_smoothness);
ClassDB::bind_method(D_METHOD("get_smoothness"), &MMSdOpSmoothBool::get_smoothness);
ClassDB::bind_method(D_METHOD("set_smoothness", "value"), &MMSdOpSmoothBool::set_smoothness);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "smoothness"), "set_smoothness", "get_smoothness");
ClassDB::bind_method(D_METHOD("_init_properties"), &SdOpSmoothBool::_init_properties);
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &SdOpSmoothBool::_register_methods);
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &SdOpSmoothBool::_get_property_value);
ClassDB::bind_method(D_METHOD("get_operation"), &SdOpSmoothBool::get_operation);
ClassDB::bind_method(D_METHOD("set_operation", "val"), &SdOpSmoothBool::set_operation);
ClassDB::bind_method(D_METHOD("get_smoothness"), &SdOpSmoothBool::get_smoothness);
ClassDB::bind_method(D_METHOD("set_smoothness", "val"), &SdOpSmoothBool::set_smoothness);
ClassDB::bind_method(D_METHOD("on_input_changed"), &SdOpSmoothBool::on_input_changed);
ClassDB::bind_method(D_METHOD("on_input_changed"), &MMSdOpSmoothBool::on_input_changed);
}

View File

@ -1,20 +1,21 @@
#ifndef SD_OP_SMOOTH_BOOL_H
#define SD_OP_SMOOTH_BOOL_H
#ifndef MM_SD_OP_SMOOTH_BOOL_H
#define MM_SD_OP_SMOOTH_BOOL_H
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class SdOpSmoothBool : public MMNode {
GDCLASS(SdOpSmoothBool, MMNode);
class MMSdOpSmoothBool : public MMNode {
GDCLASS(MMSdOpSmoothBool, MMNode);
public:
Ref<MMNodeUniversalProperty> get_input1();
void set_input1(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input1();
void set_input1(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_input2();
void set_input2(const Ref<MMNodeUniversalProperty> &val);
Ref<Resource> get_input2();
void set_input2(const Ref<Resource> &val);
Ref<Resource> get_output();
void set_output(const Ref<Resource> &val);
Ref<MMNodeUniversalProperty> get_output();
void set_output(const Ref<MMNodeUniversalProperty> &val);
int get_operation() const;
void set_operation(const int val);
@ -23,34 +24,23 @@ class SdOpSmoothBool : public MMNode {
void set_smoothness(const float val);
void _init_properties();
void _register_methods(const Variant &mm_graph_node);
float _get_property_value(const Vector2 &uv);
int get_operation();
void set_operation(const int val);
float get_smoothness();
void set_smoothness(const float val);
void _register_methods(MMGraphNode *mm_graph_node);
Variant _get_property_value(const Vector2 &uv);
void on_input_changed();
SdOpSmoothBool();
~SdOpSmoothBool();
MMSdOpSmoothBool();
~MMSdOpSmoothBool();
protected:
static void _bind_methods();
//tool
//export(Resource)
Ref<Resource> input1;
//export(Resource)
Ref<Resource> input2;
//export(Resource)
Ref<Resource> output;
Ref<MMNodeUniversalProperty> input1;
Ref<MMNodeUniversalProperty> input2;
Ref<MMNodeUniversalProperty> output;
//export(int, "Union,Substraction,Intersection")
int operation = 0;
//export(float)
float smoothness = 0.15;
//operation
//smoothness
int operation;
float smoothness;
};
#endif

View File

@ -84,6 +84,8 @@ SOFTWARE.
#include "nodes/sdf3d/sdf3d_op_rounded.h"
#include "nodes/sdf3d/sdf3d_op_smooth_bool.h"
#include "nodes/sdf2d/sd_show.h"
#include "nodes/sdf2d/sd_shape_arc.h"
#include "nodes/sdf2d/sd_shape_box.h"
#include "nodes/sdf2d/sd_shape_circle.h"
@ -95,7 +97,15 @@ SOFTWARE.
#include "nodes/sdf2d/sd_tf_scale.h"
#include "nodes/sdf2d/sd_tf_translate.h"
#include "nodes/sdf2d/sd_show.h"
#include "nodes/sdf2d/sd_tf_translate.h"
#include "nodes/sdf2d/sd_op_annular_shape.h"
#include "nodes/sdf2d/sd_op_bool.h"
#include "nodes/sdf2d/sd_op_circle_repeat.h"
#include "nodes/sdf2d/sd_op_morph.h"
#include "nodes/sdf2d/sd_op_repeat.h"
#include "nodes/sdf2d/sd_op_rounded_shape.h"
#include "nodes/sdf2d/sd_op_smooth_bool.h"
static _MMAlgos *_mm_algos_singleton = nullptr;
@ -213,6 +223,21 @@ void register_material_maker_types() {
ClassDB::register_class<MMSdTfRotate>();
MMAlgos::register_node_class("SDF2D - TF", "MMSdTfRotate");
ClassDB::register_class<MMSdOpSmoothBool>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpSmoothBool");
ClassDB::register_class<MMSdOpRoundedShape>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRoundedShape");
ClassDB::register_class<MMSdOpRepeat>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpRepeat");
ClassDB::register_class<MMSdOpMorph>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpMorph");
ClassDB::register_class<MMSdOpCircleRepeat>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpCircleRepeat");
ClassDB::register_class<MMSdOpBool>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpBool");
ClassDB::register_class<MMSdOpAnnularShape>();
MMAlgos::register_node_class("SDF2D - OP", "MMSdOpAnnularShape");
_mm_algos_singleton = memnew(_MMAlgos);
Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton()));