Skip to content

Commit a3337db

Browse files
committed
Improve invert and linking logic
1 parent db32326 commit a3337db

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

api/node_mapper.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@ def set_or_create_link(x, node_input):
4242
if issubclass(type(x), Type):
4343
State.current_node_tree.links.new(x._socket, node_input)
4444
else:
45-
try:
46-
node_input.default_value = x
47-
except:
45+
def link_constant():
4846
constant = Type(value=x)
4947
State.current_node_tree.links.new(constant._socket, node_input)
48+
if node_input.hide_value:
49+
link_constant()
50+
else:
51+
try:
52+
node_input.default_value = x
53+
except:
54+
link_constant()
5055
value = kwargs[argname]
5156
if isinstance(value, enum.Enum):
5257
value = value.value
@@ -331,7 +336,8 @@ def __ge__(self, other) -> Type: return self
331336
x = Type()
332337
y = Type()
333338
z = Type()
334-
def capture(self, attribute: Type, **kwargs) -> Callable[[], Type]: return transfer_attribute
339+
def capture(self, attribute: Type, **kwargs) -> (Geometry, Type): return Geometry(), Type()
340+
def transfer(self, attribute: Type, **kwargs) -> Type: return Type()
335341
{(newline + ' ').join(map(add_self_arg, filter(lambda x: x.startswith('def'), symbols)))}
336342
337343
{newline.join(map(type_symbol, Type.__subclasses__()))}

api/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def __invert__(self):
151151
if self._socket.type == 'BOOLEAN':
152152
return self._boolean_math(None, 'NOT')
153153
else:
154-
return self._math(-1, 'MULTIPLY')
154+
return self._math((-1, -1, -1) if self._socket.type == 'VECTOR' else -1, 'MULTIPLY')
155155

156156
def _get_xyz_component(self, component):
157157
if self._socket.type != 'VECTOR':

0 commit comments

Comments
 (0)