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 (
FlowKind,
DataCapabilities,
DataValue,
DataValueArray,
DataValueSpectrum,
LazyDataValue,
LazyDataValueRange,
LazyDataValueSpectrum,
CapabilitiesFlow,
ValueFlow,
ArrayFlow,
LazyValueFlow,
LazyArrayRangeFlow,
ParamsFlow,
InfoFlow,
)
from .data_flow_actions import DataFlowAction
@ -90,12 +90,12 @@ __all__ = [
'NODE_CAT_LABELS',
'ManagedObjType',
'FlowKind',
'DataCapabilities',
'DataValue',
'DataValueArray',
'DataValueSpectrum',
'LazyDataValue',
'LazyDataValueRange',
'LazyDataValueSpectrum',
'CapabilitiesFlow',
'ValueFlow',
'ArrayFlow',
'LazyValueFlow',
'LazyArrayRangeFlow',
'ParamsFlow',
'InfoFlow',
'DataFlowAction',
]

View File

@ -17,6 +17,7 @@ class DataFlowAction(enum.StrEnum):
ShowPreview = 'show_preview'
ShowPlot = 'show_plot'
@staticmethod
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.
@ -35,6 +36,7 @@ class DataFlowAction(enum.StrEnum):
DataFlowAction.ShowPlot: 'input',
}[action]
@staticmethod
def stop_if_no_event_methods(action: typ.Self) -> bool:
return {
DataFlowAction.EnableLock: False,

View File

@ -54,7 +54,7 @@ class FlowKind(enum.StrEnum):
LazyArrayRange = enum.auto()
# Auxiliary
Param = enum.auto()
Params = enum.auto()
Info = enum.auto()
@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
@property
def value(self) -> ct.DataValue:
def value(self) -> ct.ValueFlow:
raise NotImplementedError
@value.setter
def value(self, value: ct.DataValue) -> None:
def value(self, value: ct.ValueFlow) -> None:
raise NotImplementedError
# ValueArray
@property
def value_array(self) -> ct.DataValueArray:
def array(self) -> ct.ArrayFlow:
## TODO: Single-element list when value exists.
raise NotImplementedError
@value_array.setter
def value_array(self, value: ct.DataValueArray) -> None:
raise NotImplementedError
# ValueSpectrum
@property
def value_spectrum(self) -> ct.DataValueSpectrum:
raise NotImplementedError
@value_spectrum.setter
def value_spectrum(self, value: ct.DataValueSpectrum) -> None:
@array.setter
def array(self, value: ct.ArrayFlow) -> None:
raise NotImplementedError
# LazyValue
@property
def lazy_value(self) -> ct.LazyDataValue:
def lazy_value(self) -> ct.LazyValueFlow:
raise NotImplementedError
@lazy_value.setter
def lazy_value(self, lazy_value: ct.LazyDataValue) -> None:
def lazy_value(self, lazy_value: ct.LazyValueFlow) -> None:
raise NotImplementedError
# LazyValueRange
# LazyArrayRange
@property
def lazy_value_range(self) -> ct.LazyDataValueRange:
def lazy_array_range(self) -> ct.LazyArrayRangeFlow:
raise NotImplementedError
@lazy_value_range.setter
def lazy_value_range(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None:
@lazy_array_range.setter
def lazy_array_range(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None:
raise NotImplementedError
# LazyValueSpectrum
# LazyArrayRange
@property
def lazy_value_spectrum(self) -> ct.LazyDataValueSpectrum:
def param(self) -> ct.ParamsFlow:
raise NotImplementedError
@lazy_value_spectrum.setter
def lazy_value_spectrum(self, value: ct.LazyDataValueSpectrum) -> None:
@param.setter
def param(self, value: tuple[ct.DataValue, ct.DataValue, int]) -> None:
raise NotImplementedError
####################
@ -369,10 +361,10 @@ class MaxwellSimSocket(bpy.types.NodeSocket):
return {
ct.FlowKind.Value: lambda: self.value,
ct.FlowKind.ValueArray: lambda: self.value_array,
ct.FlowKind.ValueSpectrum: lambda: self.value_spectrum,
ct.FlowKind.LazyValue: lambda: self.lazy_value,
ct.FlowKind.LazyValueRange: lambda: self.lazy_value_range,
ct.FlowKind.LazyValueSpectrum: lambda: self.lazy_value_spectrum,
ct.FlowKind.LazyArrayRange: lambda: self.lazy_array_range,
ct.FlowKind.Params: lambda: self.params,
ct.FlowKind.Info: lambda: self.info,
}[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:
if self.is_list:
bl_socket.active_kind = ct.FlowKind.ValueArray
bl_socket.active_kind = ct.FlowKind.Array
####################