From aa5d0d9acc96ad4c7879c93fec92bafd430c7b80 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 1 Mar 2023 21:32:47 +0100 Subject: [PATCH] Fixed MMSdf3dOpExtrusion's name and added it to the build. --- modules/material_maker/SCsub | 1 + modules/material_maker/config.py | 1 + .../nodes/sdf3d/sdf3d_op_extrusion.cpp | 40 +++++++++---------- .../nodes/sdf3d/sdf3d_op_extrusion.h | 8 ++-- modules/material_maker/register_types.cpp | 3 ++ 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/modules/material_maker/SCsub b/modules/material_maker/SCsub index 4d142fe19..4b0c7c510 100644 --- a/modules/material_maker/SCsub +++ b/modules/material_maker/SCsub @@ -90,6 +90,7 @@ sources = [ "nodes/sdf3d/sdf3d_op_repeat.cpp", "nodes/sdf3d/sdf3d_op_morph.cpp", "nodes/sdf3d/sdf3d_op_elongation.cpp", + "nodes/sdf3d/sdf3d_op_extrusion.cpp", "nodes/sdf3d/sdf3d_op_circle_repeat.cpp", "nodes/sdf3d/sdf3d_op_bool.cpp", diff --git a/modules/material_maker/config.py b/modules/material_maker/config.py index ee52d1c2a..2c3cc668f 100644 --- a/modules/material_maker/config.py +++ b/modules/material_maker/config.py @@ -59,6 +59,7 @@ def get_doc_classes(): "MMSdf3dOpRevolution", "MMSdf3dOpRepeat", "MMSdf3dOpMorph", + "MMSdf3dOpExtrusion", "MMSdf3dOpElongation", "MMSdf3dOpCircleRepeat", "MMSdf3dOpBool", diff --git a/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.cpp b/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.cpp index dce0d6e9b..b632fb138 100644 --- a/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.cpp +++ b/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.cpp @@ -5,33 +5,33 @@ #include "../../editor/mm_graph_node.h" #include "../mm_material.h" -Ref Sdf3dOpExtrusion::get_input() { +Ref MMSdf3dOpExtrusion::get_input() { return input; } -void Sdf3dOpExtrusion::set_input(const Ref &val) { +void MMSdf3dOpExtrusion::set_input(const Ref &val) { input = val; } -Ref Sdf3dOpExtrusion::get_output() { +Ref MMSdf3dOpExtrusion::get_output() { return output; } -void Sdf3dOpExtrusion::set_output(const Ref &val) { +void MMSdf3dOpExtrusion::set_output(const Ref &val) { output = val; } -float Sdf3dOpExtrusion::get_length() const { +float MMSdf3dOpExtrusion::get_length() const { return length; } -void Sdf3dOpExtrusion::set_length(const float val) { +void MMSdf3dOpExtrusion::set_length(const float val) { length = val; emit_changed(); output->do_emit_changed(); } -void Sdf3dOpExtrusion::_init_properties() { +void MMSdf3dOpExtrusion::_init_properties() { if (!input.is_valid()) { input.instance(); input->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT); @@ -58,13 +58,13 @@ void Sdf3dOpExtrusion::_init_properties() { register_output_property(output); } -void Sdf3dOpExtrusion::_register_methods(MMGraphNode *mm_graph_node) { +void MMSdf3dOpExtrusion::_register_methods(MMGraphNode *mm_graph_node) { mm_graph_node->add_slot_label_universal(input); mm_graph_node->add_slot_label_universal(output); mm_graph_node->add_slot_float("get_length", "set_length", "Length", 0.01); } -Vector2 Sdf3dOpExtrusion::_get_property_value_sdf3d(const Vector3 &uv3) { +Vector2 MMSdf3dOpExtrusion::_get_property_value_sdf3d(const Vector3 &uv3) { //vec2 $(name_uv)_w = vec2($in($uv.xz+vec2(0.5)),abs($uv.y)-$d); //ret min(max($(name_uv)_w.x,$(name_uv)_w.y),0.0)+length(max($(name_uv)_w,0.0)); float f = input->get_value(Vector2(uv3.x, uv3.z) + Vector2(0.5, 0.5)); @@ -73,30 +73,30 @@ Vector2 Sdf3dOpExtrusion::_get_property_value_sdf3d(const Vector3 &uv3) { return Vector2(ff, 0); } -void Sdf3dOpExtrusion::on_input_changed() { +void MMSdf3dOpExtrusion::on_input_changed() { emit_changed(); output->do_emit_changed(); } -Sdf3dOpExtrusion::Sdf3dOpExtrusion() { +MMSdf3dOpExtrusion::MMSdf3dOpExtrusion() { length = 0.25; } -Sdf3dOpExtrusion::~Sdf3dOpExtrusion() { +MMSdf3dOpExtrusion::~MMSdf3dOpExtrusion() { } -void Sdf3dOpExtrusion::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_input"), &Sdf3dOpExtrusion::get_input); - ClassDB::bind_method(D_METHOD("set_input", "value"), &Sdf3dOpExtrusion::set_input); +void MMSdf3dOpExtrusion::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_input"), &MMSdf3dOpExtrusion::get_input); + ClassDB::bind_method(D_METHOD("set_input", "value"), &MMSdf3dOpExtrusion::set_input); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "input", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_input", "get_input"); - ClassDB::bind_method(D_METHOD("get_output"), &Sdf3dOpExtrusion::get_output); - ClassDB::bind_method(D_METHOD("set_output", "value"), &Sdf3dOpExtrusion::set_output); + ClassDB::bind_method(D_METHOD("get_output"), &MMSdf3dOpExtrusion::get_output); + ClassDB::bind_method(D_METHOD("set_output", "value"), &MMSdf3dOpExtrusion::set_output); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "output", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_output", "get_output"); - ClassDB::bind_method(D_METHOD("get_length"), &Sdf3dOpExtrusion::get_length); - ClassDB::bind_method(D_METHOD("set_length", "value"), &Sdf3dOpExtrusion::set_length); + ClassDB::bind_method(D_METHOD("get_length"), &MMSdf3dOpExtrusion::get_length); + ClassDB::bind_method(D_METHOD("set_length", "value"), &MMSdf3dOpExtrusion::set_length); ADD_PROPERTY(PropertyInfo(Variant::REAL, "length"), "set_length", "get_length"); - ClassDB::bind_method(D_METHOD("on_input_changed"), &Sdf3dOpExtrusion::on_input_changed); + ClassDB::bind_method(D_METHOD("on_input_changed"), &MMSdf3dOpExtrusion::on_input_changed); } diff --git a/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.h b/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.h index 253185da6..35a44132c 100644 --- a/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.h +++ b/modules/material_maker/nodes/sdf3d/sdf3d_op_extrusion.h @@ -4,8 +4,8 @@ #include "../mm_node.h" #include "../mm_node_universal_property.h" -class Sdf3dOpExtrusion : public MMNode { - GDCLASS(Sdf3dOpExtrusion, MMNode); +class MMSdf3dOpExtrusion : public MMNode { + GDCLASS(MMSdf3dOpExtrusion, MMNode); public: Ref get_input(); @@ -23,8 +23,8 @@ public: void on_input_changed(); - Sdf3dOpExtrusion(); - ~Sdf3dOpExtrusion(); + MMSdf3dOpExtrusion(); + ~MMSdf3dOpExtrusion(); protected: static void _bind_methods(); diff --git a/modules/material_maker/register_types.cpp b/modules/material_maker/register_types.cpp index fe0a3d72a..3275d5c4f 100644 --- a/modules/material_maker/register_types.cpp +++ b/modules/material_maker/register_types.cpp @@ -80,6 +80,7 @@ SOFTWARE. #include "nodes/sdf3d/sdf3d_op_circle_repeat.h" #include "nodes/sdf3d/sdf3d_op_elongation.h" #include "nodes/sdf3d/sdf3d_op_morph.h" +#include "nodes/sdf3d/sdf3d_op_extrusion.h" #include "nodes/sdf3d/sdf3d_op_repeat.h" #include "nodes/sdf3d/sdf3d_op_revolution.h" #include "nodes/sdf3d/sdf3d_op_rounded.h" @@ -250,6 +251,8 @@ void register_material_maker_types(ModuleRegistrationLevel p_level) { ClassDB::register_class(); MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpMorph"); ClassDB::register_class(); + MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpExtrusion"); + ClassDB::register_class(); MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpElongation"); ClassDB::register_class(); MMAlgos::register_node_class("SDF3D - OP", "MMSdf3dOpCircleRepeat");