本文整理汇总了Python中Blender.BGL.glClear方法的典型用法代码示例。如果您正苦于以下问题:Python BGL.glClear方法的具体用法?Python BGL.glClear怎么用?Python BGL.glClear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blender.BGL
的用法示例。
在下文中一共展示了BGL.glClear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def __init__(self, background):
## Basic background colour.
BGL.glClearColor(background[0],background[1],background[2],background[3])
## Clear the OpenGL script window to background colour.
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
## Create a buffer space for the values we're after.
scissorbox=BGL.Buffer(BGL.GL_FLOAT,4)
## Get the openGL window size values.
BGL.glGetFloatv(BGL.GL_SCISSOR_BOX,scissorbox)
## The scissorbox values are floats, so we change them to integers. This prevents protests from Python about "int expected".
## The left and base values are mainly used to calculate the position of the mouse x and y values.
# Left side of the OpenGL script window. Value is in pixels, from the left side of the main Blender window.
self.left=int(scissorbox[0])
# Bottom of the OpenGL script window.Value is in pixels, up from the bottom of the main Blender window.
self.base=int(scissorbox[1])
# Width of the OpenGL script window.
self.width=int(scissorbox[2])
# Height of the OpenGL script window.
self.height=int(scissorbox[3])
示例2: updateStatus
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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()
示例3: DrawDialog
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def DrawDialog(self):
"""Should be passed as the 'draw' argument to Blender.Draw.Register().
Defines how the dialog should be drawn on every redraw."""
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
#BGL.glEnable(BGL.GL_BLEND)
#BGL.glBlendFunc(
# BGL.GL_SRC_ALPHA,
# BGL.GL_ONE_MINUS_SRC_ALPHA
#)
BGL.glRasterPos2d(self.column(1), self.line(0))
Draw.Text('PySoy importer', 'large')
self.importfile = Draw.String('Import from: ',
self.EVENT_IMPORTFROM,
self.column(1), self.line(2),
self.width(30), self.height(1),
self.filepathSTR, 399, 'Import an element from this file')
self.importfilebutton = Draw.PushButton('Set import file',
self.EVENT_SETIMPORT,
self.column(31), self.line(2),
self.width(10), self.height(1),
'Set file to import from')
if self.fileselected == True:
self.importmenu = Draw.Menu('Import element:%t|Mesh|Material|Entity|Node',
self.EVENT_IMPORTMENU,
self.column(1), self.line(4),
self.width(10), self.height(1),
1, 'Select element from file to import')
示例4: draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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+"")
示例5: drawGUI
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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')
示例6: bad_draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def bad_draw():
global _gui_edge_length_button, _gui_edge_angle_button, _gui_edge_weld_button
try:
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
BGL.glRasterPos2d(8, 40)
Draw.Text('Blender Assisted Design', 'large')
_gui_edge_length_button = Draw.Number('Edge length: ', GUI_EDGE_LENGTH, 8, 8, 200, 24, _gui_edge_length, 0.0, 1000.0, bad_set_length.__doc__)
Draw.PushButton(
'Set', 0,
214, 8, 40, 24,
bad_set_length.__doc__,
lambda *a: bad_script_call(bad_script_set_length, float(_gui_edge_length))
)
_gui_edge_angle_button = Draw.Number('Edge angle: ', GUI_EDGE_ANGLE, 270, 8, 200, 24, _gui_edge_angle, 0.0, 180.0, bad_set_angle.__doc__)
Draw.PushButton(
'Set', 0,
476, 8, 40, 24,
bad_set_angle.__doc__,
lambda *a: bad_script_call(bad_script_set_angle, float(_gui_edge_angle))
)
Draw.PushButton(
'Weld', 0,
534, 8, 50, 24,
bad_weld_edges.__doc__,
lambda *a: bad_script_call(bad_script_weld)
)
except Exception, e:
print e
Draw.Exit()
示例7: import_gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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)
示例8: gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def gui():
BGL.glClearColor(1,1,1,1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
# idle
Draw.Label("Idle-Animation:", 10,200,180,20)
Draw.Number("von ", 1, 10,180,90,20,idleStartFrame,0,1000, "", button_event, 1,1)
Draw.Number("bis ", 2, 110,180,90,20,idleEndFrame,0,1000, "", button_event, 1,1)
# move
Draw.Label("Move-Animation:", 10,150,180,20)
Draw.Number("von ", 3, 10,130,90,20,moveStartFrame,0,1000, "", button_event, 1,1)
Draw.Number("bis ", 4, 110,130,90,20,moveEndFrame,0,1000, "", button_event, 1,1)
# attack
Draw.Label("Attack-Animation:", 10,90,180,20)
Draw.Number("von ", 5, 10,70,90,20,attackStartFrame,0,1000, "", button_event, 1,1)
Draw.Number("bis ", 6, 110,70,90,20,attackEndFrame,0,1000, "", button_event, 1,1)
# die
Draw.Label("Die-Animation:", 10,40,180,20)
Draw.Number("von ", 7, 10,20,90,20,dieStartFrame,0,1000, "", button_event, 1,1)
Draw.Number("bis ", 8, 110,20,90,20,dieEndFrame,0,1000, "", button_event, 1,1)
# RENDER-Button:
Draw.Button("RENDER", 9, 230,30,80,20, "RENDER!", renderButtonClicked)
示例9: gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def gui():
global buttons, offsets, rows, cols
size=BGL.Buffer(BGL.GL_FLOAT, 4)
BGL.glGetFloatv(BGL.GL_SCISSOR_BOX, size)
size=size.list
xoff=PANELPAD
yoff=int(size[3])
# Default theme
text =[ 0, 0, 0, 255]
text_hi=[255, 255, 255, 255]
header =[165, 165, 165, 255]
panel =[255, 255, 255, 40]
back =[180, 180, 180, 255]
# Actual theme
if Blender.Get('version') >= 235:
theme=Blender.Window.Theme.Get()
if theme:
theme=theme[0]
text=theme.get('ui').text
space=theme.get('buts')
text_hi=space.text_hi
header=space.header
header=[max(header[0]-30, 0), # 30 appears to be hard coded
max(header[1]-30, 0),
max(header[2]-30, 0),
header[3]]
panel=space.panel
back=space.back
BGL.glEnable (BGL.GL_BLEND)
BGL.glBlendFunc (BGL.GL_SRC_ALPHA, BGL.GL_ONE_MINUS_SRC_ALPHA)
BGL.glClearColor(float(back[0])/255, float(back[1])/255, float(back[2])/255, 1)
BGL.glClear (BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor4ub(*header)
BGL.glRectd(xoff, yoff-PANELTOP, xoff-PANELINDENT+PANELWIDTH, yoff-PANELTOP-PANELHEAD)
BGL.glColor4ub(*panel)
BGL.glRectd(xoff, yoff-PANELTOP-PANELHEAD, xoff-PANELINDENT+PANELWIDTH, yoff-60-PANELINDENT-rows*CONTROLSIZE)
BGL.glColor4ub(*text_hi)
BGL.glRasterPos2d(xoff+PANELINDENT, yoff-23)
Draw.Text("Fixup UV mapping")
BGL.glColor4ub(*text)
BGL.glRasterPos2d(xoff+PANELINDENT, yoff-48)
Draw.Text("Select where the old image is located in the new:")
buttons=[]
for i in range(rows):
for j in range(cols):
buttons.append(Draw.Button('', len(buttons)+CANCEL+1, xoff+PANELINDENT+j*CONTROLSIZE, yoff-80-i*CONTROLSIZE, CONTROLSIZE, CONTROLSIZE))
buttons.append(Draw.Button("Cancel", CANCEL, xoff-PANELINDENT*2+PANELWIDTH-4*CONTROLSIZE, yoff-60-rows*CONTROLSIZE, 4*CONTROLSIZE, CONTROLSIZE))
示例10: gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def gui():
global copynorm, copystrp
size=BGL.Buffer(BGL.GL_FLOAT, 4)
BGL.glGetFloatv(BGL.GL_SCISSOR_BOX, size)
size=size.list
x=int(size[2])
y=int(size[3])
# Default theme
text =[ 0, 0, 0, 255]
text_hi=[255, 255, 255, 255]
header =[195, 195, 195, 255]
panel =[255, 255, 255, 40]
back =[180, 180, 180, 255]
# Actual theme
if Blender.Get('version') >= 235:
theme=Blender.Window.Theme.Get()
if theme:
theme=theme[0]
space=theme.get('buts')
text=theme.get('ui').text
text_hi=space.text_hi
header=space.header
panel=space.panel
back=space.back
BGL.glEnable (BGL.GL_BLEND)
BGL.glBlendFunc (BGL.GL_SRC_ALPHA, BGL.GL_ONE_MINUS_SRC_ALPHA)
BGL.glClearColor (float(back[0])/255, float(back[1])/255,
float(back[2])/255, 1)
BGL.glClear (BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor4ub (max(header[0]-30, 0), # 30 appears to be hard coded
max(header[1]-30, 0),
max(header[2]-30, 0),
header[3])
BGL.glRectd(7, y-8, 295, y-28)
BGL.glColor4ub (panel[0], panel[1], panel[2], panel[3])
BGL.glRectd(7, y-28, 295, y-130)
BGL.glColor4ub (text_hi[0], text_hi[1], text_hi[2], text_hi[3])
BGL.glRasterPos2d(16, y-23)
Draw.Text("UV Copy & Paste")
BGL.glColor4ub (text[0], text[1], text[2], text[3])
BGL.glRasterPos2d(16, y-48)
Draw.Text("Select the faces to paint and then press Paste")
BGL.glRasterPos2d(16, y-75)
Draw.Text("Copy type:", "small")
copynorm = Draw.Toggle("Normal", 3, 73, y-79, 51, 17, copynorm.val,
"Copy texture to selected faces in the same or a different mesh")
copystrp = Draw.Toggle("Strip", 4, 124, y-79, 51, 17, copystrp.val,
"Reverse copied texture as necessary to make a strip in the same mesh")
Draw.Button("Paste", 2, 14, y-120, 100, 26)
Draw.Button("Cancel", 1, 187, y-120, 100, 26)
示例11: gui
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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")
示例12: _draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def _draw(self):
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
height = 32
y_pos = 10
quit_text = "Quit"
Draw.Button(quit_text, self.EVENT_EXIT, 10, y_pos, 2 * Draw.GetStringWidth(quit_text), height, "Quit script")
y_pos += int(height * 1.5)
render_text = "Render"
Draw.Button(render_text, self.EVENT_RENDER, 10, y_pos, 2 * Draw.GetStringWidth(render_text), height, "Render scene to output")
y_pos += int(height * 1.5)
file_chooser_text = "..."
Draw.Button(file_chooser_text, self.EVENT_FILECHOOSER, 10, y_pos, 2 * Draw.GetStringWidth(file_chooser_text), height, "Select file from file system")
Draw.String("Output: ", self.EVENT_NONE, 2*Draw.GetStringWidth(file_chooser_text) + 10, y_pos, 256, height, self._get_output(), 399,
"Name of output file", self._output_input_callback)
示例13: displayWarnings
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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')
示例14: OnDraw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [as 别名]
def OnDraw():
global Ticks, Tickctrl
BGL.glClear(Blender.BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor3f(0.2, 0.3, 0.3)
DrawBox(LEFT-10, TOP - 10, 300, 380)
BGL.glColor3f(0.1, 0.1, 0.1)
BGL.glRasterPos2i(LEFT, TOP)
Draw.Text("DirectX Exporter", "large")
BGL.glRasterPos2i(LEFT, TOP - 40)
Draw.Text("Export", "large")
Draw.Toggle("All", 0, LEFT, TOP - 80, 80, 20, ExportType == 0, "Export all static objects in the current scene.")
Draw.Toggle("Selected", 1, LEFT + 100, TOP - 80, 80, 20, ExportType == 1, "Export all selected objects.")
Draw.Toggle("Animated", 2, LEFT + 200, TOP - 80, 80, 20, ExportType == 2, "Export one mesh with one armature. Make sure that only the mesh and it's armature are selected.")
BGL.glRasterPos2i(LEFT, EDATA)
Draw.Text("Exported data", "large")
Draw.Toggle("Normals", 3, LEFT, EDATA - 40, 80, 20, Normals, "Export vertex normals.")
Draw.Toggle("Colors", 4, LEFT + 200, EDATA - 40, 80, 20, Colors, "Export vertex diffuse colors.")
Draw.Toggle("Texcoords", 6, LEFT, EDATA - 70, 80, 20, TexCoords, "Export vertex texture coordinates.")
Draw.Toggle("Materials", 7, LEFT + 100, EDATA - 40, 80, 20, Materials, "Export materials.")
BGL.glRasterPos2i(LEFT, MISC)
Draw.Text("Misc options", "large")
Draw.Toggle("Swap y and z", 8, LEFT, MISC - 40, 80, 20, SwapYZ, "Right-handed to left-handed system.")
Draw.Toggle("Apply world", 9, LEFT + 100, MISC - 40, 80, 20, UseWTrans, "Apply world transformation to exported vertices.")
Tickctrl = Draw.Number("Speed", 10, LEFT + 200, MISC - 40, 80, 20, Ticks, 1, 100, "Animation ticks per second.")
#Draw.Toggle("Compressed", 11, LEFT, MISC - 70, 80, 20, Compressed, "Compress the file.")
Draw.Button("Export...", 100, LEFT + 40, DOIT, 80, 40, "Export data.")
Draw.Button("Exit", 101, LEFT + 140, DOIT, 80, 40, "Exit the script.")
BGL.glColor3f(0.3, 0.3, 0.3)
BGL.glRasterPos2i(LEFT, 35)
Draw.Text("(C) 2006 Heikki Salo", "small")
BGL.glRasterPos2i(LEFT, 20)
Draw.Text("http://directpython.sourceforge.net/exportx.html", "small")
示例15: gui_draw
# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glClear [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))