This is part of T73324.
The main difficulty with adding these types is that they are the first sockets types
that reference ID data in their default_value. That means that I had to add some
new logic in a few places to deal with reference counting. I hope I found all the places...
It seems to work fine in my tests.
For now these socket types can only be created using a script like the one below:
import bpy
class MyCustomNode(bpy.types.Node):
bl_idname = 'CustomNodeType'
bl_label = "Custom Node"
def init(self, context):
self.inputs.new('NodeSocketObject', "Object")
self.inputs.new('NodeSocketImage', "Image")
bpy.utils.register_class(MyCustomNode)
if len(bpy.data.simulations) == 0:
bpy.data.simulations.new("Simulation")
sim = bpy.data.simulations[0]
sim.node_tree.nodes.new("CustomNodeType")After running the script, go to the simulation editor and select the newly created simulation.
We might want to change readfile.c so that linked objects/images are only loaded,
when the socket is not connected. Otherwise it can be tricky to figure out why certain
id data blocks are still referenced by the node tree later on.