-
Notifications
You must be signed in to change notification settings - Fork 22
Nuke Examples
Daniele Federico edited this page Sep 7, 2018
·
2 revisions
from kiko import initialize
initialize()
import tempfile
import nuke
from kiko.apps.nuke import manager
from kiko.constants import KB_FILE_EXTENSION
man = manager.NukeKikoManager()
_, kb_file = tempfile.mkstemp(suffix=KB_FILE_EXTENSION)
# this will export the selected objects
node = nuke.toNode("Axis1")
node.setSelected(True)
man.export_to_file(kb_file )
# import the kb file trying to find the objects with the same name as the ones originally exported
man.import_from_file(kb_file, ignore_item_chunks=True)
import tempfile
import nuke
from kiko.apps.nuke import manager
from kiko.constants import KB_FILE_EXTENSION
man = manager.NukeKikoManager()
_, kb_file = tempfile.mkstemp(suffix=KB_FILE_EXTENSION)
# this will export the selected objects
node1 = nuke.toNode("Axis1")
node1.setSelected(True)
man.export_to_file(kb_file)
# import the kb file onto locator2 mapping the original name "Axis1" to "Axis2"
node2 = nuke.createNode('Axis')
obj_mapping = {node1.name(): node2.name()}
man.import_from_file(kb_file, objects=[node2.name()], obj_mapping=obj_mapping, ignore_item_chunks=True)