Skip to content

Decouple curve serialization / writing to filesystem [Feature Request] #8

@vvzen

Description

@vvzen

Hi all!

I'm on a quest to find a good way to export curve data to track retimes between Hiero, Nuke and Maya and I stumbled upon this nice library! (plus, we're both Italian and working in Framestore so I thought that it was a nice coincidence! :) )

I've been following through the wiki, but I soon realized that the way you've designed kiko means that one can't easily access the serialized object (via a public interface). Basically, everything is meant to be written to disk immediately.
In my case, I'd like to embed this curve information into a metadata dictionary in my OTIO timeline (so I don't really need to write only the curve to disk).

For now, I came up with this:

from kiko.operators.factory import OperatorsFactory
from kiko.io import serializer
from kiko.apps.nuke.nukefacade import NukeFacade

s = serializer.Serializer(facade=NukeFacade)
node = nuke.toNode("TimeWarp1")
app_name = NukeFacade.get_app_name()
operators = OperatorsFactory().get_all_operator_names(app_name)

ops = []
for o in operators:
    op_c = None
    if isinstance(o, tuple):
        if OperatorsFactory.has_operator(o[0], version=o[1]):
            op_c = OperatorsFactory().get_operator(o[0], o[1])
    else:
        op_ver = OperatorsFactory().get_latest_version(o)
        if not op_ver is None:
            op_c = OperatorsFactory().get_operator(o, op_ver)

    if op_c is None:
        raise KikoManagerException('Could not find operator %s' % o)

    if not op_c.is_app_supported(app_name):
        continue

    ops.append(op_c)

serialized_curve = s.serialize("test", [node], operators=ops)

..which isn't that pretty :D

I think it could be useful if you could expose 2 separate methods, one for serializing, and the other one (more a utility than anything else) to serialize and write to disk at the same time (export_to_file()).
I'd be happy to contribute myslef - at a first glance, it doesn't seem that hard to do.

Thanks!

Valerio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions