diff --git a/__init__.py b/__init__.py index 6612d46..cb67a00 100644 --- a/__init__.py +++ b/__init__.py @@ -16,7 +16,7 @@ "version": (0, 9, 9), "blender": (2, 91, 0), "location": "View Menu", - "warning": "Beta", + "warning": "Now actually Beta", "category": "Game Engine" } diff --git a/basicnodes/__init__.py b/basicnodes/__init__.py index 8311a7b..66d3f7a 100644 --- a/basicnodes/__init__.py +++ b/basicnodes/__init__.py @@ -896,13 +896,13 @@ class NLAbstractNode(NetLogicStatementGenerator): def poll(cls, node_tree): pass - def insert_link(self, link): - to_socket = link.to_socket - from_socket = link.from_socket - try: - link.is_valid = to_socket.validate(from_socket) - except Exception: - utils.debug('Receiving Node not a Logic Node Type, skipping validation.') + #def insert_link(self, link): + # to_socket = link.to_socket + # from_socket = link.from_socket + # try: + # link.is_valid = to_socket.validate(from_socket) + # except Exception: + # utils.debug('Receiving Node not a Logic Node Type, skipping validation.') def free(self): pass @@ -919,8 +919,8 @@ def draw_buttons_ext(self, context, layout): def update(self): update_tree_code(self, bpy.context) - def draw_label(self): - return self.__class__.bl_label + #def draw_label(self): + # return self.__class__.bl_label ############################################################################### @@ -3796,6 +3796,31 @@ def get_output_socket_varnames(self): _nodes.append(NLGetRandomListIndex) +class NLDuplicateList(bpy.types.Node, NLParameterNode): + bl_idname = "NLDuplicateList" + bl_label = "Duplicate" + bl_icon = 'CON_TRANSLIKE' + nl_category = "Python" + nl_subcat = 'List' + + def init(self, context): + NLParameterNode.init(self, context) + self.inputs.new(NLListSocket.bl_idname, "List") + self.outputs.new(NLListSocket.bl_idname, "List") + + def get_netlogic_class_name(self): + return "bgelogic.DuplicateList" + + def get_input_sockets_field_names(self): + return ["items"] + + def get_output_socket_varnames(self): + return [OUTCELL] + + +_nodes.append(NLDuplicateList) + + class NLGetListIndexNode(bpy.types.Node, NLParameterNode): bl_idname = "NLGetListIndexNode" bl_label = "Get Index" @@ -3918,7 +3943,7 @@ class NLGetActuatorValue(bpy.types.Node, NLParameterNode): def init(self, context): NLParameterNode.init(self, context) - self.inputs.new(NLLogicBrickSocket.bl_idname, "Actuator Name") + self.inputs.new(NLLogicBrickSocket.bl_idname, "Actuator") self.inputs.new(NLQuotedStringFieldSocket.bl_idname, "Field") self.outputs.new(NLParameterSocket.bl_idname, "Value") @@ -6202,9 +6227,9 @@ def init(self, context): def update_draw(self): numerics = ['INTEGER', 'FLOAT'] self.inputs[2].enabled = ( - self.inputs[0].value_type in numerics or self.inputs[0].is_linked + (self.inputs[0].value_type in numerics or self.inputs[0].is_linked) and - self.inputs[1].value_type in numerics or self.inputs[1].is_linked + (self.inputs[1].value_type in numerics or self.inputs[1].is_linked) ) def get_netlogic_class_name(self): diff --git a/game/bgelogic.py b/game/bgelogic.py index 561a9b9..bc67ba5 100644 --- a/game/bgelogic.py +++ b/game/bgelogic.py @@ -2535,6 +2535,20 @@ def evaluate(self): self._set_value(random.choice(list_d)) +class DuplicateList(ParameterCell): + def __init__(self): + ParameterCell.__init__(self) + self.condition = None + self.items = None + + def evaluate(self): + list_d = self.get_parameter_value(self.items) + if is_invalid(list_d): + return + self._set_ready() + self._set_value(list_d.copy()) + + class GetActuator(ParameterCell): @classmethod @@ -4093,14 +4107,14 @@ def evaluate(self): b = self.get_parameter_value(self.param_b) threshold = self.get_parameter_value(self.threshold) operator = self.get_parameter_value(self.operator) - if is_waiting(a, b, threshold, operator): - return self._set_ready() if operator > 1: # eq and neq are valid for None if a is None: return if b is None: return + if threshold is None: + threshold = 0 if threshold > 0 and abs(a - b) < threshold: a = b if operator is None: @@ -5630,24 +5644,19 @@ def setup(self, network): def evaluate(self): self.done = False condition = self.get_parameter_value(self.condition) - if not_met(condition): - return target_object = self.get_parameter_value(self.target_object) tree_name = self.get_parameter_value(self.tree_name) - if target_object is LogicNetworkCell.STATUS_WAITING: - return - if tree_name is LogicNetworkCell.STATUS_WAITING: - return self._set_ready() if is_invalid(target_object): return - if tree_name not in target_object: + added_network = target_object.get(tree_name, None) + if not added_network: self._network.install_subnetwork( target_object, tree_name, False ) - added_network = target_object.get(tree_name) + added_network = target_object.get(tree_name, None) if condition: added_network.stopped = False else: diff --git a/ops/__init__.py b/ops/__init__.py index 475ca33..f802bfc 100644 --- a/ops/__init__.py +++ b/ops/__init__.py @@ -902,7 +902,7 @@ def execute(self, context): class NLAddGlobalOperator(bpy.types.Operator): bl_idname = "bge_netlogic.add_global" - bl_label = "Add Global" + bl_label = "Add Global Value" bl_options = {'REGISTER', 'UNDO'} bl_description = "Add a value accessible from anywhere" @@ -926,7 +926,7 @@ def execute(self, context): class NLRemoveGlobalOperator(bpy.types.Operator): bl_idname = "bge_netlogic.remove_global" - bl_label = "Remove Global" + bl_label = "Remove Global Value" bl_options = {'REGISTER', 'UNDO'} bl_description = "Remove a value accessible from anywhere" @@ -944,7 +944,7 @@ def execute(self, context): class NLAddGlobalCatOperator(bpy.types.Operator): bl_idname = "bge_netlogic.add_global_cat" - bl_label = "Add Global" + bl_label = "Add Global Category" bl_options = {'REGISTER', 'UNDO'} bl_description = "Add a global value category" @@ -964,7 +964,7 @@ def execute(self, context): class NLRemoveGlobalCatOperator(bpy.types.Operator): bl_idname = "bge_netlogic.remove_global_cat" - bl_label = "Remove Global" + bl_label = "Remove Global Category" bl_options = {'REGISTER', 'UNDO'} bl_description = "Remove a global value category" diff --git a/ui/IconsBright/Icon4Keys.png b/ui/IconsBright/Icon4Keys.png deleted file mode 100644 index 286a527..0000000 Binary files a/ui/IconsBright/Icon4Keys.png and /dev/null differ diff --git a/ui/IconsBright/IconApply.png b/ui/IconsBright/IconApply.png deleted file mode 100644 index 849aeca..0000000 Binary files a/ui/IconsBright/IconApply.png and /dev/null differ diff --git a/ui/__init__.py b/ui/__init__.py index ed07d40..ae7cd9d 100644 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -198,7 +198,7 @@ def draw(self, context): else: layout.operator( bge_netlogic.ops.NLAddGlobalCatOperator.bl_idname, - text='Add Global Value', + text='Add Global Category', icon='PLUS' ) @@ -846,9 +846,9 @@ class BGELogicTree(bpy.types.NodeTree): def poll(cls, context): return True - def update(self): - if not getattr(bpy.context.scene.logic_node_settings, 'auto_compile'): - return - bge_netlogic.update_current_tree_code() + #def update(self): + # if not getattr(bpy.context.scene.logic_node_settings, 'auto_compile'): + # return + # bge_netlogic.update_current_tree_code() # for link in self.links: # print(link.is_valid)