Improve invert and linking logic

pull/10/head
Carson Katri 2022-11-28 17:32:21 -05:00
rodzic db323268a2
commit a3337dbdbf
2 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -42,11 +42,16 @@ def build_node(node_type):
if issubclass(type(x), Type):
State.current_node_tree.links.new(x._socket, node_input)
else:
try:
node_input.default_value = x
except:
def link_constant():
constant = Type(value=x)
State.current_node_tree.links.new(constant._socket, node_input)
if node_input.hide_value:
link_constant()
else:
try:
node_input.default_value = x
except:
link_constant()
value = kwargs[argname]
if isinstance(value, enum.Enum):
value = value.value
@ -331,7 +336,8 @@ class Type:
x = Type()
y = Type()
z = Type()
def capture(self, attribute: Type, **kwargs) -> Callable[[], Type]: return transfer_attribute
def capture(self, attribute: Type, **kwargs) -> (Geometry, Type): return Geometry(), Type()
def transfer(self, attribute: Type, **kwargs) -> Type: return Type()
{(newline + ' ').join(map(add_self_arg, filter(lambda x: x.startswith('def'), symbols)))}
{newline.join(map(type_symbol, Type.__subclasses__()))}

Wyświetl plik

@ -151,7 +151,7 @@ class Type(metaclass=_TypeMeta):
if self._socket.type == 'BOOLEAN':
return self._boolean_math(None, 'NOT')
else:
return self._math(-1, 'MULTIPLY')
return self._math((-1, -1, -1) if self._socket.type == 'VECTOR' else -1, 'MULTIPLY')
def _get_xyz_component(self, component):
if self._socket.type != 'VECTOR':