2024-02-14 12:33:40 +01:00
|
|
|
import bpy
|
|
|
|
import sympy as sp
|
|
|
|
|
|
|
|
from .... import contracts
|
|
|
|
from .... import sockets
|
|
|
|
from ... import base
|
|
|
|
|
2024-02-19 14:28:35 +01:00
|
|
|
class NumberConstantNode(base.MaxwellSimTreeNode):
|
|
|
|
node_type = contracts.NodeType.NumberConstant
|
2024-02-14 12:33:40 +01:00
|
|
|
|
2024-02-19 14:28:35 +01:00
|
|
|
bl_label = "Numerical Constant"
|
2024-02-14 12:33:40 +01:00
|
|
|
#bl_icon = constants.ICON_SIM_INPUT
|
|
|
|
|
2024-02-19 18:36:16 +01:00
|
|
|
input_sockets = {}
|
|
|
|
input_socket_sets = {
|
2024-02-26 16:16:06 +01:00
|
|
|
"integer": {
|
|
|
|
"value": sockets.IntegerNumberSocketDef(
|
|
|
|
label="Integer",
|
|
|
|
),
|
|
|
|
},
|
2024-02-19 18:36:16 +01:00
|
|
|
"real": {
|
|
|
|
"value": sockets.RealNumberSocketDef(
|
|
|
|
label="Real",
|
|
|
|
),
|
|
|
|
},
|
|
|
|
"complex": {
|
|
|
|
"value": sockets.ComplexNumberSocketDef(
|
|
|
|
label="Complex",
|
|
|
|
),
|
|
|
|
},
|
2024-02-14 12:33:40 +01:00
|
|
|
}
|
2024-02-19 18:36:16 +01:00
|
|
|
output_sockets = {}
|
|
|
|
output_socket_sets = input_socket_sets
|
2024-02-14 12:33:40 +01:00
|
|
|
|
|
|
|
####################
|
|
|
|
# - Callbacks
|
|
|
|
####################
|
2024-02-19 14:28:35 +01:00
|
|
|
@base.computes_output_socket("value")
|
2024-02-14 12:33:40 +01:00
|
|
|
def compute_value(self: contracts.NodeTypeProtocol) -> sp.Expr:
|
|
|
|
return self.compute_input("value")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################
|
|
|
|
# - Blender Registration
|
|
|
|
####################
|
|
|
|
BL_REGISTER = [
|
2024-02-19 14:28:35 +01:00
|
|
|
NumberConstantNode,
|
2024-02-14 12:33:40 +01:00
|
|
|
]
|
|
|
|
BL_NODES = {
|
2024-02-19 14:28:35 +01:00
|
|
|
contracts.NodeType.NumberConstant: (
|
|
|
|
contracts.NodeCategory.MAXWELLSIM_INPUTS_CONSTANTS
|
2024-02-14 12:33:40 +01:00
|
|
|
)
|
|
|
|
}
|