Creating a Text "label" on the model in Python

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

TheModerator
Posts: 1
Joined: Wed Aug 01, 2012 12:14 pm

Creating a Text "label" on the model in Python

Postby TheModerator » Wed Aug 01, 2012 12:23 pm

Okay, So I'm a python n00b, but I have programming experience in 4 other languages, and am picking up the python language quickly.

As an exercise, I want to label all the 'verts in a mesh with their respective lengths in blender units. by "label", I mean, some text that appears at a defined xyz coordinate that is always facing the viewer, regardless of rotation, In a similar way to rendering particles as "Number"

I've got the for-each script for running through all the vertices in a mesh, but am struggling to find any way of putting this text "label" in the viewport

Can anyone help me by way of example code?

Thanks so much to anyone who's read this, and especially to people who can help me!!! Thanks!

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Aug 01, 2012 9:55 pm

such a feature already exists, see N panel in 3d viewport, under Mesh Display (in edit mode), Numerics: Edge Length

to draw stuff in viewport like this, you gotta use OpenGL, see bgl module in blender python docs
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 3 guests