kopia lustrzana https://github.com/carson-katri/geometry-script
Improve invert and linking logic
rodzic
db323268a2
commit
a3337dbdbf
|
@ -42,11 +42,16 @@ def build_node(node_type):
|
||||||
if issubclass(type(x), Type):
|
if issubclass(type(x), Type):
|
||||||
State.current_node_tree.links.new(x._socket, node_input)
|
State.current_node_tree.links.new(x._socket, node_input)
|
||||||
else:
|
else:
|
||||||
try:
|
def link_constant():
|
||||||
node_input.default_value = x
|
|
||||||
except:
|
|
||||||
constant = Type(value=x)
|
constant = Type(value=x)
|
||||||
State.current_node_tree.links.new(constant._socket, node_input)
|
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]
|
value = kwargs[argname]
|
||||||
if isinstance(value, enum.Enum):
|
if isinstance(value, enum.Enum):
|
||||||
value = value.value
|
value = value.value
|
||||||
|
@ -331,7 +336,8 @@ class Type:
|
||||||
x = Type()
|
x = Type()
|
||||||
y = Type()
|
y = Type()
|
||||||
z = 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(add_self_arg, filter(lambda x: x.startswith('def'), symbols)))}
|
||||||
|
|
||||||
{newline.join(map(type_symbol, Type.__subclasses__()))}
|
{newline.join(map(type_symbol, Type.__subclasses__()))}
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Type(metaclass=_TypeMeta):
|
||||||
if self._socket.type == 'BOOLEAN':
|
if self._socket.type == 'BOOLEAN':
|
||||||
return self._boolean_math(None, 'NOT')
|
return self._boolean_math(None, 'NOT')
|
||||||
else:
|
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):
|
def _get_xyz_component(self, component):
|
||||||
if self._socket.type != 'VECTOR':
|
if self._socket.type != 'VECTOR':
|
||||||
|
|
Ładowanie…
Reference in New Issue