diff options
author | Mariano Javier Suligoy <marianognu.easyrpg@gmail.com> | 2015-07-25 22:05:45 -0300 |
---|---|---|
committer | Mariano Javier Suligoy <marianognu.easyrpg@gmail.com> | 2015-07-25 22:05:45 -0300 |
commit | add0105c4e89e586fb3d3a9646a9ffc747d2e881 (patch) | |
tree | dfa9ce644c0b391459afd1edd513daffb94edc3b /scene/resources | |
parent | 5ffd818fb195a6e9bea48ec03ad52a77080a8d25 (diff) |
Little fix: don't create an empty undo/redo command when trying to add a second Input GraphNode
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/shader_graph.cpp | 9 | ||||
-rw-r--r-- | scene/resources/shader_graph.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 108aad3c56..9522667698 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -142,6 +142,15 @@ ShaderGraph::GraphError ShaderGraph::get_graph_error(ShaderType p_type) const { return shader[p_type].error; } +int ShaderGraph::node_count(ShaderType p_which, int p_type) +{ + int count=0; + for (Map<int,Node>::Element *E=shader[p_which].node_map.front();E;E=E->next()) + if (E->get().type==p_type) + count++; + return count; +} + void ShaderGraph::_bind_methods() { ObjectTypeDB::bind_method(_MD("_update_shader"),&ShaderGraph::_update_shader); diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h index d3a297cd6c..b93567538d 100644 --- a/scene/resources/shader_graph.h +++ b/scene/resources/shader_graph.h @@ -365,6 +365,8 @@ public: GraphError get_graph_error(ShaderType p_type) const; + int node_count(ShaderType p_which, int p_type); + static int get_type_input_count(NodeType p_type); static int get_type_output_count(NodeType p_type); static SlotType get_type_input_type(NodeType p_type,int p_idx); |