MeshPainterScript

From K-3D

Jump to: navigation, search

Description

Scripted Mesh Painter
Plugin Status:Stable
Categories:All Plugins, Stable Plugins, OpenGL Plugins, Painter Plugins, Script Plugins

Metadata

Name Value

Properties

Label Description Type Script Name
Script Script source code k3d::string_t script


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

The following parameters will be available to your script at runtime (see the documentation for your script engine for details on how these parameters can be accessed programmatically).

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.