< Extensions:2.4 | Py | Nodes | Cookbook
- Random input node: See https://projects.blender.org/tracker/index.php?func=detail&aid=7774 for reference. This should be straightforward to implement by using the Noise module http://www.blender.org/documentation/246PythonDoc/Noise-module.html .
- Add your idea here.
This node uses an IPO to get an output value. Basically for this to work you need to create a dummy object (empty for instance) that has an IPO that has been keyframed to OB_LOCX. Note that you can key OB_LOCY and OB_LOCZ too if you want. To get those keys, just key (i key) location of the dummy object. After that open the IPO editor and edit the curves as you like.
Note that current version uses an evil hack to get past a bug in system. So this means there are extra inputs in the node. I will get rid of the inputs after the bug is fixed. Another way to get past the issue would be to store the names of the sockets in the creation phase and then use them to modify outputs but I settled for this solution.
from Blender import Ipo, Node, Scene from Blender.Scene import Render class IpoInputNode(Node.Scripted): def __init__(self, sockets): out_sockets =  for i in range(1, 4): out_sockets.append(Node.Socket('Value' + str(i), val=0.0)) sockets.input = out_sockets # evil hack needed to make output socket indices work sockets.output = out_sockets def __call__(self): ipo = Ipo.Get('NodeIpo') axes = (Ipo.OB_LOCX, Ipo.OB_LOCY, Ipo.OB_LOCZ) scn = Scene.GetCurrent() context = scn.getRenderingContext() if ipo: for i in range(3): icu = ipo[axes[i]] if icu: self.output[i] = icu.__getitem__(context.currentFrame()) __node__ = IpoInputNode