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


Python BGL.glColor3ub方法代码示例

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


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

示例1: gui

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3ub [as 别名]
def gui(): # drawing the screen

	global SCREEN, START_SCREEN, CONFIG_SCREEN, KEYMENUS, LABELS
	global BEVT_KEYMENU, BUT_KEYMENU, CFGKEY
	global BUT_TYPES, SCROLL_DOWN, VARS_NUM

	WIDTH, HEIGHT = Window.GetAreaSize()

	theme = Theme.Get()[0]
	tui = theme.get('ui')
	ttxt = theme.get('text')

	COL_BG = float_colors(ttxt.back)
	COL_TXT = ttxt.text
	COL_TXTHI = ttxt.text_hi

	BGL.glClearColor(COL_BG[0],COL_BG[1],COL_BG[2],COL_BG[3])
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
	BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

	if SCREEN == START_SCREEN:
		x = 10
		y = 10
		h = 20
		w = 90
		BGL.glRasterPos2i(x, y)
		Draw.Text('Select a configuration key to access it.  Press Q or ESC to leave.')
		km_len = len(KEYMENUS)
		km_columns = (WIDTH - x) / w
		if km_columns == 0: km_rows = km_len
		else:
			km_rows = km_len / km_columns
			if (km_len % km_columns): km_rows += 1
		if km_rows == 0: km_rows = 1
		ystart = y + 2*h*km_rows
		if ystart > (HEIGHT - 70): ystart = HEIGHT - 70
		y = ystart
		column = 1
		for i, km in enumerate(KEYMENUS):
			column += 1
			BGL.glRasterPos2i(x + 2, y + h + 5)
			Draw.Text(LABELS[i])
			BUT_KEYMENU[i] = Draw.Menu(km, BEVT_KEYMENU[i],
				x, y, w - 10, h, 0, 'Choose a key to access its configuration data')
			if column > km_columns:
				column = 1
				y -= 2*h
				if y < 35: break
				x = 10
			else: x += w
		x = 10
		y = 50 + ystart
		BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Configuration Editor')
		Draw.PushButton('help', BEVT_HELP, x, 22, 45, 16,
			'View help information about this script (hotkey: H)')

	elif SCREEN == CONFIG_SCREEN:
		x = y = 10
		h = 18
		data = CFGKEY.sorteddata
		tips = CFGKEY.tips
		fromdisk = CFGKEY.fromdisk
		limits = CFGKEY.limits
		VARS_NUM = 0
		for k in data.keys():
			VARS_NUM += len(data[k])
		lines = VARS_NUM + 5 # to account for header and footer
		y = lines*h
		if y > HEIGHT - 20: y = HEIGHT - 20
		BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Configuration Editor')
		y -= 20
		BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])
		txtsize = 10
		if HEIGHT < lines*h:
			BGL.glRasterPos2i(10, 5)
			txtsize += Draw.Text('Arrow keys or mouse wheel to scroll, ')
		BGL.glRasterPos2i(txtsize, 5)
		Draw.Text('Q or ESC to return.')
		BGL.glRasterPos2i(x, y)
		Draw.Text('Key: "%s"' % CFGKEY.name)
		bh = 16
		bw = 45
		by = 16
		i = -1
		if CFGKEY.scriptname:
			i = 0
			Draw.PushButton('help', BEVT_HELP, x, by, bw, bh,
				'Show documentation for the script that owns this key (hotkey: H)')
		Draw.PushButton('back', BEVT_BACK, x + (1+i)*bw, by, bw, bh,
			'Back to config keys selection screen (hotkey: ESC)')
		Draw.PushButton('exit', BEVT_EXIT, x + (2+i)*bw, by, bw, bh,
			'Exit from Scripts Config Editor (hotkey: Q)')
		Draw.PushButton('revert', BEVT_CANCEL, x + (3+i)*bw, by, bw, bh,
			'Revert data to original values (hotkey: U)')
		Draw.PushButton('apply', BEVT_APPLY, x + (4+i)*bw, by, bw, bh,
			'Apply changes, if any (hotkey: ENTER)')
#.........这里部分代码省略.........
开发者ID:Synric,项目名称:synricproj,代码行数:103,代码来源:config.py

示例2: gui

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glColor3ub [as 别名]
def gui(): # drawing the screen

	global SCREEN, START_SCREEN, SCRIPT_SCREEN
	global SCRIPT_INFO, AllGroups, GROUP_MENUS
	global BEVT_EMAIL, BEVT_LINK
	global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
	global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE

	theme = Theme.Get()[0]
	tui = theme.get('ui')
	ttxt = theme.get('text')

	COL_BG = float_colors(ttxt.back)
	COL_TXT = ttxt.text
	COL_TXTHI = ttxt.text_hi

	BGL.glClearColor(COL_BG[0],COL_BG[1],COL_BG[2],COL_BG[3])
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
	BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

	resize = screen_was_resized()
	if resize: fit_on_screen()

	if SCREEN == START_SCREEN:
		x = PADDING
		bw = 85
		bh = 25
		hincr = 50

		butcolumns = (WIN_W - 2*x)/ bw
		if butcolumns < 2: butcolumns = 2
		elif butcolumns > 7: butcolumns = 7

		len_gm = len(GROUP_MENUS)
		butlines = len_gm / butcolumns
		if len_gm % butcolumns: butlines += 1

		h = hincr * butlines + 20
		y = h + bh

		BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Help Browser')

		y -= bh

		BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

		i = 0
		j = 0
		for group_menu in GROUP_MENUS:
			BGL.glRasterPos2i(x, y)
			Draw.Text(group_menu[0]+':')
			BUT_GMENU[j] = Draw.Menu(group_menu[1], BEVT_GMENU[j],
				x, y-bh-5, bw, bh, 0,
				'Choose a script to read its help information')
			if i == butcolumns - 1:
				x = PADDING
				i = 0
				y -= hincr
			else:
				i += 1
				x += bw + 3
			j += 1

		x = PADDING
		y = 10
		BGL.glRasterPos2i(x, y)
		Draw.Text('Select script for its help.  Press Q or ESC to leave.')

	elif SCREEN == SCRIPT_SCREEN:
		if SCRIPT_INFO:

			if resize:
				SCRIPT_INFO.wrap_lines(1)
				SCROLL_DOWN = 0

			h = 18 * SCRIPT_INFO.len_content + 12 * SCRIPT_INFO.spaces
			x = PADDING
			y = WIN_H
			bw = 38
			bh = 16

			BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
			for line in SCRIPT_INFO.header:
				y -= 18
				BGL.glRasterPos2i(x, y)
				size = Draw.Text(line)

			for line in text_wrap('Tooltip: %s' % SCRIPT_INFO.script.tip):
				y -= 18
				BGL.glRasterPos2i(x, y)
				size = Draw.Text(line)

			i = 0
			y -= 28
			for data in SCRIPT_INFO.d['__url__']:
				Draw.PushButton('link %d' % (i + 1), BEVT_LINK[i],
					x + i*bw, y, bw, bh, data[0])
				i += 1
#.........这里部分代码省略.........
开发者ID:Synric,项目名称:synricproj,代码行数:103,代码来源:help_browser.py


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