mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-30 21:09:19 +01:00
Cleaned up Uniform, and added it to the build.
This commit is contained in:
parent
d939ab54c7
commit
c2a373a9cf
@ -49,6 +49,8 @@ sources = [
|
||||
"editor/widgets/polygon_edit/polygon_edit.cpp",
|
||||
"editor/widgets/polygon_edit/polygon_editor.cpp",
|
||||
"editor/widgets/polygon_edit/polygon_view.cpp",
|
||||
|
||||
"nodes/uniform/uniform.cpp",
|
||||
]
|
||||
|
||||
if env["tools"]:
|
||||
|
@ -19,6 +19,8 @@ def get_doc_classes():
|
||||
"MMMaterial",
|
||||
"MMGraphNode",
|
||||
"MatMakerGDEditor",
|
||||
|
||||
"MMUniform",
|
||||
]
|
||||
|
||||
def get_doc_path():
|
||||
|
@ -1,64 +1,47 @@
|
||||
|
||||
#include "uniform.h"
|
||||
|
||||
#include "../../editor/mm_graph_node.h"
|
||||
|
||||
Ref<Resource> Uniform::get_uniform() {
|
||||
return uniform;
|
||||
Ref<MMNodeUniversalProperty> MMUniform::get_uniform() {
|
||||
return uniform;
|
||||
}
|
||||
|
||||
void Uniform::set_uniform(const Ref<Resource> &val) {
|
||||
uniform = val;
|
||||
void MMUniform::set_uniform(const Ref<MMNodeUniversalProperty> &val) {
|
||||
uniform = val;
|
||||
}
|
||||
|
||||
void MMUniform::_init_properties() {
|
||||
if (!uniform.is_valid()) {
|
||||
uniform.instance();
|
||||
uniform->set_default_type(MMNodeUniversalProperty::DEFAULT_TYPE_COLOR);
|
||||
uniform->set_default_value(Color(1, 1, 1, 1));
|
||||
}
|
||||
|
||||
|
||||
//tool;
|
||||
//export(Resource) ;
|
||||
Ref<Resource> uniform;
|
||||
|
||||
void Uniform::_init_properties() {
|
||||
|
||||
if (!uniform) {
|
||||
uniform = MMNodeUniversalProperty.new();
|
||||
uniform.default_type = MMNodeUniversalProperty.DEFAULT_TYPE_COLOR;
|
||||
uniform.set_default_value(Color(1, 1, 1, 1));
|
||||
uniform->set_output_slot_type(MMNodeUniversalProperty::SLOT_TYPE_COLOR);
|
||||
register_output_property(uniform);
|
||||
}
|
||||
|
||||
uniform.output_slot_type = MMNodeUniversalProperty.SLOT_TYPE_COLOR;
|
||||
register_output_property(uniform);
|
||||
void MMUniform::_register_methods(MMGraphNode *mm_graph_node) {
|
||||
mm_graph_node->add_slot_color_universal(uniform);
|
||||
}
|
||||
|
||||
|
||||
void Uniform::_register_methods(const Variant &mm_graph_node) {
|
||||
mm_graph_node.add_slot_color_universal(uniform);
|
||||
Color MMUniform::_get_value_for(const Vector2 &uv, const int pseed) {
|
||||
return uniform->get_value(uv);
|
||||
}
|
||||
|
||||
|
||||
Color Uniform::_get_value_for(const Vector2 &uv, const int pseed) {
|
||||
return uniform.get_value(uv);
|
||||
MMUniform::MMUniform() {
|
||||
}
|
||||
|
||||
MMUniform::~MMUniform() {
|
||||
}
|
||||
|
||||
Uniform::Uniform() {
|
||||
uniform;
|
||||
}
|
||||
|
||||
Uniform::~Uniform() {
|
||||
}
|
||||
|
||||
|
||||
static void Uniform::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_uniform"), &Uniform::get_uniform);
|
||||
ClassDB::bind_method(D_METHOD("set_uniform", "value"), &Uniform::set_uniform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "uniform", PROPERTY_HINT_RESOURCE_TYPE, "Ref<Resource>"), "set_uniform", "get_uniform");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_init_properties"), &Uniform::_init_properties);
|
||||
ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &Uniform::_register_methods);
|
||||
ClassDB::bind_method(D_METHOD("_get_value_for", "uv", "pseed"), &Uniform::_get_value_for);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MMUniform::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_uniform"), &MMUniform::get_uniform);
|
||||
ClassDB::bind_method(D_METHOD("set_uniform", "value"), &MMUniform::set_uniform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "uniform", PROPERTY_HINT_RESOURCE_TYPE, "MMNodeUniversalProperty"), "set_uniform", "get_uniform");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_init_properties"), &MMUniform::_init_properties);
|
||||
//ClassDB::bind_method(D_METHOD("_register_methods", "mm_graph_node"), &MMUniform::_register_methods);
|
||||
ClassDB::bind_method(D_METHOD("_get_value_for", "uv", "pseed"), &MMUniform::_get_value_for);
|
||||
}
|
||||
|
@ -1,29 +1,27 @@
|
||||
#ifndef UNIFORM_H
|
||||
#define UNIFORM_H
|
||||
#ifndef MM_UNIFORM_H
|
||||
#define MM_UNIFORM_H
|
||||
|
||||
#include "../mm_node.h"
|
||||
#include "../mm_node_universal_property.h"
|
||||
|
||||
class Uniform : public MMNode {
|
||||
GDCLASS(Uniform, MMNode);
|
||||
class MMUniform : public MMNode {
|
||||
GDCLASS(MMUniform, MMNode);
|
||||
|
||||
public:
|
||||
public:
|
||||
Ref<MMNodeUniversalProperty> get_uniform();
|
||||
void set_uniform(const Ref<MMNodeUniversalProperty> &val);
|
||||
|
||||
Ref<Resource> get_uniform();
|
||||
void set_uniform(const Ref<Resource> &val);
|
||||
void _init_properties();
|
||||
void _register_methods(MMGraphNode *mm_graph_node);
|
||||
Color _get_value_for(const Vector2 &uv, const int pseed);
|
||||
|
||||
void _init_properties();
|
||||
void _register_methods(const Variant &mm_graph_node);
|
||||
Color _get_value_for(const Vector2 &uv, const int pseed);
|
||||
MMUniform();
|
||||
~MMUniform();
|
||||
|
||||
Uniform();
|
||||
~Uniform();
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//tool
|
||||
//export(Resource)
|
||||
Ref<Resource> uniform;
|
||||
Ref<MMNodeUniversalProperty> uniform;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -42,6 +42,8 @@ SOFTWARE.
|
||||
#include "editor_plugin.h"
|
||||
#endif
|
||||
|
||||
#include "nodes/uniform/uniform.h"
|
||||
|
||||
static _MMAlgos *_mm_algos_singleton = nullptr;
|
||||
|
||||
void register_material_maker_types() {
|
||||
@ -58,6 +60,9 @@ void register_material_maker_types() {
|
||||
ClassDB::register_class<MMGraphNode>();
|
||||
ClassDB::register_class<MatMakerGDEditor>();
|
||||
|
||||
ClassDB::register_class<MMUniform>();
|
||||
MMAlgos::register_node_class("Uniform", "MMUniform");
|
||||
|
||||
_mm_algos_singleton = memnew(_MMAlgos);
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user