forked from bartvdbraak/blender
scaled comparison adjustment only effects editmode select group
documented a workaround for python drawinf pixel aligned text in teh 2d view Added links from Draw.Test to the OpenGL functions that set the location and color.
This commit is contained in:
parent
77506aa141
commit
c8b6425f61
@ -1149,7 +1149,7 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
|
||||
/* set the precission to display*/
|
||||
if (range>=100.0f) precission=1.0f;
|
||||
else if (range>=10.0f) precission=2.0f;
|
||||
else if (range>1.0f) precission=3.0f;
|
||||
else if (range>=1.0f) precission=3.0f;
|
||||
else precission=4.0f;
|
||||
|
||||
but->type = BFLOAT_TYPE;
|
||||
|
@ -1278,6 +1278,23 @@ def glRasterPos (x,y,z,w):
|
||||
@param x,y,z,w: Specify the x,y,z, and w object coordinates (if present) for the
|
||||
raster position. If function prototype ends in 'v' specifies a pointer to an array of two,
|
||||
three, or four elements, specifying x, y, z, and w coordinates, respectively.
|
||||
@note:
|
||||
If you are drawing to the 3d view with a Scriptlink of a space handeler
|
||||
the zoom level of the panels will scale the glRasterPos by the view matrix.
|
||||
so a X of 10 will not always offset 10 pixels as youd expect.
|
||||
|
||||
To work around this get the scale value of the view matrix and use it to scale your pixel values.
|
||||
|
||||
Workaround::
|
||||
|
||||
import Blender
|
||||
from Blender.BGL import *
|
||||
xval, yval= 100, 40
|
||||
# Get the scale of the view matrix
|
||||
viewMatrix = Buffer(GL_FLOAT, 16)
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix)
|
||||
f = 1/viewMatrix[0]
|
||||
glRasterPos2f(xval*f, yval*f) # Instead of the useual glRasterPos2i(xval, yval)
|
||||
"""
|
||||
|
||||
def glReadBuffer(mode):
|
||||
|
@ -603,6 +603,7 @@ def ColorPicker(event, x, y, width, height, initial, tooltip = None):
|
||||
@rtype: Blender Button
|
||||
@return: The Button created.
|
||||
@note: The color picker will not work if the Register's event function is None.
|
||||
@note: Using the same button variable with more then 1 color picker at a time will corrupt memory.
|
||||
"""
|
||||
|
||||
def Number(name, event, x, y, width, height, initial, min, max, tooltip = None):
|
||||
@ -689,12 +690,19 @@ def GetStringWidth(string, fontsize = 'normal'):
|
||||
def Text(string, fontsize = 'normal'):
|
||||
"""
|
||||
Draw a string on the screen.
|
||||
|
||||
Text location is set using the OpenGL raster location functions L{BGL.glRasterPos} before the text is drawn.
|
||||
This sets the text location from the lower left corner of the current window.
|
||||
|
||||
Text color is set using the OpenGL color functions L{BGL.glColor} before the text is drawn.
|
||||
|
||||
@type string: string
|
||||
@param string: The text string to draw.
|
||||
@type fontsize: string
|
||||
@param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
|
||||
@rtype: int
|
||||
@return: The width of I{string} drawn with the chosen I{fontsize}.
|
||||
@note: For drawing text in the 3d view see the workaround in L{BGL.glRasterPos}
|
||||
"""
|
||||
|
||||
def Image(image, x, y, zoomx=1.0, zoomy=1.0, clipx=0, clipy=0, clipw=-1, cliph=-1):
|
||||
|
@ -745,7 +745,7 @@ static int unified_findnearest(EditVert **eve, EditEdge **eed, EditFace **efa)
|
||||
}
|
||||
|
||||
/* this as a way to compare the ares, perim of 2 faces thay will scale to different sizes */
|
||||
#define SCALE_CMP(a,b) (fabs(a-b) <= thresh || (a>0 && fabs(b/a)<=thresh))
|
||||
#define SCALE_CMP(a,b) (fabs(a-b) <= thresh*a || (a>0 && fabs(b/a)<=thresh))
|
||||
|
||||
/* **************** GROUP SELECTS ************** */
|
||||
/* selects new faces/edges/verts based on the
|
||||
|
Loading…
Reference in New Issue
Block a user