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


Python BGL.glPointSize方法代码示例

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


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

示例1: renderGUI

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glPointSize [as 别名]
def renderGUI():

	"""
	Renders the GUI for the script.
	"""
	
	global G

	# find the selection set and update some selection
	#  related flags
	haveEmpty  = False
	haveCamera = False
	emptyName  = ""
	G.selection = Object.GetSelected()
	G.curempty  = None
	if G.selection is not None and len(G.selection) > 0:
		mso = G.selection[0]
		msotype = mso.getType()
		if msotype == 'Empty':
			haveEmpty = True
			G.curempty = mso
			emptyName = G.curempty.getName()
		elif msotype == 'Camera':
			haveCamera = True
	emptyHasCoords = G.coordmap.has_key(emptyName)
	removeUnknownsFromCoords()
	
	# clear any buttons that need to have set states
	G.buttons.add = G.buttons.delete = None
	
	# clear the window
	c = COLOR_BACKGROUND
	BGL.glClearColor(c[0], c[1], c[2], c[3])
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)

	# paint the image in the background
	if G.image is not None:
		#drawImage(G.image, G.imgpos, G.iw, G.ih, G.zoom)
		Draw.Image(G.image, G.imgpos[0], G.imgpos[1], G.zoom, G.zoom)
	# paint 2D vertices in the image
	BGL.glPushAttrib(BGL.GL_POINT_BIT | BGL.GL_CURRENT_BIT)
	BGL.glPointSize(POINT_SIZE)
	x0 = int(G.imgpos[0] / G.zoom)
	y0 = int(G.imgpos[1] / G.zoom)
	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))
	BGL.glBegin(BGL.GL_POINTS)
	map(drawvc, G.coordmap.items())
	BGL.glEnd()
	BGL.glPopAttrib()
	
	# if we're in add mode then draw some extra stuff
	if G.mode == MODE_ADD:
	
		xm,ym = map(int, getWMCoords())
		xm -= 10
		ym += 10
		(xw,yw,ww,hw) = getWinRect()
		
		# draw crosshairs
		c = COLOR_CROSSHAIRS
		BGL.glColor4f(c[0], c[1], c[2], c[3])		
		verts = [ (xm,0), (xm,hw), (0,ym), (ww,ym) ]
		BGL.glBegin(BGL.GL_LINES)
		map(lambda x: BGL.glVertex2d(x[0],x[1]), verts)
		BGL.glEnd()

		#############################################
		# UNCOMMENT THIS SECTION FOR A COOL MINIMAP
		# EFFECT - NOT VERY USEFUL THOUGH
		#
		## draw "minimap" background
		#c = COLOR_MINIMAP
		#BGL.glColor4f(c[0], c[1], c[2], c[3])
		#verts = [ (119,10), (221,10), (221,111), (119,111) ]
		#BGL.glBegin(BGL.GL_QUADS)
		#map(lambda x: BGL.glVertex2i(x[0],x[1]), verts)
		#BGL.glEnd()
		#
		## paint the image into the minimap
		#ix,iy = wc2ic((xm,ym))
		#ix,iy = map(int, [ix, iy])
		#drawImage(G.ibuf, (120,10), G.iw, G.ih, 10.0, (ix-5,iy-5,10,10))
		#
		# END OF MINIMAP SECTION
		#############################################
	
	# paint the current empty name
	if haveEmpty:
		c = COLOR_TEXT
		BGL.glColor4d(c[0], c[1], c[2], c[3])
		BGL.glRasterPos2i(220, 10)
		Draw.Text(emptyName, 'small')
	
#.........这里部分代码省略.........
开发者ID:Csega,项目名称:pyTsai,代码行数:103,代码来源:BlenderTsai.py


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