Hi,

That it is actually possible, but the string expected is not the string on
can read in the pulldown...
The methods getValue() and value() are giving different results.
One is the number, the other is a string, but not really easy to guess
who's who..

w = nuke.createNode("Write")

w['file'].setValue("/Volumes/DATAS/toto.mov")

# to set the codec to H.264 both below are working

w['meta_codec'].setValue('avc1')

w['meta_codec'].setValue(20)


Sniffing around the meta_codec knob, I found that

print w['meta_codec'].values()

returns a complete list of the pulldown entries.

The problem is that is is full of "\t". But the good news is the string one
can read in the pulldown is there.

By example, the entry for H.264 is looking like this : 'avc1\tH.264'


A workaround would be to filter the readable name, "H.264", and then
retrieve the internal name, "avc1"

Not that complex to do, I admit.
But this would be really great to be able to use directly the readable
string in the pulldown to set the values.
As we can do with user Pulldown Choice in Gizmos.
As Frank pointed, adding or removing codecs to the OS might affect python
scripts using numbers.
Headache and hair tearing source....

By the way, we also have that (odd ?) '\t' thing in the file type pulldown
:

'mov\t\t\tffmpeg'


Cheers.






--
Aurélyen DAUDET - Enseignant Nuke et Compositing
[email protected]    -     www.artfx.fr     -     blog.artfx.fr



On 17 April 2015 at 08:39, Fredrik Averpil <[email protected]>
wrote:

> I'm setting the Write codec like this right now:
>
>
> nuke.toNode(node.name())['meta_codec'].setValue('22') # Set MPEG-4 Video 
> 64-bit
>
> ​
>
> But can it instead be set by specifying something less arbitrary than a
> number, which is bound to change if a codec is added/removed to the codec
> list?
>
> Regards,
> Fredrik
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
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