Hi,

I'm not sure it is the way to proceed, but for those who won't go to the
forum,
I send my answer also to the mailing list. (original question is below).

(I'm not happy with this new forums, though... mailing lists are so
simple... geeez....)


from PySide import QtGui
clipboard = QtGui.QApplication.clipboard()
# clipboard.text() # get current clipboard contents
# clipboard.setText('some text or some variable') # set clipboard to what
specified

nodeCopy = "\n"
for i in str.split(str(clipboard.text()),"\n")[3:] :
     nodeCopy = nodeCopy + str(i) + "\n"

clipboard.setText(nodeCopy[:-2])
nuke.nodePaste('%clipboard%')

I think this is what you need. At least I hope this will help you.
(chek indention, it might have changed with copy / paste to this email...)

But, fot what it worth, I'd rather create a dict variable with all knobs
(and their values)
of a previously selected node, (using myNode.knobs() )
Then I'd create a new node and set all the knobs with the original values.
it's longer way, but would let you iterate over selection of several nodes
by example
and would prevent you from clipboard "volatility".


Cheers.




--
Aurelyen DAUDET - Nuke & Compositing Teacher
adau...@artfx.fr    -     www.artfx.fr     -     blog.artfx.fr



On 19 February 2015 at 08:33, <no-reply-community...@thefoundry.co.uk>
wrote:

> alex gamaiunov has added a new topic 'Paste predefined node' on the The
> Foundry Community.
>
> Hi.
>
> I need to paste a previously defined node. Let's say:
>
> set cut_paste_input [stack 0]
> version 8.0 v6
> push $cut_paste_input
> Write {
> file C:/file.exr
> file_type exr
> name Write2
> selected true
> xpos -342
> ypos -482
> }
>
> I'm trying to save this to a multistring variable (in code, not with
> 'copy' function) and then paste with nuke.nodePaste(ss). But I don't get
> how to properly save this to varibale (with all of the \n and indents).
>
> Thanks
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to