Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
IzaZed committed Apr 8, 2024
1 parent 13ecde6 commit 47f9422
Show file tree
Hide file tree
Showing 39 changed files with 362 additions and 232 deletions.
6 changes: 4 additions & 2 deletions editor/enum_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"),
(
Expand Down Expand Up @@ -264,6 +265,7 @@
"Local Transform",
'The local transform of the object'
),
None,
('color', 'Color', 'Color')
]

Expand Down
1 change: 1 addition & 0 deletions editor/nodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,6 @@

from .parameters.curveinterpolation import LogicNodeCurveInterpolation
from .parameters.tweenvalue import LogicNodeTweenValue
from .parameters.getcollisionbitmask import LogicNodeGetCollisionBitMask

# from .groupnode import NodeGroupInputLogic
32 changes: 17 additions & 15 deletions editor/nodes/actions/addfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]


Expand All @@ -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
)

Expand All @@ -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"]
16 changes: 8 additions & 8 deletions editor/nodes/actions/createuibutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 6 additions & 2 deletions editor/nodes/actions/createuiimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions editor/nodes/actions/createuilabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions editor/nodes/actions/createuilayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions editor/nodes/actions/createuislider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion editor/nodes/actions/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 5 additions & 1 deletion editor/nodes/actions/setcollisionbitmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion editor/nodes/actions/setuiwidgetattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='')
Expand Down
2 changes: 1 addition & 1 deletion editor/nodes/actions/slowfollow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
]
20 changes: 11 additions & 9 deletions editor/nodes/actions/vehicleaccelerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
]
20 changes: 11 additions & 9 deletions editor/nodes/actions/vehiclebrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
]
34 changes: 18 additions & 16 deletions editor/nodes/actions/vehiclesetattributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)),
]
Loading

0 comments on commit 47f9422

Please sign in to comment.