(GL_FLOAT, 4) Deprecated

Blender is barfing when I start my older scripts on the floats that I use in OpenGl.
After all of the beeping the scripts run fine.

Can someone suggest either a more modern way to write something like size=Buffer(GL_FLOAT, 4)
or a script that shuts off the beeping?

Barfing=
Console say: C:\Program Files\Blender Foundation\Blender\blender.exe:92: DeprecationWarning:
integer argument expected, got float
Φb▀ Yâeⁿ ïF♦à└t∟P §ä↕ñ à└u◄ïF♦= t╢ tPΦ▬∩ Y╟Eⁿ■ Φ[ â> t<j♀Φ"▀ Y╟Eⁿ☺ 6
Φ═² Yï♠à└t‼â8 u♫=Py╢ tPΦ▄√ Y╟Eⁿ■ Φ& ╕

beep

repeat

I assume your using this with an interface item, probably some type of button. If you pass it a float you’ll get these types of error messages. To stop it do:


function(..., int(your float value), ...)

If your using it for something else, please elaborate some.

forTe:

Yeah exactly (# I’m all about UI for the most part).

I use a lot of PIL library stuff and Open Gl in widgets that I cook up.

Feeling a little dense reading your explanation tho…

“function(…, int(your float value), …)”

Blenders deprecation warning is not telling me which number is the culprit.
(there are a lot of numbers in these scripts) . One script without a background color beeps three times and one with beeps 21 times, they both show 19 images and have the same functions, I am clueless about which values to int() I have pulled the script apart several times but can’t find whats doing it.

Check your Draw.XYZ calls for the GUI elements (Buttons, Menus, etc.). Make sure you pass ints for the location and size parameters (instead of floats).

I’m just not seeing it yet.I think the four crazy guys are right, its right there somewhere.
Here is a section that I cut out of the script that has 3 floats acting up. (4?)

It works fine after it shuts up.
I will paste it in below ,
The script will be looking for a directory (in this example called "“C:\Knob”) that has 20 targas on the C:\ drive, ( r’c:\Knob\ 0001-0020 .tga’)

http://i296.photobucket.com/albums/mm166/Door3_CNC/Knob0001.pngany 20 .tga s will work.

import Blender
from Blender.Draw import *
from Blender.BGL import *

OV = 1113
B1 = 1114
B2 = 1115
B3 = 1116
B4 = 1117
B5 = 1118
B6 = 1119
B7 = 1120
B8 = 1121

Rr2 = (180 * obj2.RotY / 3.14 )
Rrr2 = int(Rr2)
print Rrr2

####Radian Conversion
###degrees = 180 * radiants / 3.1415926535897932384626433832795
Tscroll = Create(Rrr)
T2scroll = Create(200)
T3scroll = Create(200)
T3Text = (repr(Tscroll.val))

TSlidval = Create(str(Tscroll.val))
TSlidval2 = (Tscroll.val)
T2text = (“Esc Key = Exit”)

XPos = 100
YPos =100

mouse_x=1
mouse_y=1

def read_tgafile(loc):
f=open(loc,‘rb’)
ee=f.read(18);
width=ord(ee[13])*256+ord(ee[12])
h=ord(ee[15])*256+ord(ee[14])
ee=f.read()
f.close()
n=0
bitmap= Buffer(GL_BYTE, ( h, width, 4))
for y in range(h-1,-1,-1):
for x in range(0, width):
bitmap[y][x][2]= ord(ee[n]); n=n+1
bitmap[y][x][1]= ord(ee[n]); n=n+1
bitmap[y][x][0]= ord(ee[n]); n=n+1

return bitmap, width, h

def gui():
global mouse_x
global mouse_y

global Tscroll,T2scroll, T3scroll,  TSlidval, obj, Rr
global Ttext

glTEXT(50, Tscroll.val, 50)

#####Ecs Directions
glColor3f(.8,.9,.5)
glRasterPos2i(10, 10)
Text(T2text)

Button("Exit", 1112,( -mouse_x)+50 ,0, 50, 20, "Exit Python Script")
Button("Both Eyes L_R", 1113,(- mouse_x) +100, 0, 120, 20, "")
Button("Both Eyes Up_Down", 1114,(- mouse_x + 220) , 0, 155, 20, "")
Button("Right Eye L_R", 1115,(- mouse_x + 375), 0, 120, 20, "")
Button("Left Eye L_R", 1116,(- mouse_x + 495), 0, 120, 20, "")
Button("Cross Eyes", 1117,(- mouse_x + 615), 0, 100, 20, "")
Button("Right Eyelid Up/Down", 1118,(- mouse_x +715), 0, 150, 20, "")
Button("Left Eyelid Up/Down", 1119,(- mouse_x + 865), 0, 150, 20, "")
#Button("Rt. Humer", 1120,(- mouse_x + 500) + 50, 0, 100, 20, "")
#Button("Rt. Ulnar", 1121,(- mouse_x + 600) + 50, 0, 100, 20, "")
#Button("Rt. Hand", 1122,(- mouse_x + 700) + 50, 0, 75, 20, "")
#Button("Lft. Shoulder", 1123,(- mouse_x + 775) + 50, 0, 100, 20, "")
#Button("Lft. Humer", 1124,(- mouse_x + 875) + 50, 0, 100, 20, "")
#Button("Lft. Left Ulnar", 1125,(- mouse_x + 975) + 50, 0, 100, 20, "")
#Button("Lft. Hand", 1126,(- mouse_x + 1075) + 50, 0, 75, 20, "")
#Button("Lft. Femer", 1127,(- mouse_x + 1150) + 50, 0, 100, 20, "")
#Button("Lft. Tibia", 1128,(- mouse_x + 1250) + 50, 0, 100, 20, "")
#Button("Lft. Foot", 1129,(- mouse_x + 1350) + 50, 0, 100, 20, "")
#Button("Rt. Toes", 1130,(- mouse_x + 1450) + 50, 0, 100, 20, "")

#Button(“Rt. Femer”, 1131,(- mouse_x + 1550) + 50, 0, 100, 20, “”)

Button(“Rt. Tibia”, 1132,(- mouse_x + 1650) + 50, 0, 100, 20, “”)

Button(“Rt. Foot”, 1133,(- mouse_x + 1750) + 50, 0, 100, 20, “”)

Button(“Rt. Toes”, 1134,(- mouse_x + 1850) + 50, 0, 100, 20, “”)

Button(“Floater”, 1, mouse_x-20,mouse_y-150, 60, 20, “”)

Tscroll = Slider("",5, 10, 25, 440, 20, Tscroll.val, 0, 180, 1, "Door3")
#T2scroll = Slider("",5, 125, 500, 500, 20, T2scroll.val, 0, 500, 1, "X Position of Bitmap")
#T3scroll = Slider("",5, 125, 25, 300, 20, T3scroll.val, 0, 500, 1, "Y Position of Bitmap")
#TSlidval  = String("Slider Value: ", 10, 10, 75, 110, 20, TSlidval.val, 8, "What the slider says!")

###########Bitmaps

if (Tscroll.val == 174):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g1_width, g1_height, GL_RGBA, GL_UNSIGNED_BYTE, g1_bitmap)

if (Tscroll.val == 175):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g2_width, g2_height, GL_RGBA, GL_UNSIGNED_BYTE, g2_bitmap)

if (Tscroll.val == 176):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g3_width, g3_height, GL_RGBA, GL_UNSIGNED_BYTE, g3_bitmap)

if (Tscroll.val == 177):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g4_width, g4_height, GL_RGBA, GL_UNSIGNED_BYTE, g4_bitmap)

if (Tscroll.val == 178):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g5_width, g5_height, GL_RGBA, GL_UNSIGNED_BYTE, g5_bitmap)

if (Tscroll.val == 179):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g6_width, g6_height, GL_RGBA, GL_UNSIGNED_BYTE, g6_bitmap)

if (Tscroll.val == 180):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g7_width, g7_height, GL_RGBA, GL_UNSIGNED_BYTE, g7_bitmap)

if (Tscroll.val == 181):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g8_width, g8_height, GL_RGBA, GL_UNSIGNED_BYTE, g8_bitmap)

if (Tscroll.val == 182):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g8_width, g8_height, GL_RGBA, GL_UNSIGNED_BYTE, g8_bitmap)

if (Tscroll.val == 183):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g9_width, g9_height, GL_RGBA, GL_UNSIGNED_BYTE, g9_bitmap)

if (Tscroll.val == 184):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g10_width, g10_height, GL_RGBA, GL_UNSIGNED_BYTE, g10_bitmap)

if (Tscroll.val == 185):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g11_width, g11_height, GL_RGBA, GL_UNSIGNED_BYTE, g11_bitmap)

if (Tscroll.val == 186):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g12_width, g12_height, GL_RGBA, GL_UNSIGNED_BYTE, g12_bitmap)

if (Tscroll.val == 187):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g13_width, g13_height, GL_RGBA, GL_UNSIGNED_BYTE, g13_bitmap)

if (Tscroll.val == 188):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g14_width, g14_height, GL_RGBA, GL_UNSIGNED_BYTE, g14_bitmap)

if (Tscroll.val == 189):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g15_width, g15_height, GL_RGBA, GL_UNSIGNED_BYTE, g15_bitmap)

if (Tscroll.val == 190):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g16_width, g16_height, GL_RGBA, GL_UNSIGNED_BYTE, g16_bitmap)

if (Tscroll.val == 191):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g17_width, g17_height, GL_RGBA, GL_UNSIGNED_BYTE, g17_bitmap)

if (Tscroll.val == 192):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g18_width, g18_height, GL_RGBA, GL_UNSIGNED_BYTE, g18_bitmap)

if (Tscroll.val == 193):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g19_width, g19_height, GL_RGBA, GL_UNSIGNED_BYTE, g19_bitmap)

if (Tscroll.val &gt;= 194):
    glRasterPos2i(XPos, YPos)
    glDrawPixels( g20_width, g20_height, GL_RGBA, GL_UNSIGNED_BYTE, g20_bitmap)

def event(evt, val):

global mouse_x
global mouse_y

size=Buffer(GL_FLOAT, 4)
glGetFloatv(GL_SCISSOR_BOX, size)
size= size.list

mouse_x=mouse_x-size[0]
mouse_y=mouse_y-size[1]
glClearColor(0.497 , 0.0, 0.0, 0)
glClear(GL_COLOR_BUFFER_BIT)





if (evt== ESCKEY): Exit()
if (evt == MOUSEX): mouse_x = val
if (evt == MOUSEY): mouse_y = val
Redraw()
print "event : ", evt , val
if (evt == ESCKEY and not val): Exit()

#These events (10 & 11 are mousewheel scrolling)
if (evt == 11):
Tscroll.val = Tscroll.val + 1

  obj.RotY =  (Tscroll.val * .01)

  TSlidval.val = str(Tscroll.val)
  Ttext = str(Tscroll.val)
  print "Up"
  Redraw()



if (evt == 10):
  print "Down"
  Tscroll.val = Tscroll.val - 1

  obj.RotY =  (Tscroll.val * .01)

  TSlidval.val = str(Tscroll.val)
  Ttext = str(Tscroll.val)
  Redraw()

def bevent(evt):

if (evt == 5):

    TSlidval.val = str(Tscroll.val)
    obj.RotY =  (Tscroll.val * .01)
    Redraw()


if (evt == 1112): Exit()

if (evt == 1113): Exit()
if (evt == 1114): Exit()
if (evt == 1115): Exit()
if (evt == 1116): Exit()

def glTEXT(x1, y1, TEXT):
glColor3f(.8,.9,.5)
glRasterPos2i(150, 75)
Text(repr(obj.RotY))

def DrawglBOX(x1,y1,x2,y2):
glColor3f (0.8, 0.5, 0.0);
glLineWidth (1);
glBegin (GL_LINE_LOOP);
glVertex2f (x1, Tscroll.val-10);
glVertex2f (x2, Tscroll.val-10);
glVertex2f (x2, Tscroll.val+20);
glVertex2f (x1, Tscroll.val+20);
glEnd ();

g1_bitmap, g1_width, g1_height = read_tgafile( r’c:\Knob\0001.tga’)
g2_bitmap, g2_width, g2_height = read_tgafile( r’c:\Knob\0002.tga’)
g3_bitmap, g3_width, g3_height = read_tgafile( r’c:\Knob\0003.tga’)
g4_bitmap, g4_width, g4_height = read_tgafile( r’c:\Knob\0004.tga’)
g5_bitmap, g5_width, g5_height = read_tgafile( r’c:\Knob\0005.tga’)
g6_bitmap, g6_width, g6_height = read_tgafile( r’c:\Knob\0006.tga’)
g7_bitmap, g7_width, g7_height = read_tgafile( r’c:\Knob\0007.tga’)
g8_bitmap, g8_width, g8_height = read_tgafile( r’c:\Knob\0008.tga’)
g9_bitmap, g9_width, g9_height = read_tgafile( r’c:\Knob\0009.tga’)
g10_bitmap, g10_width, g10_height = read_tgafile( r’c:\Knob\0010.tga’)
g11_bitmap, g11_width, g11_height = read_tgafile( r’c:\Knob\0011.tga’)
g12_bitmap, g12_width, g12_height = read_tgafile( r’c:\Knob\0012.tga’)
g13_bitmap, g13_width, g13_height = read_tgafile( r’c:\Knob\0013.tga’)
g14_bitmap, g14_width, g14_height = read_tgafile( r’c:\Knob\0014.tga’)
g15_bitmap, g15_width, g15_height = read_tgafile( r’c:\Knob\0015.tga’)
g16_bitmap, g16_width, g16_height = read_tgafile( r’c:\Knob\0016.tga’)
g17_bitmap, g17_width, g17_height = read_tgafile( r’c:\Knob\0017.tga’)
g18_bitmap, g18_width, g18_height = read_tgafile( r’c:\Knob\0018.tga’)
g19_bitmap, g19_width, g19_height = read_tgafile( r’c:\Knob\0019.tga’)
g20_bitmap, g20_width, g20_height = read_tgafile( r’c:\Knob\0020.tga’)
#obj.LocX = str(0.0)

Register(gui, event, bevent)

Just before you draw your GUI elements do this (as a test)…

mouse_x = int(mouse_x)
mouse_y = int(mouse_y)

You may also need to do something with the width and height variables passed to glDrawPixels (but not sure about these).

But the mouse coords seems to stem from your call to get the scisser box size. You are using:

glGetFloatv(GL_SCISSOR_BOX, size)

and you should be using:

glGetIntegerv(GL_SCISSOR_BOX, size)

Oh. your right …yeah.

thanks very much for figuring that one out.