geoNode = nuke.activeViewer().getGeometryNodes()
print geoNode
[<Cube1 at 0x3c78e10>]
how can i get from the cube object the geometryList
doing that gives me the list? but i don't go through the viewer which would be nice.
n = nuke.toNode("Cube1")
k = n['geo_select']
objs = k.getGeometry()
print objs
<_geo.GeometryList object at 0x654dcf0>
doing a FIX from that code http://docs.thefoundry.co.uk/nuke/90/pythondevguide/math.html?highlight=rotopaint works
import nuke import nukescripts
def paintPoints(): ''' Rather experimental but kinda fun. This projects sleected 3D points through a camera ito screen space and draws a dot for each using a paint stroke. ''' # GET THE GEO NODE FROM THE CURRENTLY ACTIVE VIEWER geoNode = nuke.activeViewer().getGeometryNodes() # WE EXPECT A CAMERA TO BE SELECTED camera = nuke.selectedNode() if not camera.Class() in ( 'Camera', 'Camera2' ): nuke.message( 'Please select a camera node first') return # COLLECT ALL OBJECTS IN THE CURRENT GEO KNOB. QUIT IFNONE WERE FOUND #geoKnob = geoNode['geo'] #objs = geoKnob.getGeometry() #FIX n = nuke.toNode("Cube1") k = n['geo_select'] objs = k.getGeometry() #FIX #objs = geoNode if not geoNode: nuke.message( 'No geometry found in %s' % geoNode.name() ) pts = [] for o in objs: # CYCLE THROUGH ALL OBJECTS objTransform = o.transform() for p in o.points(): # CYCLE THROUGH ALL POINTS OF CURRENT OBJECT worldP = objTransform * nuke.math.Vector4(p.x, p.y, p.z, 1) pts.append( [worldP.x, worldP.y, worldP.z] ) # CREATE THE NODE THAT WILL HOLD THE PAINT STROKES curvesKnob = nuke.createNode( 'RotoPaint' )['curves'] # PREP THE TASK BAR task = nuke.ProgressTask( 'painting points' ) for i, pt in enumerate( pts ): if task.isCancelled(): break task.setMessage( 'painting point %s' % i ) # CREATE A NEW STROKE stroke = nuke.rotopaint.Stroke( curvesKnob ) # PROJECT THE POINT TO SCREEN SPACE pos = nukescripts.snap3d.projectPoint( camera, pt ) # CREATE ANE CONTROL POINT FOR ctrlPoint = nuke.rotopaint.AnimControlPoint( pos ) # ASSIGN IT TO THE STROKE stroke.append( ctrlPoint ) # ASSIGN TH E STROKE TO THE ROOT LAYER curvesKnob.rootLayer.append( stroke ) # UPDARE PROGRESS BAR task.setProgress( int( float(i)/len(pts)*100 ) ) paintPoints()
Gesendet: Mittwoch, 22. April 2015 um 16:24 Uhr
Von: "Frank Harrison" <fr...@thefoundry.co.uk>
An: "Nuke Python discussion" <nuke-python@support.thefoundry.co.uk>
Betreff: Re: [Nuke-python] getGeometry function error on pythonDevGuide example
Von: "Frank Harrison" <fr...@thefoundry.co.uk>
An: "Nuke Python discussion" <nuke-python@support.thefoundry.co.uk>
Betreff: Re: [Nuke-python] getGeometry function error on pythonDevGuide example
That's not good.
F.
--
_______________________________________________ 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-pythonIt looks like we deprecated that Knob some time ago, I'll talk to our resident Nuke 3D system specialist and try to get back to you.
In the mean-time, have you tired using the getGeometryNodes() function on the Viewer Node?
On 22 April 2015 at 20:48, Thorsten Wolf <thorsten.v.w...@web.de> wrote:
hi,getting the following error.objs = geoKnob.getGeometry()
AttributeError: 'Obsolete_Knob' object has no attribute 'getGeometry'
how can i get the getGeometry values ?thanksthorsten
_______________________________________________
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
Frank Harrison
Senior Nuke Software Engineer
The Foundry
Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
Web: www.thefoundry.co.uk
_______________________________________________ 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