2024-02-26 16:16:06 +01:00
|
|
|
import typing as typ
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
from .... import contracts as ct
|
2024-02-26 16:16:06 +01:00
|
|
|
from .... import sockets
|
|
|
|
from ... import base
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
class BlenderConstantNode(base.MaxwellSimNode):
|
|
|
|
node_type = ct.NodeType.BlenderConstant
|
2024-02-26 16:16:06 +01:00
|
|
|
bl_label = "Blender Constant"
|
|
|
|
|
|
|
|
input_socket_sets = {
|
2024-03-11 16:35:41 +01:00
|
|
|
"Object": {
|
|
|
|
"Value": sockets.BlenderObjectSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"Collection": {
|
|
|
|
"Value": sockets.BlenderCollectionSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"Text": {
|
|
|
|
"Value": sockets.BlenderTextSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"Image": {
|
|
|
|
"Value": sockets.BlenderImageSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
2024-03-11 16:35:41 +01:00
|
|
|
"GeoNode Tree": {
|
|
|
|
"Value": sockets.BlenderGeoNodesSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
output_socket_sets = input_socket_sets
|
|
|
|
|
|
|
|
####################
|
|
|
|
# - 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-26 16:16:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:28:35 +01:00
|
|
|
####################
|
|
|
|
# - Blender Registration
|
|
|
|
####################
|
2024-02-26 16:16:06 +01:00
|
|
|
BL_REGISTER = [
|
|
|
|
BlenderConstantNode,
|
|
|
|
]
|
|
|
|
BL_NODES = {
|
2024-03-11 16:35:41 +01:00
|
|
|
ct.NodeType.BlenderConstant: (
|
|
|
|
ct.NodeCategory.MAXWELLSIM_INPUTS_CONSTANTS
|
2024-02-26 16:16:06 +01:00
|
|
|
)
|
|
|
|
}
|