Fix vector/color handling for logic node live patching

This commit is contained in:
Moritz Brückner 2021-07-21 22:58:21 +02:00
parent 5276711094
commit 256d27e289
2 changed files with 3 additions and 2 deletions

View file

@ -11,6 +11,7 @@ class Bridge {
public static var Input = iron.system.Input;
public static var Object = iron.object.Object;
public static var Data = iron.data.Data;
public static var Vec4 = iron.math.Vec4;
public static function log(s: String) { trace(s); };
}

View file

@ -206,9 +206,9 @@ def send_event(event_id: str, opt_data: Any = None):
inp_type = socket.arm_socket_type
if inp_type in ('VECTOR', 'RGB'):
value = '{' + f'"x": {value[0]}, "y": {value[1]}, "z": {value[2]}' + '}'
value = f'new iron.Vec4({arm.node_utils.haxe_format_socket_val(value, array_outer_brackets=False)}, 1.0)'
elif inp_type == 'RGBA':
value = '{' + f'"x": {value[0]}, "y": {value[1]}, "z": {value[2]}, "w": {value[3]}' + '}'
value = f'new iron.Vec4({arm.node_utils.haxe_format_socket_val(value, array_outer_brackets=False)})'
elif inp_type == 'OBJECT':
value = f'iron.Scene.active.getChild("{value}")' if value != '' else 'null'
else: