Blender Git Loki

Git Commits -> Revision 7dfdb1a

April 6, 2020, 11:23 (GMT)
New Object and Image socket types

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.

Differential Revision: https://developer.blender.org/D7347

Commit Details:

Full Hash: 7dfdb1a8a0cb21b80e50e227b5b12e4c9bfdf78d
Parent Commit: 2b1e84c
Lines Changed: +327, -34

8 Modified Paths:

/source/blender/blenkernel/intern/lib_query.c (+38, -9) (Diff)
/source/blender/blenkernel/intern/node.c (+76, -0) (Diff)
/source/blender/blenloader/intern/readfile.c (+81, -25) (Diff)
/source/blender/blenloader/intern/writefile.c (+6, -0) (Diff)
/source/blender/editors/space_node/drawnode.c (+10, -0) (Diff)
/source/blender/makesdna/DNA_node_types.h (+10, -0) (Diff)
/source/blender/makesrna/intern/rna_nodetree.c (+74, -0) (Diff)
/source/blender/nodes/intern/node_socket.c (+32, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021