Prefixed GreyscaleUniform with MM.

This commit is contained in:
Relintai 2022-06-16 18:40:43 +02:00
parent bf11ab2a43
commit 8a057a643e
4 changed files with 19 additions and 19 deletions

View File

@ -21,7 +21,7 @@ def get_doc_classes():
"MatMakerGDEditor",
"MMUniform",
"GreyscaleUniform ",
"MMGreyscaleUniform",
]
def get_doc_path():

View File

@ -3,15 +3,15 @@
#include "../../editor/mm_graph_node.h"
Ref<MMNodeUniversalProperty> GreyscaleUniform::get_uniform() {
Ref<MMNodeUniversalProperty> MMGreyscaleUniform::get_uniform() {
return uniform;
}
void GreyscaleUniform::set_uniform(const Ref<MMNodeUniversalProperty> &val) {
void MMGreyscaleUniform::set_uniform(const Ref<MMNodeUniversalProperty> &val) {
uniform = val;
}
void GreyscaleUniform::_init_properties() {
void MMGreyscaleUniform::_init_properties() {
if (!uniform.is_valid()) {
uniform.instance();
uniform->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_FLOAT);
@ -25,26 +25,26 @@ void GreyscaleUniform::_init_properties() {
register_output_property(uniform);
}
void GreyscaleUniform::_register_methods(MMGraphNode *mm_graph_node) {
void MMGreyscaleUniform::_register_methods(MMGraphNode *mm_graph_node) {
mm_graph_node->add_slot_float_universal(uniform);
}
Color GreyscaleUniform::_get_value_for(const Vector2 &uv, const int pseed) {
Color MMGreyscaleUniform::_get_value_for(const Vector2 &uv, const int pseed) {
float f = uniform->get_value(uv);
return Color(f, f, f, 1);
}
GreyscaleUniform::GreyscaleUniform() {
MMGreyscaleUniform::MMGreyscaleUniform() {
}
GreyscaleUniform::~GreyscaleUniform() {
MMGreyscaleUniform::~MMGreyscaleUniform() {
}
void GreyscaleUniform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_uniform"), &GreyscaleUniform::get_uniform);
ClassDB::bind_method(D_METHOD("set_uniform", "value"), &GreyscaleUniform::set_uniform);
void MMGreyscaleUniform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_uniform"), &MMGreyscaleUniform::get_uniform);
ClassDB::bind_method(D_METHOD("set_uniform", "value"), &MMGreyscaleUniform::set_uniform);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "uniform", PROPERTY_HINT_RESOURCE_TYPE, "Ref<MMNodeUniversalProperty>"), "set_uniform", "get_uniform");
ClassDB::bind_method(D_METHOD("_init_properties"), &GreyscaleUniform::_init_properties);
ClassDB::bind_method(D_METHOD("_get_value_for", "uv", "pseed"), &GreyscaleUniform::_get_value_for);
ClassDB::bind_method(D_METHOD("_init_properties"), &MMGreyscaleUniform::_init_properties);
ClassDB::bind_method(D_METHOD("_get_value_for", "uv", "pseed"), &MMGreyscaleUniform::_get_value_for);
}

View File

@ -4,8 +4,8 @@
#include "../mm_node.h"
#include "../mm_node_universal_property.h"
class GreyscaleUniform : public MMNode {
GDCLASS(GreyscaleUniform, MMNode);
class MMGreyscaleUniform : public MMNode {
GDCLASS(MMGreyscaleUniform, MMNode);
public:
Ref<MMNodeUniversalProperty> get_uniform();
@ -15,8 +15,8 @@ public:
void _register_methods(MMGraphNode *mm_graph_node);
Color _get_value_for(const Vector2 &uv, const int pseed);
GreyscaleUniform();
~GreyscaleUniform();
MMGreyscaleUniform();
~MMGreyscaleUniform();
protected:
static void _bind_methods();

View File

@ -62,9 +62,9 @@ void register_material_maker_types() {
ClassDB::register_class<MatMakerGDEditor>();
ClassDB::register_class<MMUniform>();
ClassDB::register_class<GreyscaleUniform>();
ClassDB::register_class<MMGreyscaleUniform>();
MMAlgos::register_node_class("Uniform", "MMUniform");
MMAlgos::register_node_class("Uniform", "GreyscaleUniform");
MMAlgos::register_node_class("Uniform", "MMGreyscaleUniform");
_mm_algos_singleton = memnew(_MMAlgos);
Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton()));