diff --git a/editor/enum_types.py b/editor/enum_types.py index 967ddb2..29a8f83 100644 --- a/editor/enum_types.py +++ b/editor/enum_types.py @@ -170,7 +170,7 @@ _enum_readable_member_names = [ - ("localPosition", "Local Position", "The local position of the object"), + ("worldPosition", "World Position", "The World Position of the object"), ( "worldOrientation", "World Orientation", @@ -192,8 +192,8 @@ ) ), ("worldScale", "World Scale", "The global scale of the object"), - ("worldPosition", "World Position", "The World Position of the object"), None, + ("localPosition", "Local Position", "The local position of the object"), ( "localOrientation", "Local Orientation", @@ -215,6 +215,7 @@ ) ), ("localScale", "Local Scale", "The local scale of the object"), + None, ("name", "Name", "The name of the object"), ("color", "Color", "The solid color of the object"), ( @@ -264,6 +265,7 @@ "Local Transform", 'The local transform of the object' ), + None, ('color', 'Color', 'Color') ] diff --git a/editor/nodes/__init__.py b/editor/nodes/__init__.py index 013103a..e46bab8 100644 --- a/editor/nodes/__init__.py +++ b/editor/nodes/__init__.py @@ -319,5 +319,6 @@ from .parameters.curveinterpolation import LogicNodeCurveInterpolation from .parameters.tweenvalue import LogicNodeTweenValue +from .parameters.getcollisionbitmask import LogicNodeGetCollisionBitMask # from .groupnode import NodeGroupInputLogic \ No newline at end of file diff --git a/editor/nodes/actions/addfilter.py b/editor/nodes/actions/addfilter.py index 66b87f3..71bf041 100644 --- a/editor/nodes/actions/addfilter.py +++ b/editor/nodes/actions/addfilter.py @@ -8,15 +8,16 @@ filter_types = [ - ('FXAA', 'FXAA', 'Fast Anti-Aliasing'), - ('HBAO', 'HBAO', 'Horizon-Based Ambient Occlusion'), - ('SSAO', 'SSAO', 'Screen-Space Ambient Occlusion'), - ('VIGNETTE', 'Vignette', 'Fade to color at screen edges'), - ('BRIGHTNESS', 'Brightness', 'Overall brightness'), - ('CHROMAB', 'Chromatic Aberration', 'Lens light bending effect'), - ('GRAYSCALE', 'Grayscale', 'Convert image to grayscale'), - ('LEVELS', 'Levels', 'Control color levels'), - ('MIST', 'Mist', 'Classic depth fog implementation') + ('0', 'FXAA', 'Fast Anti-Aliasing'), + ('1', 'HBAO', 'Horizon-Based Ambient Occlusion'), + ('2', 'SSAO', 'Screen-Space Ambient Occlusion'), + ('3', 'Vignette', 'Fade to color at screen edges'), + ('4', 'Brightness', 'Overall brightness'), + ('5', 'Chromatic Aberration', 'Lens light bending effect'), + ('6', 'Grayscale', 'Convert image to grayscale'), + ('7', 'Levels', 'Control color levels'), + ('8', 'Mist', 'Classic depth fog implementation'), + ('9', 'Blur', 'Simple blur covering the whole screen') ] @@ -30,17 +31,18 @@ class LogicNodeAddFilter(LogicNodeActionType): def update_draw(self, context=None): if not self.ready: return - self.inputs[2].enabled = self.filter_type == 'BRIGHTNESS' - self.inputs[3].enabled = self.filter_type == 'MIST' + ftype = int(self.filter_type) + self.inputs[2].enabled = ftype == 4 + self.inputs[3].enabled = ftype == 8 self.inputs[4].enabled = self.inputs[3].enabled - self.inputs[5].enabled = self.filter_type in ['VIGNETTE', 'CHROMAB', 'GRAYSCALE', 'MIST', 'SSAO', 'HBAO'] - self.inputs[6].enabled = self.filter_type in ['VIGNETTE', 'LEVELS', 'MIST'] + self.inputs[5].enabled = ftype in [3, 5, 6, 8, 2, 1, 9] + self.inputs[6].enabled = ftype in [3, 7, 8] filter_type: EnumProperty( items=filter_types, name='Filter', description='2D Filters modify the image rendered by EEVEE', - default='FXAA', + default='0', update=update_draw ) @@ -62,7 +64,7 @@ def get_input_names(self): # XXX Remove for 4.0 return ['condition', 'pass_idx', 'brightness', 'start', 'density', 'power', 'color'] def get_attributes(self): - return [("filter_type", f'"{self.filter_type}"')] + return [("filter_type", self.filter_type)] def get_output_names(self): # XXX Remove for 4.0 return ["OUT"] diff --git a/editor/nodes/actions/createuibutton.py b/editor/nodes/actions/createuibutton.py index 725394f..21920ee 100644 --- a/editor/nodes/actions/createuibutton.py +++ b/editor/nodes/actions/createuibutton.py @@ -71,10 +71,10 @@ def get_output_names(self): def get_attributes(self): return [ - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"'), - ("text_halign_type", f'"{self.text_halign_type}"'), - ("text_valign_type", f'"{self.text_valign_type}"') + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)), + ("text_halign_type", repr(self.text_halign_type)), + ("text_valign_type", repr(self.text_valign_type)) ] def get_input_names(self): @@ -155,10 +155,10 @@ def get_output_names(self): def get_attributes(self): return [ - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"'), - ("text_halign_type", f'"{self.text_halign_type}"'), - ("text_valign_type", f'"{self.text_valign_type}"') + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)), + ("text_halign_type", repr(self.text_halign_type)), + ("text_valign_type", repr(self.text_valign_type)) ] def get_input_names(self): diff --git a/editor/nodes/actions/createuiimage.py b/editor/nodes/actions/createuiimage.py index 81d50f1..d699aeb 100644 --- a/editor/nodes/actions/createuiimage.py +++ b/editor/nodes/actions/createuiimage.py @@ -9,6 +9,7 @@ from ...enum_types import _ui_halign_types from ...enum_types import _ui_valign_types from bpy.props import EnumProperty +from bpy.props import BoolProperty @node_type @@ -20,6 +21,7 @@ class LogicNodeCreateUIImage(LogicNodeActionType): halign_type: EnumProperty(items=_ui_halign_types, name='X') valign_type: EnumProperty(items=_ui_valign_types, name='Y') + aspect_ratio: BoolProperty(name='Use Aspect Ratio', default=True, description="Keep images' original width/height proportions") def init(self, context): self.add_input(NodeSocketLogicCondition, "Condition") @@ -37,14 +39,16 @@ def init(self, context): def draw_buttons(self, context, layout) -> None: layout.prop(self, 'halign_type', text='X') layout.prop(self, 'valign_type', text='Y') + layout.prop(self, 'aspect_ratio', text='Aspect Ratio') def get_output_names(self): return ["OUT", 'WIDGET'] def get_attributes(self): return [ - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"') + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)), + ("aspect_ratio", self.aspect_ratio) ] def get_input_names(self): diff --git a/editor/nodes/actions/createuilabel.py b/editor/nodes/actions/createuilabel.py index 1b590f8..54b597f 100644 --- a/editor/nodes/actions/createuilabel.py +++ b/editor/nodes/actions/createuilabel.py @@ -59,8 +59,8 @@ def get_output_names(self): def get_attributes(self): return [ - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"') + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)) ] def get_input_names(self): diff --git a/editor/nodes/actions/createuilayout.py b/editor/nodes/actions/createuilayout.py index 0277e2b..8b0db26 100644 --- a/editor/nodes/actions/createuilayout.py +++ b/editor/nodes/actions/createuilayout.py @@ -61,10 +61,10 @@ def get_output_names(self): def get_attributes(self): return [ - ("layout_type", f'"{self.layout_type}"'), - ("boxlayout_type", f'"{self.boxlayout_type}"'), - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"') + ("layout_type", repr(self.layout_type)), + ("boxlayout_type", repr(self.boxlayout_type)), + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)) ] def get_input_names(self): diff --git a/editor/nodes/actions/createuislider.py b/editor/nodes/actions/createuislider.py index 4de9fcb..ff8414d 100644 --- a/editor/nodes/actions/createuislider.py +++ b/editor/nodes/actions/createuislider.py @@ -74,10 +74,10 @@ def get_output_names(self): def get_attributes(self): return [ - ("orientation_type", f'"{self.orientation_type}"'), - ("slider_type", f'"{self.slider_type}"'), - ("halign_type", f'"{self.halign_type}"'), - ("valign_type", f'"{self.valign_type}"') + ("orientation_type", repr(self.orientation_type)), + ("slider_type", repr(self.slider_type)), + ("halign_type", repr(self.halign_type)), + ("valign_type", repr(self.valign_type)) ] def get_input_names(self): diff --git a/editor/nodes/actions/print.py b/editor/nodes/actions/print.py index 4035c64..a5ed9d9 100644 --- a/editor/nodes/actions/print.py +++ b/editor/nodes/actions/print.py @@ -33,7 +33,7 @@ def draw_buttons(self, context, layout) -> None: layout.prop(self, 'msg_type', text='') def get_attributes(self): - return [("msg_type", f'"{self.msg_type}"')] + return [("msg_type", repr(self.msg_type))] def get_output_names(self): # XXX Remove for 4.0 return ["OUT"] diff --git a/editor/nodes/actions/setcollisionbitmask.py b/editor/nodes/actions/setcollisionbitmask.py index 5a49603..05517a1 100644 --- a/editor/nodes/actions/setcollisionbitmask.py +++ b/editor/nodes/actions/setcollisionbitmask.py @@ -20,7 +20,11 @@ class LogicNodeSetCollisionBitMask(LogicNodeActionType): ['Set Collision Mask', {'nl_label': 'Set Collision Mask', 'mode': '1'}], ] - mode: EnumProperty(items=_collision_bitmask_types, name='Mode') + def update_draw(self, context): + mode = int(self.mode) + self.nl_label = f"Get Collision {'Mask' if mode > 0 else 'Group'}" + + mode: EnumProperty(items=_collision_bitmask_types, name='Mode', update=update_draw) def init(self, context): self.add_input(NodeSocketLogicCondition, 'Condition') diff --git a/editor/nodes/actions/setuiwidgetattr.py b/editor/nodes/actions/setuiwidgetattr.py index 05d903c..89a8812 100644 --- a/editor/nodes/actions/setuiwidgetattr.py +++ b/editor/nodes/actions/setuiwidgetattr.py @@ -56,7 +56,7 @@ def init(self, context): LogicNodeActionType.init(self, context) def get_attributes(self): - return [("widget_attr", f'"{self.widget_attr}"')] + return [("widget_attr", repr(self.widget_attr))] def draw_buttons(self, context, layout) -> None: layout.prop(self, 'widget_attr', text='') diff --git a/editor/nodes/actions/slowfollow.py b/editor/nodes/actions/slowfollow.py index ce2a688..f9e69d9 100644 --- a/editor/nodes/actions/slowfollow.py +++ b/editor/nodes/actions/slowfollow.py @@ -39,5 +39,5 @@ def get_input_names(self): def get_attributes(self): return [ - ("value_type", f'"{self.value_type}"'), + ("value_type", repr(self.value_type)), ] diff --git a/editor/nodes/actions/vehicleaccelerate.py b/editor/nodes/actions/vehicleaccelerate.py index e55e45a..d886755 100644 --- a/editor/nodes/actions/vehicleaccelerate.py +++ b/editor/nodes/actions/vehicleaccelerate.py @@ -29,23 +29,25 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicCondition, "Condition") - self.add_input(NodeSocketLogicObject, "Vehicle") - self.add_input(NodeSocketLogicIntegerPositive, "Wheels", None, {'default_value': 2}) - self.add_input(NodeSocketLogicFloatPositive, "Power", None, {'default_value': 1}) - self.add_output(NodeSocketLogicCondition, 'Done') + self.add_input(NodeSocketLogicCondition, "Condition", 'condition') + self.add_input(NodeSocketLogicObject, "Vehicle", 'vehicle') + self.add_input(NodeSocketLogicIntegerPositive, "Wheels", 'wheelcount', {'default_value': 2}) + self.add_input(NodeSocketLogicFloatPositive, "Power", 'power', {'default_value': 1}) + self.add_output(NodeSocketLogicCondition, 'Done', 'OUT') LogicNodeActionType.init(self, context) - def get_output_names(self): - return ["OUT"] - def draw_buttons(self, context, layout): layout.prop(self, "value_type", text='') + # XXX Remove for 4.0 def get_input_names(self): return ["condition", "vehicle", "wheelcount", 'power'] + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUT"] + def get_attributes(self): return [ - ("value_type", f'"{self.value_type}"'), + ("value_type", repr(self.value_type)), ] diff --git a/editor/nodes/actions/vehiclebrake.py b/editor/nodes/actions/vehiclebrake.py index d39808b..3d02c7f 100644 --- a/editor/nodes/actions/vehiclebrake.py +++ b/editor/nodes/actions/vehiclebrake.py @@ -29,23 +29,25 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicCondition, "Condition") - self.add_input(NodeSocketLogicObject, "Vehicle") - self.add_input(NodeSocketLogicIntegerPositive, "Wheels", None, {'default_value': 2}) - self.add_input(NodeSocketLogicFloatPositive, "Power", None, {'default_value': 1}) - self.add_output(NodeSocketLogicCondition, 'Done') + self.add_input(NodeSocketLogicCondition, "Condition", 'condition') + self.add_input(NodeSocketLogicObject, "Vehicle", 'vehicle') + self.add_input(NodeSocketLogicIntegerPositive, "Wheels", 'wheelcount', {'default_value': 2}) + self.add_input(NodeSocketLogicFloatPositive, "Power", 'power', {'default_value': 1}) + self.add_output(NodeSocketLogicCondition, 'Done', 'OUT') LogicNodeActionType.init(self, context) - def get_output_names(self): - return ["OUT"] - def draw_buttons(self, context, layout): layout.prop(self, "value_type", text='') + # XXX Remove for 4.0 def get_input_names(self): return ["condition", "vehicle", "wheelcount", 'power'] + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUT"] + def get_attributes(self): return [ - ("value_type", f'"{self.value_type}"'), + ("value_type", repr(self.value_type)), ] \ No newline at end of file diff --git a/editor/nodes/actions/vehiclesetattributes.py b/editor/nodes/actions/vehiclesetattributes.py index 4c9a4ab..edc5cad 100644 --- a/editor/nodes/actions/vehiclesetattributes.py +++ b/editor/nodes/actions/vehiclesetattributes.py @@ -36,26 +36,24 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicCondition, "Condition") - self.add_input(NodeSocketLogicObject, "Collider") - self.add_input(NodeSocketLogicIntegerPositive, "Wheels", None, {'default_value': 2}) - self.add_input(NodeSocketLogicBoolean, "Suspension") - self.add_input(NodeSocketLogicFloat, "") - self.add_input(NodeSocketLogicBoolean, "Stiffness") - self.add_input(NodeSocketLogicFloat, "") - self.add_input(NodeSocketLogicBoolean, "Damping") - self.add_input(NodeSocketLogicFloat, "") - self.add_input(NodeSocketLogicBoolean, "Friction") - self.add_input(NodeSocketLogicFloat, "") - self.add_output(NodeSocketLogicCondition, 'Done') + self.add_input(NodeSocketLogicCondition, "Condition", 'condition') + self.add_input(NodeSocketLogicObject, "Collider", 'vehicle') + self.add_input(NodeSocketLogicIntegerPositive, "Wheels", 'wheelcount', {'default_value': 2}) + self.add_input(NodeSocketLogicBoolean, "Suspension", 'set_suspension_compression') + self.add_input(NodeSocketLogicFloat, "", 'suspension_compression') + self.add_input(NodeSocketLogicBoolean, "Stiffness", 'set_suspension_stiffness') + self.add_input(NodeSocketLogicFloat, "", 'suspension_stiffness') + self.add_input(NodeSocketLogicBoolean, "Damping", 'set_suspension_damping') + self.add_input(NodeSocketLogicFloat, "", 'suspension_damping') + self.add_input(NodeSocketLogicBoolean, "Friction", 'set_tyre_friction') + self.add_input(NodeSocketLogicFloat, "", 'tyre_friction') + self.add_output(NodeSocketLogicCondition, 'Done', 'OUT') LogicNodeActionType.init(self, context) - def get_output_names(self): - return ["OUT"] - def draw_buttons(self, context, layout): layout.prop(self, "value_type", text='') + # XXX Remove for 4.0 def get_input_names(self): return [ "condition", @@ -71,7 +69,11 @@ def get_input_names(self): 'tyre_friction' ] + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUT"] + def get_attributes(self): return [ - ("value_type", f'"{self.value_type}"'), + ("value_type", repr(self.value_type)), ] diff --git a/editor/nodes/actions/vehiclesteer.py b/editor/nodes/actions/vehiclesteer.py index 8952df6..cb9b0e5 100644 --- a/editor/nodes/actions/vehiclesteer.py +++ b/editor/nodes/actions/vehiclesteer.py @@ -29,23 +29,25 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicCondition, "Condition") - self.add_input(NodeSocketLogicObject, "Vehicle") - self.add_input(NodeSocketLogicIntegerPositive, "Wheels", None, {'default_value': 2}) - self.add_input(NodeSocketLogicFloat, "Steer") - self.add_output(NodeSocketLogicCondition, 'Done') + self.add_input(NodeSocketLogicCondition, "Condition", 'condition') + self.add_input(NodeSocketLogicObject, "Vehicle", 'vehicle') + self.add_input(NodeSocketLogicIntegerPositive, "Wheels", 'wheelcount', {'default_value': 2}) + self.add_input(NodeSocketLogicFloat, "Steer", 'power') + self.add_output(NodeSocketLogicCondition, 'Done', 'OUT') LogicNodeActionType.init(self, context) - def get_output_names(self): - return ["OUT"] - def draw_buttons(self, context, layout): layout.prop(self, "value_type", text='') + # XXX Remove for 4.0 def get_input_names(self): return ["condition", "vehicle", "wheelcount", 'power'] + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUT"] + def get_attributes(self): return [ - ("value_type", f'"{self.value_type}"'), + ("value_type", repr(self.value_type)), ] diff --git a/editor/nodes/conditions/checkangle.py b/editor/nodes/conditions/checkangle.py index 4215d12..f7f8bff 100644 --- a/editor/nodes/conditions/checkangle.py +++ b/editor/nodes/conditions/checkangle.py @@ -12,22 +12,18 @@ class LogicNodeCheckAngle(LogicNodeConditionType): bl_idname = "NLVectorAngleCheck" bl_label = "Check Angle" nl_module = 'uplogic.nodes.conditions' + nl_class = "ULVectorAngleCheck" operator: EnumProperty(name='Operation', items=_enum_logic_operators) def init(self, context): - self.add_input(NodeSocketLogicVectorXYZ, "Vector 1") - self.add_input(NodeSocketLogicVectorXYZ, "Vector 2") - self.add_input(NodeSocketLogicFloat, "Value") - self.add_output(NodeSocketLogicCondition, 'If True') - self.add_output(NodeSocketLogicFloat, "Angle") + self.add_input(NodeSocketLogicVectorXYZ, "Vector 1", 'vector') + self.add_input(NodeSocketLogicVectorXYZ, "Vector 2", 'vector_2') + self.add_input(NodeSocketLogicFloat, "Value", 'value') + self.add_output(NodeSocketLogicCondition, 'If True', 'OUT') + self.add_output(NodeSocketLogicFloat, "Angle", 'ANGLE') LogicNodeConditionType.init(self, context) - nl_class = "ULVectorAngleCheck" - - def get_input_names(self): - return ["vector", 'vector_2', 'value'] - def draw_buttons(self, context, layout): layout.prop( self, @@ -35,8 +31,13 @@ def draw_buttons(self, context, layout): text='' ) + # XXX Remove for 4.0 + def get_input_names(self): + return ["vector", 'vector_2', 'value'] + + # XXX Remove for 4.0 def get_output_names(self): return ['OUT', 'ANGLE'] def get_attributes(self): - return [("op", f'"{self.operator}"')] + return [("op", repr(self.operator))] diff --git a/editor/nodes/conditions/withinrange.py b/editor/nodes/conditions/withinrange.py index f44ade6..f865cea 100644 --- a/editor/nodes/conditions/withinrange.py +++ b/editor/nodes/conditions/withinrange.py @@ -12,6 +12,7 @@ class LogicNodeWithinRange(LogicNodeConditionType): bl_idname = "NLWithinRangeNode" bl_label = "Within Range" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULWithinRange" operator: EnumProperty( name='Mode', @@ -19,23 +20,23 @@ class LogicNodeWithinRange(LogicNodeConditionType): ) def init(self, context): - self.add_input(NodeSocketLogicFloat, "Value") - self.add_input(NodeSocketLogicVectorXY, "Range", None, {'enabled': False}) - self.add_input(NodeSocketLogicFloat, "Min") - self.add_input(NodeSocketLogicFloat, "Max") - self.add_output(NodeSocketLogicCondition, "If True") + self.add_input(NodeSocketLogicFloat, "Value", 'value') + self.add_input(NodeSocketLogicVectorXY, "Range", 'range', {'enabled': False}) + self.add_input(NodeSocketLogicFloat, "Min", 'min_value') + self.add_input(NodeSocketLogicFloat, "Max", 'max_value') + self.add_output(NodeSocketLogicCondition, "If True", 'OUT') LogicNodeConditionType.init(self, context) def draw_buttons(self, context, layout): layout.prop(self, "operator", text="") def get_attributes(self): - return [("operator", f'"{self.operator}"')] - - nl_class = "ULWithinRange" + return [("operator", repr(self.operator))] + # XXX Remove for 4.0 def get_input_names(self): return ["value", "range", "min_value", "max_value"] + # XXX Remove for 4.0 def get_output_names(self): return ['OUT'] diff --git a/editor/nodes/parameters/euler.py b/editor/nodes/parameters/euler.py index 432805c..7ad12ca 100644 --- a/editor/nodes/parameters/euler.py +++ b/editor/nodes/parameters/euler.py @@ -11,26 +11,27 @@ class LogicNodeEuler(LogicNodeParameterType): bl_idname = "NLParameterEulerSimpleNode" bl_label = "Euler" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULEuler" euler_order: EnumProperty(items=_enum_euler_orders, name='Euler Order') def init(self, context): - self.add_input(NodeSocketLogicFloat, 'X') - self.add_input(NodeSocketLogicFloat, 'Y') - self.add_input(NodeSocketLogicFloat, 'Z') - self.add_output(NodeSocketLogicVectorXYZ, "Euler") + self.add_input(NodeSocketLogicFloat, 'X', 'input_x') + self.add_input(NodeSocketLogicFloat, 'Y', 'input_y') + self.add_input(NodeSocketLogicFloat, 'Z', 'input_z') + self.add_output(NodeSocketLogicVectorXYZ, "Euler", 'OUTV') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout) -> None: layout.prop(self, 'euler_order', text='') - nl_class = "ULEuler" - - def get_output_names(self): - return ["OUTV"] - def get_attributes(self): - return [('order', f'"{self.euler_order}"')] + return [('order', repr(self.euler_order))] + # XXX Remove for 4.0 def get_input_names(self): return ["input_x", "input_y", "input_z"] + + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUTV"] diff --git a/editor/nodes/parameters/formula.py b/editor/nodes/parameters/formula.py index 6182fd3..1e32193 100644 --- a/editor/nodes/parameters/formula.py +++ b/editor/nodes/parameters/formula.py @@ -12,8 +12,9 @@ class LogicNodeFormula(LogicNodeParameterType): bl_idname = "NLParameterMathFun" bl_label = "Formula" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULFormula" - value: StringProperty(default='a + b') + value: StringProperty(default='a + b', name='Formula') predefined_formulas: EnumProperty( name='Operation', @@ -25,21 +26,20 @@ def init(self, context): self.add_input(NodeSocketLogicFloat, "b") self.add_output(NodeSocketLogicFloat, "Result") LogicNodeParameterType.init(self, context) - # self.value = "a + b" def draw_buttons(self, context, layout): layout.prop(self, "predefined_formulas", text="Predef.") if self.predefined_formulas == 'User Defined': layout.prop(self, "value", text="Formula") - def get_input_names(self): - return ["a", "b"] - def get_attributes(self): usr_def = 'User Defined' - return [("formula", f'"{self.value if self.predefined_formulas == usr_def else self.predefined_formulas}"')] + return [("formula", repr(self.value if self.predefined_formulas == usr_def else self.predefined_formulas))] - nl_class = "ULFormula" + # XXX Remove for 4.0 + def get_input_names(self): + return ["a", "b"] + # XXX Remove for 4.0 def get_output_names(self): return ["OUT"] diff --git a/editor/nodes/parameters/getcollisionbitmask.py b/editor/nodes/parameters/getcollisionbitmask.py new file mode 100644 index 0000000..ea63073 --- /dev/null +++ b/editor/nodes/parameters/getcollisionbitmask.py @@ -0,0 +1,38 @@ +from bpy.types import Context, UILayout + +from ..node import node_type +from ..node import LogicNodeParameterType +from ...sockets import NodeSocketLogicObject +from ...sockets.integersocket import NodeSocketLogicInteger +from ...enum_types import _collision_bitmask_types +from bpy.props import EnumProperty + + +@node_type +class LogicNodeGetCollisionBitMask(LogicNodeParameterType): + bl_idname = "LogicNodeGetCollisionBitMask" + bl_label = "Get Collision Group" + nl_module = 'uplogic.nodes.parameters' + nl_class = "GetCollisionGroupNode" + + search_tags = [ + ['Set Collision Group', {'nl_label': 'Set Collision Group'}], + ['Set Collision Mask', {'nl_label': 'Set Collision Mask', 'mode': '1'}], + ] + + def update_draw(self, context): + mode = int(self.mode) + self.nl_label = f"Get Collision {'Mask' if mode > 0 else 'Group'}" + + mode: EnumProperty(items=_collision_bitmask_types, name='Mode', update=update_draw) + + def init(self, context): + self.add_input(NodeSocketLogicObject, 'Object', 'game_object') + self.add_output(NodeSocketLogicInteger, 'Bitmask', 'INT') + LogicNodeParameterType.init(self, context) + + def draw_buttons(self, context: Context, layout: UILayout) -> None: + layout.prop(self, 'mode', text='') + + def get_attributes(self): + return [('mode', self.mode)] diff --git a/editor/nodes/parameters/getobjectattr.py b/editor/nodes/parameters/getobjectattr.py index edf4ac1..6031718 100644 --- a/editor/nodes/parameters/getobjectattr.py +++ b/editor/nodes/parameters/getobjectattr.py @@ -43,7 +43,9 @@ def update_draw(self, context=None): self.outputs[4].enabled = False elif self.attr_name in [ 'localOrientation', - 'worldOrientation' + 'worldOrientation', + 'localTransform', + 'worldTransform' ]: self.outputs[0].enabled = False self.outputs[1].enabled = False @@ -109,24 +111,25 @@ def update_draw(self, context=None): update=update_draw ) - def init(self, context): - self.add_input(NodeSocketLogicObject, "Object") - self.add_output(NodeSocketLogicString, "Value") - self.add_output(NodeSocketLogicVectorXYZ, "Vector", None, {'enabled': False}) - self.add_output(NodeSocketLogicBoolean, "Visible", None, {'enabled': False}) - self.add_output(NodeSocketLogicMatrix, "Orientation", None, {'enabled': False}) - self.add_output(NodeSocketLogicColorRGBA, "Color", None, {'enabled': False}) + self.add_input(NodeSocketLogicObject, "Object", 'game_object') + self.add_output(NodeSocketLogicString, "Value", '_attr_name') + self.add_output(NodeSocketLogicVectorXYZ, "Vector", 'OUT', {'enabled': False}) + self.add_output(NodeSocketLogicBoolean, "Visible", 'OUT', {'enabled': False}) + self.add_output(NodeSocketLogicMatrix, "Orientation", 'OUT', {'enabled': False}) + self.add_output(NodeSocketLogicColorRGBA, "Color", 'OUT', {'enabled': False}) LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout) -> None: layout.prop(self, 'attr_name', text="") def get_attributes(self): - return [("attribute_name", f'"{self.attr_name}"')] + return [("attribute_name", repr(self.attr_name))] + # XXX Remove for 4.0 def get_input_names(self): return ["game_object", "_attr_name"] + # XXX Remove for 4.0 def get_output_names(self): return ["OUT", "OUT", "OUT", "OUT"] diff --git a/editor/nodes/parameters/getuiwidgetattr.py b/editor/nodes/parameters/getuiwidgetattr.py index f80922b..0052c64 100644 --- a/editor/nodes/parameters/getuiwidgetattr.py +++ b/editor/nodes/parameters/getuiwidgetattr.py @@ -20,6 +20,7 @@ class LogicNodeGetUIWidgetAttr(LogicNodeParameterType): bl_idname = "LogicNodeGetUIWidgetAttr" bl_label = "Get Widget Attribute" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULGetUIWidgetAttr" def update_draw(self, context=None): if not self.ready: @@ -44,32 +45,30 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicUI, "Widget") - self.add_output(NodeSocketLogicBoolean, "Visibility") - self.add_output(NodeSocketLogicColorRGBA, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicFloatFactor, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicVectorXY, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicString, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicInteger, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicFloat, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicFont, "", None, {'enabled': False}) - self.add_output(NodeSocketLogicImage, "", None, {'enabled': False}) + self.add_input(NodeSocketLogicUI, "Widget", 'widget') + self.add_output(NodeSocketLogicBoolean, "Visibility", 'BOOL') + self.add_output(NodeSocketLogicColorRGBA, "", 'COLOR', {'enabled': False}) + self.add_output(NodeSocketLogicFloatFactor, "", 'ALPHA', {'enabled': False}) + self.add_output(NodeSocketLogicVectorXY, "", 'VEC2', {'enabled': False}) + self.add_output(NodeSocketLogicString, "", 'STR', {'enabled': False}) + self.add_output(NodeSocketLogicInteger, "", 'INT', {'enabled': False}) + self.add_output(NodeSocketLogicFloat, "", 'FLOAT', {'enabled': False}) + self.add_output(NodeSocketLogicFont, "", 'FONT', {'enabled': False}) + self.add_output(NodeSocketLogicImage, "", 'IMG', {'enabled': False}) LogicNodeParameterType.init(self, context) def get_attributes(self): return [ - ("widget_attr", f'"{self.widget_attr}"') + ("widget_attr", repr(self.widget_attr)) ] def draw_buttons(self, context, layout) -> None: layout.prop(self, 'widget_attr', text='') - nl_class = "ULGetUIWidgetAttr" + # XXX Remove for 4.0 + def get_input_names(self): + return ['widget'] + # XXX Remove for 4.0 def get_output_names(self): return ['BOOL', 'COLOR', 'ALPHA', 'VEC2', 'STR', 'INT', 'FLOAT', 'FONT', 'IMG'] - - def get_input_names(self): - return [ - 'widget' - ] diff --git a/editor/nodes/parameters/limitrange.py b/editor/nodes/parameters/limitrange.py index 36c210a..a7931ca 100644 --- a/editor/nodes/parameters/limitrange.py +++ b/editor/nodes/parameters/limitrange.py @@ -12,6 +12,7 @@ class LogicNodeLimitRange(LogicNodeParameterType): bl_idname = "NLLimitRange" bl_label = "Limit Range" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULLimitRange" operator: EnumProperty( items=_enum_in_or_out, @@ -19,23 +20,23 @@ class LogicNodeLimitRange(LogicNodeParameterType): ) def init(self, context): - self.add_input(NodeSocketLogicFloat, "Value") - self.add_input(NodeSocketLogicVectorXY, "Threshold", None, {'enabled': False}) - self.add_input(NodeSocketLogicFloat, "Min") - self.add_input(NodeSocketLogicFloat, "Max") - self.add_output(NodeSocketLogicParameter, "Value") + self.add_input(NodeSocketLogicFloat, "Value", 'value') + self.add_input(NodeSocketLogicVectorXY, "Threshold", 'threshold', {'enabled': False}) + self.add_input(NodeSocketLogicFloat, "Min", 'min_value') + self.add_input(NodeSocketLogicFloat, "Max", 'max_value') + self.add_output(NodeSocketLogicParameter, "Value", 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout): layout.prop(self, "operator", text="") def get_attributes(self): - return [("operator", f'"{self.operator}"')] - - nl_class = "ULLimitRange" + return [("operator", repr(self.operator))] + # XXX Remove for 4.0 def get_input_names(self): return ["value", "threshold", 'min_value', 'max_value'] + # XXX Remove for 4.0 def get_output_names(self): return ['OUT'] diff --git a/editor/nodes/parameters/matrixtoxyz.py b/editor/nodes/parameters/matrixtoxyz.py index e7f9ecd..4d08cf8 100644 --- a/editor/nodes/parameters/matrixtoxyz.py +++ b/editor/nodes/parameters/matrixtoxyz.py @@ -13,6 +13,7 @@ class LogicNodeMatrixToXYZ(LogicNodeParameterType): bl_label = "Matrix To XYZ" bl_width_default = 200 nl_module = 'uplogic.nodes.parameters' + nl_class = "ULMatrixToXYZ" def update_draw(self, context=None): if not self.ready: @@ -32,22 +33,22 @@ def update_draw(self, context=None): ) def init(self, context): - self.add_input(NodeSocketLogicMatrix, 'Matrix') - self.add_output(NodeSocketLogicVectorXYZ, "XYZ") + self.add_input(NodeSocketLogicMatrix, 'Matrix', 'input_m') + self.add_output(NodeSocketLogicVectorXYZ, "XYZ", 'OUT') LogicNodeParameterType.init(self, context) - nl_class = "ULMatrixToXYZ" - def draw_buttons(self, context, layout): layout.prop(self, "output", text='') if int(self.output) == 1: layout.prop(self, "euler_order", text='') - def get_output_names(self): - return ["OUT"] + def get_attributes(self): + return [("output", repr(self.output)), ("euler_order", repr(self.euler_order))] + # XXX Remove for 4.0 def get_input_names(self): return ["input_m"] - def get_attributes(self): - return [("output", f'{self.output}'), ("euler_order", f'"{self.euler_order}"')] + # XXX Remove for 4.0 + def get_output_names(self): + return ["OUT"] diff --git a/editor/nodes/parameters/rangedthreshold.py b/editor/nodes/parameters/rangedthreshold.py index 672519b..ec57b68 100644 --- a/editor/nodes/parameters/rangedthreshold.py +++ b/editor/nodes/parameters/rangedthreshold.py @@ -12,6 +12,7 @@ class LogicNodeRangedThreshold(LogicNodeParameterType): bl_idname = "NLRangedThresholdNode" bl_label = "Ranged Threshold" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULRangedThreshold" operator: EnumProperty( items=_enum_in_or_out, @@ -19,23 +20,23 @@ class LogicNodeRangedThreshold(LogicNodeParameterType): ) def init(self, context): - self.add_input(NodeSocketLogicFloat, "Value") - self.add_input(NodeSocketLogicVectorXY, "Threshold", None, {'enabled': False}) - self.add_input(NodeSocketLogicFloat, "Min") - self.add_input(NodeSocketLogicFloat, "Max") - self.add_output(NodeSocketLogicParameter, "Value") + self.add_input(NodeSocketLogicFloat, "Value", 'value') + self.add_input(NodeSocketLogicVectorXY, "Threshold", 'threshold', {'enabled': False}) + self.add_input(NodeSocketLogicFloat, "Min", 'min_value') + self.add_input(NodeSocketLogicFloat, "Max", 'max_value') + self.add_output(NodeSocketLogicParameter, "Value", 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout): layout.prop(self, "operator", text="") def get_attributes(self): - return [("operator", f'"{self.operator}"')] - - nl_class = "ULRangedThreshold" + return [("operator", repr(self.operator))] + # XXX Remove for 4.0 def get_input_names(self): return ["value", "threshold", "min_value", "max_value"] + # XXX Remove for 4.0 def get_output_names(self): return ['OUT'] diff --git a/editor/nodes/parameters/rebuilddata.py b/editor/nodes/parameters/rebuilddata.py index 096debb..e92801d 100644 --- a/editor/nodes/parameters/rebuilddata.py +++ b/editor/nodes/parameters/rebuilddata.py @@ -35,7 +35,7 @@ def draw_buttons(self, context, layout): layout.prop(self, 'read_as', text='') def get_attributes(self): - return [("read_as", f'"{self.read_as}"')] + return [("read_as", repr(self.read_as))] def get_input_names(self): # XXX Remove for 4.0 if len(self.inputs) < 2: diff --git a/editor/nodes/parameters/rotatebypoint.py b/editor/nodes/parameters/rotatebypoint.py index 0406764..c55f87e 100644 --- a/editor/nodes/parameters/rotatebypoint.py +++ b/editor/nodes/parameters/rotatebypoint.py @@ -1,12 +1,11 @@ from bpy.types import Context, UILayout from ..node import node_type from ..node import LogicNodeParameterType -from ...sockets import NodeSocketLogicVectorXY from ...sockets import NodeSocketLogicVectorXYZ from ...sockets import NodeSocketLogicFloatAngle -from ...enum_types import _enum_local_axis -from ...enum_types import _rotate_by_types +from ...sockets import NodeSocketLogicVectorXYZAngle from bpy.props import EnumProperty +from ....utilities import WARNING_MESSAGES @node_type @@ -17,26 +16,55 @@ class LogicNodeRotateByPoint(LogicNodeParameterType): nl_class = "ULRotateByPoint" def update_draw(self, context=None): - self.inputs[3].enabled = self.mode == '2' + # XXX: Remove Legacy Check + if len(self.inputs) == 4: + self.inputs[3].enabled = self.mode == '2' + else: + self.inputs[2].enabled = self.mode == '2' + self.inputs[3].enabled = self.mode != '3' + self.inputs[4].enabled = self.mode == '3' - mode: EnumProperty(items=_rotate_by_types, name='Mode', update=update_draw) - global_axis: EnumProperty(items=_enum_local_axis) + axis_options = [ + ("0", "X Axis", "The Local X Axis [Integer Value 0]"), + ("1", "Y Axis", "The Local Y Axis [Integer Value 1]"), + ("2", "Z Axis", "The Local Z Axis [Integer Value 2]") + ] + + rotate_options = [ + ("0", "2D", ""), + ("1", "3D", ""), + ("2", "Arbitrary Axis", ""), + ("3", "Euler", "") + ] + + mode: EnumProperty(items=rotate_options, name='Mode', update=update_draw) + global_axis: EnumProperty(items=axis_options, name='Axis') def draw_buttons(self, context: Context, layout: UILayout) -> None: layout.prop(self, 'mode', text='') if self.mode == '1': layout.prop(self, 'global_axis', text='') + + def check(self, tree): + super().check(tree) + if len(self.inputs) < 5: + global WARNING_MESSAGES + WARNING_MESSAGES.append(f"Node '{self.name}' in tree '{tree.name}' changed inputs. Re-Add to avoid issues.") + self.use_custom_color = True + self.color = (.8, .6, 0) def init(self, context): - self.add_input(NodeSocketLogicVectorXYZ, 'Origin') - self.add_input(NodeSocketLogicVectorXYZ, 'Pivot') - self.add_input(NodeSocketLogicFloatAngle, 'Angle') - self.add_input(NodeSocketLogicVectorXYZ, 'Axis') - self.add_output(NodeSocketLogicVectorXY, 'Point') + self.add_input(NodeSocketLogicVectorXYZ, 'Origin', 'origin') + self.add_input(NodeSocketLogicVectorXYZ, 'Pivot', 'pivot') + self.add_input(NodeSocketLogicVectorXYZ, 'Axis', 'arbitrary_axis', {'default_value': (0, 0, 1)}) + self.add_input(NodeSocketLogicFloatAngle, 'Angle', 'angle') + self.add_input(NodeSocketLogicVectorXYZAngle, 'Euler', 'euler_angles') + self.add_output(NodeSocketLogicVectorXYZ, 'Point', 'OUT') LogicNodeParameterType.init(self, context) + # XXX: Remove for 4.0 def get_input_names(self): - return ["origin", "pivot", 'angle', 'arbitrary_axis'] + return ["origin", "pivot", 'angle', 'arbitrary_axis', 'euler_angles'] def get_attributes(self): return [ diff --git a/editor/nodes/parameters/serializedata.py b/editor/nodes/parameters/serializedata.py index 9c29669..2e7c798 100644 --- a/editor/nodes/parameters/serializedata.py +++ b/editor/nodes/parameters/serializedata.py @@ -20,18 +20,20 @@ class LogicNodeSerializeData(LogicNodeParameterType): ) def init(self, context): - self.add_input(NodeSocketLogicParameter, "Data") - self.add_output(NodeSocketLogicDictionary, 'Data') + self.add_input(NodeSocketLogicParameter, "Data", 'data') + self.add_output(NodeSocketLogicDictionary, 'Data', 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout) -> None: layout.prop(self, 'serialize_as', text='') def get_attributes(self): - return [("serialize_as", f'"{self.serialize_as}"')] + return [("serialize_as", repr(self.serialize_as))] + # XXX Remove for 4.0 def get_input_names(self): return ["data"] + # XXX Remove for 4.0 def get_output_names(self): return ['OUT'] diff --git a/editor/nodes/parameters/storevalue.py b/editor/nodes/parameters/storevalue.py index f71dd5a..f9464c4 100644 --- a/editor/nodes/parameters/storevalue.py +++ b/editor/nodes/parameters/storevalue.py @@ -4,6 +4,7 @@ from ...sockets import NodeSocketLogicValue from ...sockets import NodeSocketLogicParameter from bpy.props import BoolProperty +from ....utilities import WARNING_MESSAGES @node_type @@ -11,6 +12,7 @@ class LogicNodeStoreValue(LogicNodeParameterType): bl_idname = "NLStoreValue" bl_label = "Store Value" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULStoreValue" initialize: BoolProperty( name='Initialize', @@ -18,10 +20,19 @@ class LogicNodeStoreValue(LogicNodeParameterType): default=True ) + def check(self, tree): + super().check(tree) + if len(self.outputs) != 2: + global WARNING_MESSAGES + WARNING_MESSAGES.append(f"Node '{self.name}' in tree '{tree.name}' changed outputs. Re-Add to avoid issues.") + self.use_custom_color = True + self.color = (.8, .6, 0) + def init(self, context): - self.add_input(NodeSocketLogicCondition, "Condition") - self.add_input(NodeSocketLogicValue, "") - self.add_output(NodeSocketLogicParameter, "Stored Value") + self.add_input(NodeSocketLogicCondition, "Condition", 'condition') + self.add_input(NodeSocketLogicValue, "", 'value') + self.add_output(NodeSocketLogicCondition, "Done", 'DONE') + self.add_output(NodeSocketLogicParameter, "Stored Value", 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout): @@ -30,10 +41,10 @@ def draw_buttons(self, context, layout): def get_attributes(self): return [("initialize", self.initialize)] + # XXX Remove for 4.0 def get_input_names(self): return ['condition', 'value'] - nl_class = "ULStoreValue" - + # XXX Remove for 4.0 def get_output_names(self): - return ["OUT"] + return ['DONE', "OUT"] diff --git a/editor/nodes/parameters/threshold.py b/editor/nodes/parameters/threshold.py index a35610f..6d7db56 100644 --- a/editor/nodes/parameters/threshold.py +++ b/editor/nodes/parameters/threshold.py @@ -13,6 +13,7 @@ class LogicNodeThreshold(LogicNodeParameterType): bl_idname = "NLThresholdNode" bl_label = "Threshold" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULThreshold" operator: EnumProperty( name='Operation', @@ -20,22 +21,22 @@ class LogicNodeThreshold(LogicNodeParameterType): ) def init(self, context): - self.add_input(NodeSocketLogicBoolean, "Else 0", None, {'default_value': True}) - self.add_input(NodeSocketLogicFloat, "Value") - self.add_input(NodeSocketLogicFloat, "Threshold") - self.add_output(NodeSocketLogicParameter, "Value") + self.add_input(NodeSocketLogicBoolean, "Else 0", 'else_z', {'default_value': True}) + self.add_input(NodeSocketLogicFloat, "Value", 'value') + self.add_input(NodeSocketLogicFloat, "Threshold", 'threshold') + self.add_output(NodeSocketLogicParameter, "Value", 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout): layout.prop(self, "operator", text="") def get_attributes(self): - return [("operator", f'"{self.operator}"')] - - nl_class = "ULThreshold" + return [("operator", repr(self.operator))] + # XXX Remove for 4.0 def get_input_names(self): return ['else_z', "value", "threshold"] + # XXX Remove for 4.0 def get_output_names(self): return ["OUT"] diff --git a/editor/nodes/parameters/typecast.py b/editor/nodes/parameters/typecast.py index 16cef08..5e4c848 100644 --- a/editor/nodes/parameters/typecast.py +++ b/editor/nodes/parameters/typecast.py @@ -14,6 +14,7 @@ class LogicNodeTypecast(LogicNodeParameterType): bl_idname = "NLParameterTypeCast" bl_label = "Typecast Value" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULTypeCastValue" def update_draw(self, context=None): if not self.ready: @@ -26,23 +27,23 @@ def update_draw(self, context=None): to_type: EnumProperty(items=_enum_type_casts, update=update_draw, name='To Type') def init(self, context): - self.add_input(NodeSocketLogicValue, "") - self.add_output(NodeSocketLogicInteger, "Integer") - self.add_output(NodeSocketLogicBoolean, "Boolean") - self.add_output(NodeSocketLogicString, "String") - self.add_output(NodeSocketLogicFloat, "Float") + self.add_input(NodeSocketLogicValue, "", 'value') + self.add_output(NodeSocketLogicInteger, "Integer", 'OUT') + self.add_output(NodeSocketLogicBoolean, "Boolean", 'OUT') + self.add_output(NodeSocketLogicString, "String", 'OUT') + self.add_output(NodeSocketLogicFloat, "Float", 'OUT') LogicNodeParameterType.init(self, context) def draw_buttons(self, context, layout) -> None: layout.prop(self, 'to_type', text='') - nl_class = "ULTypeCastValue" + def get_attributes(self): + return [('to_type', repr(self.to_type))] + # XXX Remove for 4.0 def get_input_names(self): return ["value"] - def get_attributes(self): - return [('to_type', f'"{self.to_type}"')] - + # XXX Remove for 4.0 def get_output_names(self): return ['OUT', 'OUT', 'OUT', 'OUT'] diff --git a/editor/nodes/parameters/variableload.py b/editor/nodes/parameters/variableload.py index 2865db6..a2d690f 100644 --- a/editor/nodes/parameters/variableload.py +++ b/editor/nodes/parameters/variableload.py @@ -50,7 +50,7 @@ def get_attributes(self): if s_path.endswith('\\'): s_path = s_path[:-1] path_formatted = s_path.replace('\\', '/') - return [("path", f"'{path_formatted}'" if self.custom_path else "''")] + return [("path", repr(path_formatted) if self.custom_path else "''")] def get_output_names(self): return ['VAR'] diff --git a/editor/nodes/parameters/variablesload.py b/editor/nodes/parameters/variablesload.py index 4724690..ad7adfd 100644 --- a/editor/nodes/parameters/variablesload.py +++ b/editor/nodes/parameters/variablesload.py @@ -47,7 +47,7 @@ def get_attributes(self): if s_path.endswith('\\'): s_path = s_path[:-1] path_formatted = s_path.replace('\\', '/') - return [("path", f"'{path_formatted}'" if self.custom_path else "''")] + return [("path", repr(path_formatted) if self.custom_path else "''")] def get_output_names(self): return ["VAR"] diff --git a/editor/nodes/parameters/vectormath.py b/editor/nodes/parameters/vectormath.py index b772dce..72aca5a 100644 --- a/editor/nodes/parameters/vectormath.py +++ b/editor/nodes/parameters/vectormath.py @@ -14,6 +14,7 @@ class LogicNodeVectorMath(LogicNodeParameterType): bl_idname = "NLVectorMath" bl_label = "Vector Math" nl_module = 'uplogic.nodes.parameters' + nl_class = "ULVectorMath" def update_draw(self, context=None): if not self.ready: @@ -53,21 +54,21 @@ def check(self, tree): self.color = (.8, .6, 0) def init(self, context): - self.add_input(NodeSocketLogicVectorXYZ, "Vector 1") - self.add_input(NodeSocketLogicVectorXYZ, "Vector 2") - self.add_input(NodeSocketLogicFloatFactor, "Factor", None, {'default_value': 1.0}) - self.add_input(NodeSocketLogicFloat, "Scale") - self.add_input(NodeSocketLogicVectorXYZ, "Vector 3") - self.add_input(NodeSocketLogicFloat, "IOR") - self.add_output(NodeSocketLogicParameter, 'Result') - self.add_output(NodeSocketLogicVectorXYZ, 'Result') + self.add_input(NodeSocketLogicVectorXYZ, "Vector 1", 'vector') + self.add_input(NodeSocketLogicVectorXYZ, "Vector 2", 'vector_2') + self.add_input(NodeSocketLogicFloatFactor, "Factor", 'factor', {'default_value': 1.0}) + self.add_input(NodeSocketLogicFloat, "Scale", 'scale') + self.add_input(NodeSocketLogicVectorXYZ, "Vector 3", 'vector_3') + self.add_input(NodeSocketLogicFloat, "IOR", 'ior') + self.add_output(NodeSocketLogicParameter, 'Result', 'OUT') + self.add_output(NodeSocketLogicVectorXYZ, 'Result', 'VOUT') LogicNodeParameterType.init(self, context) - nl_class = "ULVectorMath" - + # XXX Remove for 4.0 def get_input_names(self): return ["vector", 'vector_2', 'factor', 'scale', 'vector_3', 'ior'] + # XXX Remove for 4.0 def get_output_names(self): return ["OUT", 'VOUT'] @@ -75,4 +76,4 @@ def draw_buttons(self, context, layout): layout.prop(self, 'operator', text='') def get_attributes(self): - return [("op", f'"{self.operator}"')] + return [("op", repr(self.operator))] diff --git a/editor/nodetree.py b/editor/nodetree.py index fcc5ac7..1d56de7 100644 --- a/editor/nodetree.py +++ b/editor/nodetree.py @@ -128,5 +128,8 @@ def update(self): if osock.type != socket.type: osock.type = socket.type osock.display_shape = socket.display_shape - n.outputs[0].type = socket.type + # n.outputs[0].type = socket.type + n.outputs[0].type = 'VALUE' + print(n.outputs[0].type) + n.outputs[0].display_shape = socket.display_shape diff --git a/editor/sockets/fontsocket.py b/editor/sockets/fontsocket.py index b247d2c..1d22349 100644 --- a/editor/sockets/fontsocket.py +++ b/editor/sockets/fontsocket.py @@ -38,8 +38,13 @@ def draw(self, context, layout, node, text): row.label(text=text) row2 = col.row(align=True) row2.prop(self, "default_value", text='') - row2.operator( - 'logic_nodes.load_font', icon='FILEBROWSER', text='') + op = row2.operator( + 'logic_nodes.load_font', + icon='FILEBROWSER', + text='' + ) + # op.node_name = self.node.name + # op.socket_idx = self.node._index_of(self, self.node.inputs) def get_unlinked_value(self): if self.default_value is None: diff --git a/ops/loadfile.py b/ops/loadfile.py index bfa84df..be99aa8 100644 --- a/ops/loadfile.py +++ b/ops/loadfile.py @@ -5,6 +5,8 @@ from bpy.types import Operator from bpy_extras.io_utils import ImportHelper from bpy.props import StringProperty +from bpy.props import IntProperty +from bpy.props import PointerProperty import bpy @@ -71,14 +73,20 @@ class LOGIC_NODES_OT_load_font(Operator, ImportHelper): options={'HIDDEN'} ) + data: PointerProperty(type=bpy.types.VectorFont) + # tree_name: StringProperty(default='') + # node_name: StringProperty(default='') + # socket_idx: IntProperty(default=0) + @classmethod def poll(cls, context): return True def execute(self, context): - bpy.ops.font.open( - filepath=self.filepath, - relative_path=True, - filter_font=True - ) - return {'FINISHED'} \ No newline at end of file + self.data = bpy.data.fonts.load(self.filepath, check_existing=True) + # socket = getattr(context, 'socket', None) + socket = context.space_data.edit_tree.nodes[self.node_name].inputs[self.socket_idx] + print(socket) + # if socket: + # socket.default_value = self.data + return {'FINISHED'} diff --git a/ui/node_menu.py b/ui/node_menu.py index 6e15950..10816f4 100644 --- a/ui/node_menu.py +++ b/ui/node_menu.py @@ -305,10 +305,12 @@ class LightsMenu(bpy.types.Menu): def draw(self, context): layout = self.layout insertNode(layout, "NLGetLightColorAction", "Get Light Color") - insertNode(layout, "NLSetLightColorAction", "Set Light Color") insertNode(layout, "NLGetLightEnergy", "Get Light Power") + layout.separator() + insertNode(layout, "NLSetLightColorAction", "Set Light Color") insertNode(layout, "NLSetLightEnergyAction", "Set Light Power") insertNode(layout, "NLSetLightShadowAction", "Set Light Shadow") + layout.separator() insertNode(layout, "NLMakeUniqueLight", "Make Light Unique") @@ -734,8 +736,9 @@ def draw(self, context): layout.menu("LN_MT_character_menu", text="Character", icon="RIGHTARROW_THIN") layout.separator() insertNode(layout, "NLConditionCollisionNode", "Collision") + insertNode(layout, "LogicNodeGetCollisionBitMask", "Get Collision Group") insertNode(layout, "NLSetCollisionGroup", "Set Collision Group") - insertNode(layout, "NLSetCollisionMask", "Set Collision Mask", settings={'mode': '1'}) + # insertNode(layout, "NLSetCollisionMask", "Set Collision Mask", settings={'mode': '1'}) layout.separator() insertNode(layout, "NLActionAddPhysicsConstraint", "Add Constraint") insertNode(layout, "NLActionRemovePhysicsConstraint", "Remove Constraint")