Hello

First… Seriously… Where does NUkeStudio pyton Q’s go…? Valid for both HIero and 
nS… Hmm...

Not sure where I got it from but I have used a py for hiero and nS called 
make_offline.py. It uses this to set a clip to offline,
hiero.core.MediaSource.createOfflineVideoMediaSource("", clip.sourceIn(), 
clip.duration(), clip.framerate(), clip.timecodeStart())

The problem with that is that it also changes Clip and reelID to "/" in 
spreadsheet. I'm looking for a solution to only set the path of a clip so that 
it's offline so that it more or less looks like when you have imported an EDL 
or XML. When I loose reel and clip I can't re-conform in a good way.

Was looking at this and how it could be solved. We can read 
foundry.source.reelID and store that before we use the above string. But do we 
have access so that we can set it back when a clip is offline? Same with clip 
name that I need to keep. I basically want to return a conformed clip to its 
un-conformed state. 

Was looking at the FnCyclone stuffs since that seems to be used when dealing 
with EDL's but that doesn't help much if import is XML...

Any one with a brain in good condition that have any thoughts?

Cheers

import hiero.core
import hiero.ui
import PySide.QtCore
import PySide.QtGui

class MakeOfflineAction(PySide.QtGui.QAction):
  def __init__ (self):
    PySide.QtGui.QAction.__init__(self, "Make Offline", None)
    self.triggered.connect(self.makeSelectionOffline)
    # Register Context Menu events
    hiero.core.events.registerInterest("kShowContextMenu/kTimeline", self.eventHandler)
    hiero.core.events.registerInterest("kShowContextMenu/kSpreadSheet", self.eventHandler)

  def makeSelectionOffline(self):
    # Grab selection from active view. Should be Timeline or Spreadsheet
    selection = hiero.ui.activeView().selection()
    if selection:
      # Walk list of what we expect to be TrackItems
      for trackitem in selection:
        if isinstance(trackitem, hiero.core.TrackItem):
          # Grab current source clip
          clip = trackitem.source()
          # Create an offline media source
          mediaSource = hiero.core.MediaSource.createOfflineVideoMediaSource("", clip.sourceIn(), clip.duration(), clip.framerate(), clip.timecodeStart())
          # Replace trackitem source with a new clip pointing at offline media source
          trackitem.setSource(hiero.core.Clip(mediaSource))

  def eventHandler(self, event):
    
    if not hasattr(event.sender, 'selection'):
      # Something has gone wrong, we shouldn't only be here if raised
      # by the timeline view which will give a selection.
      return

    # Add action to context menu
    hiero.ui.insertMenuAction( self, event.menu, after = "Delete" )


action = MakeOfflineAction()
-- 
Henrik Cednert
cto | td | compositor

Filmlance International
www.filmlance.se

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to