2024-03-11 16:35:41 +01:00
|
|
|
import typing as typ
|
|
|
|
|
2024-02-14 12:33:40 +01:00
|
|
|
import bpy
|
|
|
|
import sympy as sp
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
from .... import contracts as ct
|
2024-02-14 12:33:40 +01:00
|
|
|
from .... import sockets
|
|
|
|
from ... import base
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
class NumberConstantNode(base.MaxwellSimNode):
|
|
|
|
node_type = ct.NodeType.NumberConstant
|
2024-02-19 14:28:35 +01:00
|
|
|
bl_label = "Numerical Constant"
|
2024-02-14 12:33:40 +01:00
|
|
|
|
2024-02-19 18:36:16 +01:00
|
|
|
input_socket_sets = {
|
2024-03-11 16:35:41 +01:00
|
|
|
"Integer": {
|
|
|
|
"Value": sockets.IntegerNumberSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"Rational": {
|
|
|
|
"Value": sockets.RationalNumberSocketDef(),
|
2024-02-19 18:36:16 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"Real": {
|
|
|
|
"Value": sockets.RealNumberSocketDef(),
|
|
|
|
},
|
|
|
|
"Complex": {
|
|
|
|
"Value": sockets.ComplexNumberSocketDef(),
|
2024-02-19 18:36:16 +01:00
|
|
|
},
|
2024-02-14 12:33:40 +01:00
|
|
|
}
|
2024-02-19 18:36:16 +01:00
|
|
|
output_socket_sets = input_socket_sets
|
2024-02-14 12:33:40 +01:00
|
|
|
|
|
|
|
####################
|
|
|
|
# - Callbacks
|
|
|
|
####################
|
2024-03-11 16:35:41 +01:00
|
|
|
@base.computes_output_socket(
|
|
|
|
"Value",
|
|
|
|
input_sockets={"Value"}
|
|
|
|
)
|
|
|
|
def compute_value(self, input_sockets) -> typ.Any:
|
|
|
|
return input_sockets["Value"]
|
2024-02-14 12:33:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################
|
|
|
|
# - Blender Registration
|
|
|
|
####################
|
|
|
|
BL_REGISTER = [
|
2024-02-19 14:28:35 +01:00
|
|
|
NumberConstantNode,
|
2024-02-14 12:33:40 +01:00
|
|
|
]
|
|
|
|
BL_NODES = {
|
2024-03-11 16:35:41 +01:00
|
|
|
ct.NodeType.NumberConstant: (
|
|
|
|
ct.NodeCategory.MAXWELLSIM_INPUTS_CONSTANTS
|
2024-02-14 12:33:40 +01:00
|
|
|
)
|
|
|
|
}
|