Beispiel #1
0
def main_vrs(scene, dest):
    vr1 = Renderer(scene)
    vr2 = Renderer()

    cls = [
           ("settings", ["Setting*", "Camera*", "Filter*"]),
           ("lights", "Light*"),
           ("nodes", "Node"),
           ("shapes", "*Mesh"),
           ("shaders", "*BRDF*"),
           ("others", "*")
           ]

    plugs = dict()
    for tok in cls:
        field, _ = tok
        plugs[field] = list()

    done = list()
    plugins = list()

    print "extract plugs ..."

    for tok in cls:
        field, patterns = tok
        if type(patterns) != list:
            patterns = [patterns]
        for plug in vr1._renderer.plugins:
            if plug.getName() in done:
                continue
            found = False
            for pat in patterns:
                if fnmatch.fnmatch(plug.getType(), pat):
                    found = True
                    break
            if found:
                plugs[field].append(plug)
                done.append(plug.getName())

    for tok in cls:
        field, _ = tok
        plugins.extend(plugs[field])

    print "rewrite ..."

    '''
    for plug in plugins:
        print "{0} -> {1}".format(plug.getType(), plug.getName())
        vr2.add(plug, vr1._renderer)
    '''
    vr2.add(plugins, vr1._renderer)

    vr2.save(dest)
    vr2.render(live=False, sequence=(1, 1, 1))
Beispiel #2
0
def do_render(src):
    r = Renderer(renderMode="production")
    r.load(src)

    r.useAnimatedValues = 1

    light = r.plugins['defaultLighting']
    print "light : {0}".format(light)

    settings = r.outputSettings
    print settings

    view = r.plugins['renderView']
    print view

    print "RENDER"
    r.render(sequence=[1, 10, 1], live=False, vfb=True)
    print "RENDER DONE"

    r.release()