fix: Some renamed FlowKinds (not all)

main
Sofus Albert Høgsbro Rose 2024-04-17 16:17:13 +02:00
parent 76d15b0c92
commit 29cee2e7a2
Signed by: so-rose
GPG Key ID: AD901CB0F3701434
5 changed files with 39 additions and 45 deletions

View File

@ -55,13 +55,13 @@ from .managed_obj_type import ManagedObjType
#################### ####################
from .data_flows import ( from .data_flows import (
FlowKind, FlowKind,
DataCapabilities, CapabilitiesFlow,
DataValue, ValueFlow,
DataValueArray, ArrayFlow,
DataValueSpectrum, LazyValueFlow,
LazyDataValue, LazyArrayRangeFlow,
LazyDataValueRange, ParamsFlow,
LazyDataValueSpectrum, InfoFlow,
) )
from .data_flow_actions import DataFlowAction from .data_flow_actions import DataFlowAction
@ -90,12 +90,12 @@ __all__ = [
'NODE_CAT_LABELS', 'NODE_CAT_LABELS',
'ManagedObjType', 'ManagedObjType',
'FlowKind', 'FlowKind',
'DataCapabilities', 'CapabilitiesFlow',
'DataValue', 'ValueFlow',
'DataValueArray', 'ArrayFlow',
'DataValueSpectrum', 'LazyValueFlow',
'LazyDataValue', 'LazyArrayRangeFlow',
'LazyDataValueRange', 'ParamsFlow',
'LazyDataValueSpectrum', 'InfoFlow',
'DataFlowAction', 'DataFlowAction',
] ]

View File

@ -17,6 +17,7 @@ class DataFlowAction(enum.StrEnum):
ShowPreview = 'show_preview' ShowPreview = 'show_preview'
ShowPlot = 'show_plot' ShowPlot = 'show_plot'
@staticmethod
def trigger_direction(action: typ.Self) -> typx.Literal['input', 'output']: def trigger_direction(action: typ.Self) -> typx.Literal['input', 'output']:
"""When a given action is triggered, all sockets/nodes/... in this direction should be recursively triggered. """When a given action is triggered, all sockets/nodes/... in this direction should be recursively triggered.
@ -35,6 +36,7 @@ class DataFlowAction(enum.StrEnum):
DataFlowAction.ShowPlot: 'input', DataFlowAction.ShowPlot: 'input',
}[action] }[action]
@staticmethod
def stop_if_no_event_methods(action: typ.Self) -> bool: def stop_if_no_event_methods(action: typ.Self) -> bool:
return { return {
DataFlowAction.EnableLock: False, DataFlowAction.EnableLock: False,

View File

@ -54,7 +54,7 @@ class FlowKind(enum.StrEnum):
LazyArrayRange = enum.auto() LazyArrayRange = enum.auto()
# Auxiliary # Auxiliary
Param = enum.auto() Params = enum.auto()
Info = enum.auto() Info = enum.auto()
@classmethod @classmethod
@ -283,9 +283,9 @@ class LazyArrayRangeFlow:
#################### ####################
# - Param # - Params
#################### ####################
ParamFlow: typ.TypeAlias = dict[str, typ.Any] ParamsFlow: typ.TypeAlias = dict[str, typ.Any]
#################### ####################

View File

@ -303,56 +303,48 @@ class MaxwellSimSocket(bpy.types.NodeSocket):
# Value # Value
@property @property
def value(self) -> ct.DataValue: def value(self) -> ct.ValueFlow:
raise NotImplementedError raise NotImplementedError
@value.setter @value.setter
def value(self, value: ct.DataValue) -> None: def value(self, value: ct.ValueFlow) -> None:
raise NotImplementedError raise NotImplementedError
# ValueArray # ValueArray
@property @property
def value_array(self) -> ct.DataValueArray: def array(self) -> ct.ArrayFlow:
## TODO: Single-element list when value exists.
raise NotImplementedError raise NotImplementedError
@value_array.setter @array.setter
def value_array(self, value: ct.DataValueArray) -> None: def array(self, value: ct.ArrayFlow) -> None:
raise NotImplementedError
# ValueSpectrum
@property
def value_spectrum(self) -> ct.DataValueSpectrum:
raise NotImplementedError
@value_spectrum.setter
def value_spectrum(self, value: ct.DataValueSpectrum) -> None:
raise NotImplementedError raise NotImplementedError
# LazyValue # LazyValue
@property @property
def lazy_value(self) -> ct.LazyDataValue: def lazy_value(self) -> ct.LazyValueFlow:
raise NotImplementedError raise NotImplementedError
@lazy_value.setter @lazy_value.setter
def lazy_value(self, lazy_value: ct.LazyDataValue) -> None: def lazy_value(self, lazy_value: ct.LazyValueFlow) -> None:
raise NotImplementedError raise NotImplementedError
# LazyValueRange # LazyArrayRange
@property @property
def lazy_value_range(self) -> ct.LazyDataValueRange: def lazy_array_range(self) -> ct.LazyArrayRangeFlow:
raise NotImplementedError raise NotImplementedError
@lazy_value_range.setter @lazy_array_range.setter
def lazy_value_range(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None: def lazy_array_range(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None:
raise NotImplementedError raise NotImplementedError
# LazyValueSpectrum # LazyArrayRange
@property @property
def lazy_value_spectrum(self) -> ct.LazyDataValueSpectrum: def param(self) -> ct.ParamsFlow:
raise NotImplementedError raise NotImplementedError
@lazy_value_spectrum.setter @param.setter
def lazy_value_spectrum(self, value: ct.LazyDataValueSpectrum) -> None: def param(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None:
raise NotImplementedError raise NotImplementedError
#################### ####################
@ -369,10 +361,10 @@ class MaxwellSimSocket(bpy.types.NodeSocket):
return { return {
ct.FlowKind.Value: lambda: self.value, ct.FlowKind.Value: lambda: self.value,
ct.FlowKind.ValueArray: lambda: self.value_array, ct.FlowKind.ValueArray: lambda: self.value_array,
ct.FlowKind.ValueSpectrum: lambda: self.value_spectrum,
ct.FlowKind.LazyValue: lambda: self.lazy_value, ct.FlowKind.LazyValue: lambda: self.lazy_value,
ct.FlowKind.LazyValueRange: lambda: self.lazy_value_range, ct.FlowKind.LazyArrayRange: lambda: self.lazy_array_range,
ct.FlowKind.LazyValueSpectrum: lambda: self.lazy_value_spectrum, ct.FlowKind.Params: lambda: self.params,
ct.FlowKind.Info: lambda: self.info,
}[kind]() }[kind]()
msg = f'socket._compute_data was called with invalid kind "{kind}"' msg = f'socket._compute_data was called with invalid kind "{kind}"'

View File

@ -18,7 +18,7 @@ class MaxwellSourceSocketDef(base.SocketDef):
def init(self, bl_socket: MaxwellSourceBLSocket) -> None: def init(self, bl_socket: MaxwellSourceBLSocket) -> None:
if self.is_list: if self.is_list:
bl_socket.active_kind = ct.FlowKind.ValueArray bl_socket.active_kind = ct.FlowKind.Array
#################### ####################