diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/__init__.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/__init__.py index 1a48057..6e2aefd 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/__init__.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/__init__.py @@ -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', ] diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flow_actions.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flow_actions.py index d59c1c8..0413c9e 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flow_actions.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flow_actions.py @@ -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, diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flows.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flows.py index 8b96029..016c60b 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flows.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/contracts/data_flows.py @@ -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] #################### diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py index af7f292..b4b6e36 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/base.py @@ -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}"' diff --git a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/maxwell/source.py b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/maxwell/source.py index 79e68b8..5320848 100644 --- a/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/maxwell/source.py +++ b/src/blender_maxwell/node_trees/maxwell_sim_nodes/sockets/maxwell/source.py @@ -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 ####################