On Wed, Jul 21, 2010 at 9:48 PM, Andrew Martin <amartin7...@gmail.com>wrote:
> This code was part of a Blender script to build a 3d bar graph, so I don't > know if understanding Blender is a prereq for understanding this code. The > function is for the axis labels. > > def label(text,position,orientation='z'): > txt=Text3d.New('label') > txt.setText(text) > ob=Scene.GetCurrent().objects.new(txt) > ob.setLocation(*position) > if orientation=='x': > ob.setEuler(-pi/2.0,0,0) > elif orientation=='z': > ob.setEuler(0,0,pi/2.0) > print 'label %s at %s along %s' %(text,position,orientation) > > I understand it for the most part except for the orientation part. I > assume orientation is for the 3d text object, but how is it determined > whether it is x or z? I don't use Blender myself, so this will be a more generic, high-level answer... > def label(text,position,orientation='z'): > This definition specifies that label() takes two mandatory parameters - text and position - and one optional parameter, orientation. What makes "orientation" optional is the fact that a default value is supplied: "orientation='z'". In other words, "orientation" is equal to "z" unless you specify otherwise in your call to label(). Take a look at this section of the Python docs: http://docs.python.org/tutorial/controlflow.html#more-on-defining-functions Hope that helps...
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor