当前位置: 首页>>代码示例>>Python>>正文


Python Blender.BGL类代码示例

本文整理汇总了Python中Blender.BGL的典型用法代码示例。如果您正苦于以下问题:Python BGL类的具体用法?Python BGL怎么用?Python BGL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BGL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bad_draw

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()
开发者ID:Natspir,项目名称:blenderassisteddesign,代码行数:31,代码来源:script.py

示例2: DrawDialog

  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')
开发者ID:RONNCC,项目名称:pysoy,代码行数:30,代码来源:soy_import.py

示例3: doDraw

    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)
开发者ID:krichter722,项目名称:zeroballistics,代码行数:7,代码来源:gui.py

示例4: gui

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)
开发者ID:tfg13,项目名称:Centuries-of-Rage,代码行数:26,代码来源:CoR-Blender-Export.py

示例5: dotext

	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)
开发者ID:duststorm,项目名称:lodpbr,代码行数:28,代码来源:goo.py

示例6: gui_masse_volumique

def gui_masse_volumique():
	# Création d'Id pour les évènements
	nCpt_evt = 1
	global EV_BT_OK
	EV_BT_OK = nCpt_evt; nCpt_evt += 1
	global EV_BT_ANNULER
	EV_BT_ANNULER = nCpt_evt; nCpt_evt += 1
	global EV_MASS_VOL
	EV_MASS_VOL = nCpt_evt; nCpt_evt += 1
	
	pos_x = 5
	pos_y = 100; pas_y = 36
	BGL.glRasterPos2i( pos_x, pos_y )
	Draw.Text("Choisissez la masse volumique du maillage (et validez par \"OK\") :")
	
	#[nom bouton] = Draw.Number("[nom]", [numéro d'événement], [position x], [position y], \
	#                            [largeur], [hauteur], \
	#                            [valeur initiale], [valeur minimale],[valeur maximale], "[astuce]")
	global bt_masse_volumique
	largeur_mv = 360
	hauteur = 25
	pos_y -= pas_y
	bt_masse_volumique = Draw.Number("Masse volumique :", EV_MASS_VOL, pos_x, pos_y, \
												largeur_mv, hauteur, \
												1.0, 0.0, 100000.0, "saisissez la masse volumique")
	largeur_bt = 80
	pos_y -= pas_y
	dx_espacement = int( ( largeur_mv - 2.0 * largeur_bt ) / 3.0 )
	dx_espacement = int( dx_espacement + 0.5 )
	pos_x_bt_OK = pos_x + dx_espacement
	pos_x_bt_Annuler = pos_x_bt_OK + largeur_bt + dx_espacement
	Draw.PushButton("OK", EV_BT_OK, pos_x_bt_OK, pos_y, largeur_bt, hauteur, "Valide")
	Draw.PushButton("Annuler", EV_BT_ANNULER, pos_x_bt_Annuler, pos_y, largeur_bt, hauteur, "Annule")
开发者ID:mhdsedighi,项目名称:SOFA,代码行数:33,代码来源:mesh_Compute_polyhedral_mass_properties.py

示例7: drawvc

	def drawvc(ec):
		emptyname, coord = ec
		if Object.Get(emptyname) in G.selection:
			c = COLOR_VERTSEL
		else:
			c = COLOR_VERTUNSEL
		BGL.glColor4f(c[0], c[1], c[2], c[3])
		BGL.glVertex2f(G.zoom*(coord[0]+x0), G.zoom*(coord[1]+y0))
开发者ID:Csega,项目名称:pyTsai,代码行数:8,代码来源:BlenderTsai.py

示例8: gui

	def gui(self,):
		quitbutton = Blender.Draw.Button("Exit", 1, 0, 0, 100, 20, "Close Window")
		
		y=35

		for line in self.msg:
			BGL.glRasterPos2i(10,y)
			Blender.Draw.Text(line)
			y+=15
开发者ID:bsmr-opengl,项目名称:cal3d,代码行数:9,代码来源:blender2cal3d.py

示例9: drawLights

def drawLights():
	global MESHLIGHTPOWER, DSAMPLES
	## meshlight power slider
	col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Meshlight:")
	col=100; line=195; MESHLIGHTPOWER=Draw.Number("Power", 2, col, line, 120, 18, MESHLIGHTPOWER.val, 1, 15)
	## lightserver settings
	col=10; line=150; BGL.glRasterPos2i(col, line); Draw.Text("Lightserver:")
	col=100; line=147; DSAMPLES=Draw.Number("Direct Samples  ", 2, col, line, 250, 18, DSAMPLES.val, 0, 1024); 
	drawButtons()
开发者ID:Syntopia,项目名称:Meshia,代码行数:9,代码来源:sunflow_export.py

示例10: drawCamera

def drawCamera():
	global DOF, DOFRADIUS, DOFDIST, SPHERICALCAMERA
	##  camera settings
	col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Camera:")
	col=100; line=195; DOF=Draw.Toggle("DOF", DOF_CAMERA, col, line, 120, 18, DOF.val)
	col=225; DOFDIST=Draw.Number("Distance", 2, col, line, 120, 18, DOFDIST.val, 0.0, 200.00)
	col=350; DOFRADIUS=Draw.Number("Radius", 2, col, line, 120, 18, DOFRADIUS.val, 0.0, 200.00)
	col=100; line=170; SPHERICALCAMERA=Draw.Toggle("Spherical", SPHER_CAMERA, col, line, 120, 18, SPHERICALCAMERA.val)
	drawButtons()
开发者ID:Syntopia,项目名称:Meshia,代码行数:9,代码来源:sunflow_export.py

示例11: getWinRect

def getWinRect():

	"""
	Returns the rectangle of the current script window in
	screen coordinates.
	
	@return: Script window rectangle: [x, y, w, h]
	"""
	
	winrect = BGL.Buffer(BGL.GL_FLOAT, 4)
	BGL.glGetFloatv(BGL.GL_SCISSOR_BOX, winrect)
	return winrect.list
开发者ID:Csega,项目名称:pyTsai,代码行数:12,代码来源:BlenderTsai.py

示例12: drawAA

def drawAA():
	global MINAA, MAXAA, AASAMPLES
	global IMGFILTERW, IMGFILTERH, IMGFILTER
	global EXP_ANIM
	##  aa settings
	col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("AA:")
	col=100; MINAA=Draw.Number("Min AA ", 2, col, line, 120, 18, MINAA.val, -4, 5); 
	col=230; MAXAA=Draw.Number("Max AA  ", 2, col, line, 120, 18, MAXAA.val, -4, 5)
	col=360; AASAMPLES=Draw.Number("Samples", 2, col, line, 120, 18, AASAMPLES.val, 0, 32)
	col=10; line=175; BGL.glRasterPos2i(col, line); Draw.Text("Image Filter:")
	col=100; line=173; IMGFILTER=Draw.Menu("%tImage Filter|box|gaussian|mitchell|triangle|catmull-rom|blackman-harris|sinc|lanczos", FILTER_EVENT, col, line, 120, 18, IMGFILTER.val)
	col=10; line=120; EXP_ANIM=Draw.Toggle("Export As Animation", 2, col, line, 140, 18, EXP_ANIM.val)
	drawButtons()
开发者ID:Syntopia,项目名称:Meshia,代码行数:13,代码来源:sunflow_export.py

示例13: drawAO

def drawAO():
	global OCCLUSSION, OCCBRIGHTR, OCCBRIGHTG, OCCBRIGHTB, OCCDARKR, OCCDARKG, OCCDARKB, OCCSAMPLES, OCCDIST
	col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Ambient Occlusion")
	col=10; line=175; OCCLUSSION=Draw.Toggle("Amb Occ", 2, col, line, 85, 18, OCCLUSSION.val)
	col=100; OCCBRIGHTR=Draw.Number("Bright (R)", 2, col, line, 125, 18, OCCBRIGHTR.val, 0.0, 1.0)
	col=230; OCCBRIGHTG=Draw.Number("Bright (G)", 2, col, line, 125, 18, OCCBRIGHTG.val, 0.0, 1.0)
	col=360; OCCBRIGHTB=Draw.Number("Bright (B)", 2, col, line, 125, 18, OCCBRIGHTB.val, 0.0, 1.0)
	col=100; line=150; OCCDARKR=Draw.Number("Dark (R)", 2, col, line, 125, 18, OCCDARKR.val, 0.00, 1.0)
	col=230; OCCDARKG=Draw.Number("Dark (G)", 2, col, line, 125, 18, OCCDARKG.val, 0.0, 1.0)
	col=360; OCCDARKB=Draw.Number("Dark (B)", 2, col, line, 125, 18, OCCDARKB.val, 0.0, 1.0)
	col=100; line=125; OCCSAMPLES=Draw.Number("Samples", 2, col, line, 125, 18, OCCSAMPLES.val, 0, 256)
	col=230; OCCDIST=Draw.Number("Distance", 2, col, line, 125, 18, OCCDIST.val, -1.0, 150.0)
	drawButtons()
开发者ID:Syntopia,项目名称:Meshia,代码行数:13,代码来源:sunflow_export.py

示例14: Create_Tab

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
开发者ID:AndyMidNite,项目名称:mogens,代码行数:29,代码来源:Main.py

示例15: drawGUI

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')
开发者ID:AndyMidNite,项目名称:mogens,代码行数:29,代码来源:Main.py


注:本文中的Blender.BGL类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。