mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 21:31:10 +01:00
More null checks.
This commit is contained in:
parent
ecd2be23a6
commit
729950b86a
@ -61,6 +61,11 @@ void MMMaterial::initialize() {
|
|||||||
|
|
||||||
for (int i = 0; i < nodes.size(); ++i) {
|
for (int i = 0; i < nodes.size(); ++i) {
|
||||||
Ref<MMNode> n = nodes[i];
|
Ref<MMNode> n = nodes[i];
|
||||||
|
|
||||||
|
if (!n.is_valid()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
n->init_properties();
|
n->init_properties();
|
||||||
n->connect("changed", this, "on_node_changed");
|
n->connect("changed", this, "on_node_changed");
|
||||||
}
|
}
|
||||||
@ -68,6 +73,8 @@ void MMMaterial::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MMMaterial::add_node(const Ref<MMNode> &node) {
|
void MMMaterial::add_node(const Ref<MMNode> &node) {
|
||||||
|
ERR_FAIL_COND(!node.is_valid());
|
||||||
|
|
||||||
nodes.push_back(node);
|
nodes.push_back(node);
|
||||||
Ref<MMNode> n = node;
|
Ref<MMNode> n = node;
|
||||||
n->connect("changed", this, "on_node_changed");
|
n->connect("changed", this, "on_node_changed");
|
||||||
@ -85,13 +92,15 @@ void MMMaterial::remove_node(const Ref<MMNode> &node) {
|
|||||||
for (int j = 0; j < nodes.size(); ++j) {
|
for (int j = 0; j < nodes.size(); ++j) {
|
||||||
Ref<MMNode> n = nodes[j];
|
Ref<MMNode> n = nodes[j];
|
||||||
|
|
||||||
if (n.is_valid()) {
|
if (!n.is_valid()) {
|
||||||
for (int k = 0; k < n->input_properties.size(); ++k) {
|
continue;
|
||||||
Ref<MMNodeUniversalProperty> ip = n->input_properties[k];
|
}
|
||||||
|
|
||||||
if (ip->get_input_property() == op) {
|
for (int k = 0; k < n->input_properties.size(); ++k) {
|
||||||
ip->set_input_property(Ref<MMNodeUniversalProperty>());
|
Ref<MMNodeUniversalProperty> ip = n->input_properties[k];
|
||||||
}
|
|
||||||
|
if (ip->get_input_property() == op) {
|
||||||
|
ip->set_input_property(Ref<MMNodeUniversalProperty>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,6 @@ void MMNode::set_input_properties(const Vector<Variant> &val) {
|
|||||||
input_properties.clear();
|
input_properties.clear();
|
||||||
for (int i = 0; i < val.size(); i++) {
|
for (int i = 0; i < val.size(); i++) {
|
||||||
Ref<MMNode> e = Ref<MMNode>(val[i]);
|
Ref<MMNode> e = Ref<MMNode>(val[i]);
|
||||||
|
|
||||||
if (!e.is_valid()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_properties.push_back(e);
|
input_properties.push_back(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,11 +43,6 @@ void MMNode::set_output_properties(const Vector<Variant> &val) {
|
|||||||
output_properties.clear();
|
output_properties.clear();
|
||||||
for (int i = 0; i < val.size(); i++) {
|
for (int i = 0; i < val.size(); i++) {
|
||||||
Ref<MMNode> e = Ref<MMNode>(val[i]);
|
Ref<MMNode> e = Ref<MMNode>(val[i]);
|
||||||
|
|
||||||
if (!e.is_valid()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
output_properties.push_back(e);
|
output_properties.push_back(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,6 +76,10 @@ bool MMNode::render(const Ref<MMMaterial> &material) {
|
|||||||
for (int i = 0; i < input_properties.size(); ++i) {
|
for (int i = 0; i < input_properties.size(); ++i) {
|
||||||
Ref<MMNodeUniversalProperty> p = input_properties[i];
|
Ref<MMNodeUniversalProperty> p = input_properties[i];
|
||||||
|
|
||||||
|
if (!p.is_valid()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (p->get_input_property().is_valid() && p->get_input_property()->get_owner()->get_dirty()) {
|
if (p->get_input_property().is_valid() && p->get_input_property()->get_owner()->get_dirty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user