MeshPainterScript

From K-3D

Revision as of 01:53, 4 June 2007 by Tshead (Talk | contribs)
Jump to: navigation, search

Template:Plugin/MeshPainterScript

Overview

MeshPainterScript can be used to do arbitrary rendering of a mesh under script control. For example, the following script renders mesh points as blue dots:

#python

from OpenGL.GL import *

glPushAttrib(GL_ALL_ATTRIB_BITS)
glDisable(GL_LIGHTING)
glPointSize(5)
glColor3d(0, 0, 1)

glBegin(GL_POINTS)
for point in Mesh.points():
	glVertex3d(point[0], point[1], point[2])
glEnd()

glPopAttrib()

Note that you must have OpenGL bindings installed for your script engine - Python in this case. On most platforms this is a separate download - check with your distribution on how to obtain PyOpenGL first, or visit http://pyopengl.sourceforge.net

Script Environment

Name Description
Document A reference to the document that owns this node.
Node A reference to this node.
Mesh A reference to the mesh to be rendered.
PaintMesh Boolean value indicating whether the mesh should be visibly rendered.
SelectMesh Boolean value indicating whether the mesh should be rendered for interactive selection.
Personal tools