Skip to content

Cross App Examples

Daniele Federico edited this page Sep 11, 2018 · 5 revisions

Export a camera animation from Maya

import kiko
kiko.initialize()

# PATH TO KB FILE
kb_file= "" 

from maya import cmds
from kiko.apps.maya import manager
from kiko.operators.staticoperator import staticoperator
from kiko.operators.curveoperator import curveoperator

man = manager.MayaKikoManager()
cv_name = curveoperator.CurveOperator.name()
st_name = staticoperator.StaticOperator.name()
    
camera_transform = "camera1"
camera= "cameraShape1"
    
attr_names = ["cs", "fl", "hfa", "vfa", "ncp", "fcp", "hfo", "vfo"]
    
man.export_to_file(kb_file, objects=[camera_transform, camera], operators=[cv_name, st_name],
                   channel_filter={camera: attr_names})

Import the kiko file on a camera in nuke

import kiko
kiko.initialize()

import nuke
from kiko.apps.nuke import manager

cam = nuke.createNode("Camera")

nm = manager.NukeKikoManager()
k_root = nm.get_root_from_file(file_path)
child1 = k_root.child_by_index(0)
child2 = k_root.child_by_index(1)

nm.import_from_file(kb_file, objects=[cam.name()],
                    obj_mapping={child1.name: cam.name(),
                                 child2.name: cam.name()},
                    ignore_item_chunks=True)