本文整理汇总了Python中Blender.BGL.glColor3f方法的典型用法代码示例。如果您正苦于以下问题:Python BGL.glColor3f方法的具体用法?Python BGL.glColor3f怎么用?Python BGL.glColor3f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blender.BGL
的用法示例。
在下文中一共展示了BGL.glColor3f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dotext
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def dotext(self):
## By default this function prints the desired text, in the desired colour centrally in the panel.
## Possibly there will be more options in a leter release.
## Find the vertical centreline of the panel.
centreline=self.left+(self.width/2)
## Find the horizontal centreline of the panel and subtract about half the height of the font (roughly).
textline=self.base+(self.height/2-5)
## Find the length of the string that was passed in.
stringlength=Draw.GetStringWidth(self.text)
## Halve it.
offset=stringlength/2
## Calculate the start point for the text.
titlestart=centreline-offset
## Change to the text colour.
BGL.glColor3f(self.textcolour[0],self.textcolour[1],self.textcolour[2])
## Position raster.
BGL.glRasterPos2i(titlestart,textline)
## Print it.
Draw.Text(self.text)
示例2: draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def draw(): # Define the draw function (which draws your GUI).
global EVENT_Button
global EVENT_Type
global EVENT_shtoguntype
global EVENT_String
global EVENT_Bitmap
global EVENT_WVTU_1
global Object_Button
global Object_Type
global Object_shtoguntype
global Object_String
global Object_Bitmap
global Object_WVTU_1
BGL.glClearColor(0.244564, 0.244406, 0.244406, 0.0)
BGL.glClear(GL_COLOR_BUFFER_BIT)
BGL.glColor3f(1.000000, 1.000000, 1.000000)
Object_Button = Draw.Button("Connect to Shotgun", EVENT_Button, 20, 8, 200, 20, "")
BGL.glRasterPos2i(100, 108)
Object_Type = Draw.Text("Type")
Object_shtoguntype = Draw.Menu("Asset", EVENT_shtoguntype, 20, 100, 60, 20, Object_shtoguntype.val, "Type of Shotgun entry")
Object_String = Draw.String("id : ", EVENT_String, 20, 60, 60, 20,Object_String.val, 399, "ID # for the Shotgun entry")
BGL.glRasterPos2i(24, 210)
BGL.glDrawPixels(0, 0, GL_RGB, GL_UNSIGNED_BYTE, Object_Bitmap)
BGL.glRasterPos2i(24, 152)
Object_WVTU_1 = Draw.Text("WVTU "+VERSION+"")
示例3: drawGUI
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def drawGUI():
""" Create and draw the GUI. """
HEIGHT = 382
CONTROL_WIDTH = 400
BGL.glClearColor(0.6, 0.6, 0.6, 1.0)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor3f(0.75, 0.75, 0.75)
BGL.glRecti(3,45,CONTROL_WIDTH,3)
stitchOffset = 22
HEIGHT += stitchOffset * num_motions_button.val
Display_Title_Bar(HEIGHT,25, CONTROL_WIDTH)
Display_File_Bar(HEIGHT - 25, 71 + stitchOffset * num_motions_button.val, CONTROL_WIDTH)
Display_Mesh_Bar(HEIGHT - 96 - stitchOffset * num_motions_button.val, 48, CONTROL_WIDTH)
Display_Camera_Bar(HEIGHT - 144 - stitchOffset * num_motions_button.val, 112, CONTROL_WIDTH)
Display_Render_Bar(HEIGHT - 256 - stitchOffset * num_motions_button.val, 48, CONTROL_WIDTH)
Display_Output_Bar(HEIGHT - 304 - stitchOffset * num_motions_button.val, 48, CONTROL_WIDTH)
Draw.PushButton('Load simulation', SimulationButton, 9, 8, (CONTROL_WIDTH / 2) - 9, 18, 'Load simulation')
if hasLoaded:
Draw.PushButton('Render scene', RenderButton, (CONTROL_WIDTH / 2) + 3, 8, (CONTROL_WIDTH / 2) - 9, 18, 'Render scene')
示例4: updateStatus
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def updateStatus(status):
global gStatus
gStatus = status
BGL.glClearColor(0.392,0.396,0.549,1)
BGL.glClear(Blender.BGL.GL_COLOR_BUFFER_BIT)
size = Blender.Window.GetAreaSize()
isize = drawHeader(size)
BGL.glColor3f(1.0,1.0,1.0)
yval = size[1]-isize[1] - 40
Blender.BGL.glRasterPos2i(60, yval)
Blender.Draw.Text('Status:','normal')
if type(gStatus) == types.ListType:
for s in gStatus:
Blender.BGL.glRasterPos2i(105, yval)
Blender.Draw.Text(s,'normal')
yval = yval - 18
else:
Blender.BGL.glRasterPos2i(105, yval)
Blender.Draw.Text(gStatus,'normal')
yval = yval - 18
Blender.Redraw()
示例5: Create_Tab
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def Create_Tab(X1,Y1,X2,Y2,Title,Buttons): # X1,Y1 = Top Left X2,Y2 = Bottom Right
"""
Create a bordered tab/frame/box with the given top left corner (X1,Y1)
and bottom right corner (X2, Y2) with the given Title and Buttons.
"""
TITLE_HEIGHT = 15
INDENT = 6
BUTTON_GAP = 4
BGL.glColor3f(0.75, 0.75, 0.75)
BGL.glRecti(X1,Y1,X2,Y2)
Draw_Border(X1,Y1,X2,Y2);
BGL.glColor3f(0.0,0.0,0.0)
BGL.glRasterPos2d(X1+INDENT,Y1 - TITLE_HEIGHT)
Draw.Text(Title)
BUTTON_HEIGHT = 18
Button_X = X1 + INDENT
Button_Y = Y1 - TITLE_HEIGHT - BUTTON_HEIGHT - 8
if (Buttons != 0):
key= Buttons.keys()
BUTTON_WIDTH = (X2 - (X1 + INDENT + BUTTON_GAP + INDENT)) / len(key)
for k in key:
Buttons[k][0]= Draw.Toggle(k,Buttons[k][1],Button_X,Button_Y, BUTTON_WIDTH,BUTTON_HEIGHT,Buttons[k][0].val,Buttons[k][2])
Button_X += BUTTON_WIDTH + BUTTON_GAP
示例6: drawHeader
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def drawHeader(size):
sver = 'v' + iUtils.iversion
try:
bheight=10
boffset = 8
logoImage = Blender.Image.Load(scriptsLocation + 'irrblend.png')
isize = logoImage.getSize()
BGL.glColor3f(0.8,0.8,0.8)
BGL.glRectd(11+isize[0],size[1]-bheight-boffset,size[0]-5,
size[1]-boffset)
Blender.BGL.glEnable(Blender.BGL.GL_BLEND )
Blender.BGL.glBlendFunc(Blender.BGL.GL_SRC_ALPHA,
Blender.BGL.GL_ONE_MINUS_SRC_ALPHA)
Blender.Draw.Image(logoImage, 6, size[1]-isize[1]-5)
Blender.BGL.glDisable(Blender.BGL.GL_BLEND)
Blender.BGL.glRasterPos2i(183, size[1]-33)
Blender.Draw.Text(sver,'normal')
except IOError:
BGL.glColor3f(1.0,1.0,1.0)
Blender.BGL.glRasterPos2i(45, size[1]-30)
Blender.Draw.Text('Irrlicht Plugin for Blender - ' + sver, 'large')
isize = [256,75]
return isize
示例7: doDraw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def doDraw(self):
# this has black color...
# Draw.Label(self.title,
# self.pos_x, self.pos_y, self.width, self.height)
BGL.glColor3f(*self.color)
BGL.glRasterPos2i(self.pos_x, self.pos_y)
Draw.Text(self.title + self.button.val)
示例8: drawpanel
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def drawpanel(self):
## Draw the main part of the panel.
BGL.glColor3f(self.col[0],self.col[1],self.col[2])
BGL.glRecti(self.left+5,self.base,self.right-5,self.top) ## Large middle bit.
BGL.glRecti(self.left,self.base+4,self.left+8,self.top-4) ## Left small side strip.
BGL.glRecti(self.right-8,self.base+4,self.right,self.top-4) ## Right small side strip.
## Draw the borders.
BGL.glColor3f(self.bcol[0],self.bcol[1],self.bcol[2]) ## Change to border colour.
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(self.left+6,self.base) ## Base border.
BGL.glVertex2i(self.right-6,self.base)
BGL.glVertex2i(self.left+6,self.top) ## Top border.
BGL.glVertex2i(self.right-6,self.top)
BGL.glVertex2i(self.left,self.base+6) ## Left border.
BGL.glVertex2i(self.left,self.top-6)
BGL.glVertex2i(self.right,self.base+6) ## Right border.
BGL.glVertex2i(self.right,self.top-6)
BGL.glEnd()
示例9: drawcorner
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def drawcorner(self):
BGL.glBegin(BGL.GL_LINES)
BGL.glColor3f(self.col[0],self.col[1],self.col[2])
BGL.glVertex2i(self.x+4*self.xflip,self.y+1*self.yflip)
BGL.glVertex2i(self.x+8*self.xflip,self.y+1*self.yflip)
BGL.glVertex2i(self.x+3*self.xflip,self.y+2*self.yflip)
BGL.glVertex2i(self.x+8*self.xflip,self.y+2*self.yflip)
BGL.glVertex2i(self.x+2*self.xflip,self.y+3*self.yflip)
BGL.glVertex2i(self.x+8*self.xflip,self.y+3*self.yflip)
BGL.glVertex2i(self.x+1*self.xflip,self.y+4*self.yflip)
BGL.glVertex2i(self.x+8*self.xflip,self.y+4*self.yflip)
# change colour for border, if needed
BGL.glColor3f(self.bcol[0],self.bcol[1],self.bcol[2])
BGL.glVertex2i(self.x+5*self.xflip,self.y)
BGL.glVertex2i(self.x+8*self.xflip,self.y)
BGL.glVertex2i(self.x+5*self.xflip,self.y)
BGL.glVertex2i(self.x,self.y+5*self.yflip)
BGL.glVertex2i(self.x,self.y+5*self.yflip)
BGL.glVertex2i(self.x,self.y+8*self.yflip)
BGL.glEnd()
示例10: gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def gui(): # the function to draw the screen
global mystring, mymsg, toggle
if len(mystring) > 90: mystring = ""
BGL.glClearColor(0,0,1,1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor3f(1,1,1)
Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
BGL.glRasterPos2i(72, 16)
if toggle: toggle_state = "down"
else: toggle_state = "up"
Draw.Text("The toggle button is %s." % toggle_state, "small")
BGL.glRasterPos2i(10, 230)
Draw.Text("Type letters from a to z, ESC to leave.")
BGL.glRasterPos2i(20, 200)
Draw.Text(mystring)
BGL.glColor3f(1,0.4,0.3)
BGL.glRasterPos2i(340, 70)
Draw.Text(mymsg, "tiny")
示例11: coversides
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def coversides(self):
## This function draws lines to cover up border lines designated by the sides arguement.
BGL.glColor3f(self.col[0],self.col[1],self.col[2])
if self.sides[0]: # left border
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(self.left,self.base+1)
BGL.glVertex2i(self.left,self.top)
BGL.glEnd()
if self.sides[1]: # top border
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(self.left+1,self.top)
BGL.glVertex2i(self.right,self.top)
BGL.glEnd()
if self.sides[2]: # right border
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(self.right,self.base+1)
BGL.glVertex2i(self.right,self.top)
BGL.glEnd()
if self.sides[3]: # base border
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(self.left+1,self.base)
BGL.glVertex2i(self.right,self.base)
BGL.glEnd()
示例12: displayWarnings
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def displayWarnings():
BGL.glClearColor(0.392,0.396,0.549,1)
BGL.glClear(Blender.BGL.GL_COLOR_BUFFER_BIT)
size = Blender.Window.GetAreaSize()
isize = drawHeader(size)
BGL.glColor3f(1.0,1.0,0.0)
yval = size[1]-isize[1] - 40
Blender.BGL.glRasterPos2i(50, yval)
Blender.Draw.Text('Warnings:','normal')
BGL.glColor3f(1.0,1.0,1.0)
for s in gWarnings:
Blender.BGL.glRasterPos2i(115, yval)
Blender.Draw.Text(s,'normal')
yval = yval - 18
Blender.Draw.PushButton('Back', ID_BACK, 105, 10, 100, 20, 'Back To Exporter')
示例13: import_gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def import_gui():
global filename, fileinput, impstatus
# Clear drawing area.
BGL.glClearColor(0.9,0.9,0.9,1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
# Status.
BGL.glRasterPos2i(10,8)
if impstatus == 0:
BGL.glColor3f(0.0,0.0,0.0)
Draw.Text('Importer ready.','tiny')
elif impstatus == 1:
BGL.glColor3f(0.0,0.75,0.0)
Draw.Text('Importing...','tiny')
elif impstatus == 2:
BGL.glColor3f(0.75,0.0,0.0)
Draw.Text('File not found!','tiny')
# Filename input box.
BGL.glRasterPos2i(10,20)
w = Draw.Text('File to import:')
Draw.Button(filename, 3, w+15, 15, 200,20)
#fileinput = Draw.String('',3, w+15,15, 200,20, filename, 512,
# 'Filename to import.')
Draw.Button('Import', 1, w+15+210,15, 40,20)
Draw.Button('Quit', 2, w+15+210+50,15, 40,20)
示例14: gui_draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def gui_draw():
from Blender import BGL, Draw
(width, height) = Blender.Window.GetAreaSize()
BGL.glClearColor(0.4, 0.4, 0.45, 1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor3f(1, 1, 1)
BGL.glRasterPos2f(5, 55)
Draw.Text("FlightGear YASim Import: '%s'" % Global.path)
Draw.PushButton("Reload", RELOAD_BUTTON, 5, 5, 80, 32, "reload YASim config file")
Global.mirror_button = Draw.Toggle("Mirror", MIRROR_BUTTON, 100, 5, 50, 16, Global.mirror_button.val, \
"show symmetric surfaces on both sides (reloads config)")
Draw.PushButton("Update Cursor", CURSOR_BUTTON, width - 650, 5, 100, 32, "update cursor display (in YASim coordinate system)")
BGL.glRasterPos2f(width - 530 + Blender.Draw.GetStringWidth("Vector from last") - Blender.Draw.GetStringWidth("Current"), 24)
Draw.Text("Current cursor pos: x = %+.3f y = %+.3f z = %+.3f" % tuple(Global.cursor))
c = Global.cursor - Global.last_cursor
BGL.glRasterPos2f(width - 530, 7)
Draw.Text("Vector from last cursor pos: x = %+.3f y = %+.3f z = %+.3f length = %.3f m" % (c[0], c[1], c[2], c.length))
示例15: Draw_Border
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3f [as 别名]
def Draw_Border(X1,Y1,X2,Y2): # X1,Y1 = Top Left X2,Y2 = Bottom Right
"""
Draw a border given a top left corner (X1, X2) and bottom right (X2, Y2)
"""
INDENT = 3
BGL.glColor3f(1.0,1.0,1.0)
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(X1+INDENT,Y1-INDENT) #top line
BGL.glVertex2i(X2-INDENT,Y1-INDENT)
BGL.glVertex2i(X1+INDENT,Y1-INDENT) #left line
BGL.glVertex2i(X1+INDENT,Y2+INDENT)
BGL.glEnd()
BGL.glColor3f(0.5,0.5,0.5)
BGL.glBegin(BGL.GL_LINES)
BGL.glVertex2i(X2-INDENT,Y1-INDENT) #Right line
BGL.glVertex2i(X2-INDENT,Y2+INDENT)
BGL.glVertex2i(X1+INDENT,Y2+INDENT) #bottom line
BGL.glVertex2i(X2-INDENT,Y2+INDENT)
BGL.glEnd()