mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 20:36:53 +01:00
More cleanups to MMNode, and added a few missing methods.
This commit is contained in:
parent
9529c7a5a5
commit
ad813681e8
@ -1,6 +1,8 @@
|
||||
|
||||
#include "mm_node.h"
|
||||
#include "modules/material_maker/nodes/mm_node_universal_property.h"
|
||||
|
||||
#include "mm_material.h"
|
||||
#include "mm_node_universal_property.h"
|
||||
|
||||
Vector2 MMNode::get_graph_position() {
|
||||
return graph_position;
|
||||
@ -147,6 +149,22 @@ void MMNode::on_input_property_changed() {
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Variant MMNode::get_property_value(const Vector2 &uv) {
|
||||
return call("_get_property_value", uv);
|
||||
}
|
||||
|
||||
Variant MMNode::_get_property_value(const Vector2 &uv) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
Vector2 MMNode::get_property_value_sdf3d(const Vector3 &uv3) {
|
||||
return call("_get_property_value_sdf3d", uv3);
|
||||
}
|
||||
|
||||
Vector2 MMNode::_get_property_value_sdf3d(const Vector3 &uv3) {
|
||||
return Vector2();
|
||||
}
|
||||
|
||||
// Add it to the MMAlgos bing class instead.;
|
||||
// Not a perfect fit, but a better fit.;
|
||||
//func editor_register_node_class(category : String, cls : String);
|
||||
@ -184,17 +202,31 @@ void MMNode::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("render", "material"), &MMNode::render);
|
||||
ClassDB::bind_method(D_METHOD("_render", "material"), &MMNode::_render);
|
||||
ClassDB::bind_method(D_METHOD("render_image", "material"), &MMNode::render_image);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_value_for", "uv", "pseed"), &MMNode::get_value_for);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("init_properties"), &MMNode::init_properties);
|
||||
ClassDB::bind_method(D_METHOD("_init_properties"), &MMNode::_init_properties);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_methods", "mm_graph_node"), &MMNode::register_methods);
|
||||
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &MMNode::_register_methods);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_graph_position"), &MMNode::get_graph_position);
|
||||
ClassDB::bind_method(D_METHOD("set_graph_position", "pos"), &MMNode::set_graph_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_input_property", "prop"), &MMNode::register_input_property);
|
||||
ClassDB::bind_method(D_METHOD("unregister_input_property", "prop"), &MMNode::unregister_input_property);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_output_property", "prop"), &MMNode::register_output_property);
|
||||
ClassDB::bind_method(D_METHOD("unregister_output_property", "prop"), &MMNode::unregister_output_property);
|
||||
ClassDB::bind_method(D_METHOD("set_dirty", "val"), &MMNode::set_dirty);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("on_input_property_changed"), &MMNode::on_input_property_changed);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_get_property_value", PropertyInfo(Variant::VECTOR2, "uv")));
|
||||
ClassDB::bind_method(D_METHOD("get_property_value", "uv"), &MMNode::get_property_value);
|
||||
ClassDB::bind_method(D_METHOD("_get_property_value", "uv"), &MMNode::_get_property_value);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_get_property_value_sdf3d", PropertyInfo(Variant::VECTOR3, "uv3")));
|
||||
ClassDB::bind_method(D_METHOD("get_property_value_sdf3d", "uv3"), &MMNode::get_property_value_sdf3d);
|
||||
ClassDB::bind_method(D_METHOD("_get_property_value_sdf3d", "uv3"), &MMNode::_get_property_value_sdf3d);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef MM_NODE_H
|
||||
#define MM_NODE_H
|
||||
#ifndef MAT_MAKER_NODE_H
|
||||
#define MAT_MAKER_NODE_H
|
||||
|
||||
#include "core/image.h"
|
||||
#include "core/math/vector2.h"
|
||||
@ -26,7 +26,9 @@ public:
|
||||
|
||||
bool render(const Ref<MMMaterial> &material);
|
||||
void _render(const Ref<MMMaterial> &material);
|
||||
|
||||
Ref<Image> render_image(const Ref<MMMaterial> &material);
|
||||
|
||||
Color get_value_for(const Vector2 &uv, const int pseed);
|
||||
|
||||
void init_properties();
|
||||
@ -43,17 +45,23 @@ public:
|
||||
|
||||
void on_input_property_changed();
|
||||
|
||||
Variant get_property_value(const Vector2 &uv);
|
||||
virtual Variant _get_property_value(const Vector2 &uv);
|
||||
|
||||
Vector2 get_property_value_sdf3d(const Vector3 &uv3);
|
||||
virtual Vector2 _get_property_value_sdf3d(const Vector3 &uv3);
|
||||
|
||||
MMNode();
|
||||
~MMNode();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Vector2 graph_position;
|
||||
Vector<Ref<MMNodeUniversalProperty>> input_properties;
|
||||
Vector<Ref<MMNodeUniversalProperty>> output_properties;
|
||||
bool properties_initialized;
|
||||
bool dirty;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user