提供: wiki
< Extensions:2.4‎ | Py‎ | Nodes‎ | Cookbook
2018年6月29日 (金) 02:54時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Back to index



IPO input

Example frame of an animation made using IPO input node.[.blend]

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