[Bf-blender-cvs] [12904214d10] functions: update inferencing to new type rules
Jacques Lucke
noreply at git.blender.org
Thu Apr 18 11:25:48 CEST 2019
Commit: 12904214d10bd913940b44bbf414b83ce47fb5de
Author: Jacques Lucke
Date: Thu Apr 18 11:01:17 2019 +0200
Branches: functions
https://developer.blender.org/rB12904214d10bd913940b44bbf414b83ce47fb5de
update inferencing to new type rules
===================================================================
M release/scripts/startup/function_nodes/declaration/pack_list.py
M release/scripts/startup/function_nodes/inferencing.py
M source/blender/functions/frontends/data_flow_nodes/builder.cpp
===================================================================
diff --git a/release/scripts/startup/function_nodes/declaration/pack_list.py b/release/scripts/startup/function_nodes/declaration/pack_list.py
index 5ed84e7463e..15f6b0baf57 100644
--- a/release/scripts/startup/function_nodes/declaration/pack_list.py
+++ b/release/scripts/startup/function_nodes/declaration/pack_list.py
@@ -74,15 +74,11 @@ class PackListDecl(SocketDeclBase):
return
is_output = own_socket.is_output
- data_type = connected_socket.data_type
+ origin_data_type = connected_socket.data_type
- if type_infos.is_base(data_type):
- if not type_infos.is_link_allowed(data_type, self.base_type):
- return
+ if type_infos.is_link_allowed(origin_data_type, self.base_type):
state = "BASE"
- elif type_infos.is_list(data_type):
- if not type_infos.is_link_allowed(data_type, self.list_type):
- return
+ elif type_infos.is_link_allowed(origin_data_type, self.list_type):
state = "LIST"
else:
return
diff --git a/release/scripts/startup/function_nodes/inferencing.py b/release/scripts/startup/function_nodes/inferencing.py
index be6903357e9..55b1326665c 100644
--- a/release/scripts/startup/function_nodes/inferencing.py
+++ b/release/scripts/startup/function_nodes/inferencing.py
@@ -185,16 +185,16 @@ def iter_obligatory_vector_decisions(graph, input_sockets, output_sockets, tree_
if type_infos.is_list(other_data_type) and type_infos.is_link_allowed(other_data_type, decl.list_type):
yield decision_id, "LIST"
elif isinstance(other_decl, ListSocketDecl):
- list_decision_id = DecisionID(other_node, other_node, other_decl.prop_name)
- if list_decision_id in list_decisions:
- if other_decl.list_or_base == "LIST":
+ if other_decl.list_or_base == "LIST":
+ list_decision_id = DecisionID(other_node, other_node, other_decl.prop_name)
+ if list_decision_id in list_decisions:
other_base_type = list_decisions[list_decision_id]
if type_infos.is_link_allowed(other_base_type, decl.base_type):
yield decision_id, "LIST"
- else:
- old_data_type = other_socket.data_type
- if old_data_type == decl.list_type:
- yield decision_id, "LIST"
+ else:
+ old_data_type = other_socket.data_type
+ if type_infos.is_link_allowed(old_data_type, decl.list_type):
+ yield decision_id, "LIST"
for socket in output_sockets:
node = tree_data.get_node(socket)
@@ -205,7 +205,7 @@ def iter_obligatory_vector_decisions(graph, input_sockets, output_sockets, tree_
other_decl = other_socket.get_decl(other_node)
if data_sockets_are_static(other_decl):
other_data_type = other_socket.data_type
- if other_data_type == decl.base_type:
+ if type_infos.is_base(other_data_type) and type_infos.is_link_allowed(other_data_type, decl.base_type):
for decision_id in decision_ids:
yield decision_id, "BASE"
elif isinstance(other_decl, ListSocketDecl):
@@ -213,12 +213,12 @@ def iter_obligatory_vector_decisions(graph, input_sockets, output_sockets, tree_
list_decision_id = DecisionID(other_node, other_node, other_decl.prop_name)
if list_decision_id in list_decisions:
other_base_type = list_decisions[list_decision_id]
- if other_base_type == decl.base_type:
+ if type_infos.is_link_allowed(decl.base_type, other_base_type):
for decision_id in decision_ids:
yield decision_id, "BASE"
else:
old_data_type = other_socket.data_type
- if old_data_type == decl.base_type:
+ if type_infos.is_link_allowed(decl.base_type, old_data_type):
for decision_id in decision_ids:
yield decision_id, "BASE"
@@ -258,8 +258,10 @@ def make_pack_list_decisions(tree_data, list_decisions, vector_decisions):
old_origin_type = origin_socket.data_type
if type_infos.is_link_allowed(old_origin_type, decl.base_type):
decisions[decision_id] = "BASE"
- else:
+ elif type_infos.is_link_allowed(old_origin_type, decl.list_type):
decisions[decision_id] = "LIST"
+ else:
+ decisions[decision_id] = "BASE"
elif isinstance(origin_decl, VectorizedOutputDecl):
other_base_type = origin_decl.base_type
if type_infos.is_link_allowed(other_base_type, decl.base_type):
diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.cpp b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
index 9ff8102b245..42ca8633f39 100644
--- a/source/blender/functions/frontends/data_flow_nodes/builder.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
@@ -248,6 +248,9 @@ SharedType &GraphBuilder::type_by_name(const char *data_type) const
else if (STREQ(data_type, "Integer List")) {
return Types::GET_TYPE_int32_list();
}
+ else if (STREQ(data_type, "Boolean List")) {
+ return Types::GET_TYPE_bool_list();
+ }
else {
BLI_assert(false);
return *(SharedType *)nullptr;
More information about the Bf-blender-cvs
mailing list