Thanks guys. So from what you’ve mentioned, I get the impression that 
script_expand does something like performing a pass on the input array using 
Nuke’s expression parser to resolve non-TCL references (knob links, 'frame', 
'view', etc.) to their actual values, and script_command will actually run it 
through the TCL (or Python) interpreter?

-Nathan



From: Ivan Busquets 
Sent: Friday, July 06, 2012 11:01 AM
To: Nuke plug-in development discussion 
Subject: Re: [Nuke-dev] Obtaining the view count

Hey Nathan,

I'm unable to test it right now, but if I remember correctly, I think you can 
do:
const char * expression = "your Nuke expression here"
script_expand(expression)

And then you'd get the result in script_result(). You'd still get the result as 
a string, though, so just convert as appropriate if you need the numeric value 
as a different type.




On Fri, Jul 6, 2012 at 10:48 AM, Nathan Rusch <nathan_ru...@hotmail.com> wrote:

  Apologies for piggybacking on your thread, but it relates somewhat to 
something I’ve been working on.

  I’m curious if there’s a way to evaluate a standard Nuke expression (not a 
TCL script) from a string or char* and return its numeric result, without 
calling through Python to nuke.expression or something similar.

  Thanks,

  -Nathan



  From: Steve Booth 
  Sent: Thursday, July 05, 2012 3:15 PM
  To: 'Nuke plug-in development discussion' 
  Subject: RE: [Nuke-dev] Obtaining the view count

  You know.... I tried almost exactly that, but I thought ‘views’ was a list 
and not a function.  ‘len(nuke.views)’ returned an invalid parameter error in 
the Script Editor.  ‘len(nuke.views())’ works like a champ, tho.



  Thanks for your help, Ivan!



  Steve





  From: nuke-dev-boun...@support.thefoundry.co.uk 
[mailto:nuke-dev-boun...@support.thefoundry.co.uk] On Behalf Of Ivan Busquets
  Sent: Thursday, July 05, 2012 12:22 PM
  To: nuke-dev@support.thefoundry.co.uk
  Subject: Re: [Nuke-dev] Obtaining the view count



  Hi Steve,

  I would use python as you said. This should work, I think:

  const char* PyGetViews = "len(nuke.views())";
  script_command(PyGetViews,true,true);
  string views = script_result(true);
  script_unlock();  // to remove the lock started by script_command

  Cheers,
  Ivan



  On Thu, Jul 5, 2012 at 12:07 PM, Steve3D <nuke-dev-re...@thefoundry.co.uk> 
wrote:

  I've been digging through the current documentation this morning, and I can't 
seem to locate this.

  I need to know how many views are currently defined in the Project settings. 
How would I get that from inside a plugin? I'm thinking it should be accessible 
by executing some Python (using perhaps 'nuke.views' ?) But it's not at all 
clear what the correct syntax is.

  Steve


  _______________________________________________
  Nuke-dev mailing list
  Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev




------------------------------------------------------------------------------

  _______________________________________________
  Nuke-dev mailing list
  Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


  _______________________________________________
  Nuke-dev mailing list
  Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev






--------------------------------------------------------------------------------
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to