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


Python BGL.glRasterPos2d方法代码示例

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


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

示例1: DrawDialog

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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')
开发者ID:RONNCC,项目名称:pysoy,代码行数:32,代码来源:soy_import.py

示例2: bad_draw

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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()
开发者ID:Natspir,项目名称:blenderassisteddesign,代码行数:33,代码来源:script.py

示例3: Create_Tab

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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
开发者ID:AndyMidNite,项目名称:mogens,代码行数:31,代码来源:Main.py

示例4: gui

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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))
开发者ID:RodneyJB,项目名称:XPlane2Blender,代码行数:57,代码来源:uvResize.py

示例5: gui

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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)
开发者ID:RodneyJB,项目名称:XPlane2Blender,代码行数:56,代码来源:uvCopyPaste.py

示例6: drawdataref

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [as 别名]
def drawdataref(datarefs, indices, eventbase, boneno, x, y):

    dataref=datarefs[boneno]
    valid=True

    mbutton=Draw.Menu('sim/%t|'+'/...|'.join(firstlevel)+'/...', DONTCARE+eventbase, x+4, y, CONTROLSIZE, CONTROLSIZE, -1, 'Pick the dataref from a list', datarefmenucallback)
    bbutton=Draw.String('', DATAREF_B+eventbase, x+4+CONTROLSIZE, y, PANELWIDTH-2*PANELINDENT-CONTROLSIZE, CONTROLSIZE, dataref, 100, 'Full name of the dataref used to animate this object')

    ibutton=None
    tbutton=None
    ref=dataref.split('/')
    if len(ref)<=1 or ref[0]=='sim':
        if len(ref)==1 and ref[0] in lookup and not lookup[ref[0]]:
            BGL.glRasterPos2d(x+4, y-21)
            Draw.Text('This dataref name is ambiguous')
            valid=False
        else:
            try:
                thing=hierarchy
                for i in range(len(ref)):
                    thing=thing[ref[i]]
                n=thing+0	# check is a leaf - ie numeric
                if not n:
                    BGL.glRasterPos2d(x+4, y-21)
                    Draw.Text("This dataref can't be used for animation")
                    valid=False
                elif n==1:
                    indices[boneno]=None
                else:
                    if indices[boneno]==None or indices[boneno]>=n:
                        indices[boneno]=0
                    Draw.Label("Part number:", x, y-26, 120, CONTROLSIZE)
                    ibutton=Draw.Number('', INDICES_B+eventbase, x+108, y-26, 50, CONTROLSIZE, indices[boneno], 0, n-1, 'The part number / array index')
            except:
                BGL.glRasterPos2d(x+4, y-21)
                Draw.Text("This is not a valid dataref")
                valid=False
    else:
        if indices[boneno]!=None:
            val=1
        else:
            val=0
        tbutton=Draw.Toggle('Part number', INDICES_T+eventbase, x+4, y-26, 104, CONTROLSIZE, val, 'Whether this is an array dataref')
        if val:
            ibutton=Draw.Number('', INDICES_B+eventbase, x+108, y-26, 50, CONTROLSIZE, indices[boneno], 0, 729, 'The part number / array index')

    return (valid, mbutton,bbutton,ibutton,tbutton)
开发者ID:GCTMODS,项目名称:XPlane2Blender-1,代码行数:49,代码来源:XPlaneAnimObject.py

示例7: gui

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [as 别名]
def gui():
    global dataref_m, dataref_b, indices_b, indices_t, vals_b, clear_b, loops_b
    global hideshow_m, from_b, to_b, up_b, down_b, delete_b, addhs_b
    global cancel_b, apply_b
    global manipulator_m, manipulator_b, cursor_m, cursor_b

    dataref_m=[]
    dataref_b=[]
    indices_b=[]
    indices_t=[]
    vals_b=[]
    clear_b=None
    loops_b=[]
    hideshow_m=[]
    from_b=[]
    to_b=[]
    up_b=[]
    down_b=[]
    delete_b=[]
    addhs_b=None
    cancel_b=None
    apply_b=None


    # 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]
    error  =[255,  80,  80, 255]	# where's the theme value for this?

    # 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
            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

    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])

    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)

    yoff=y-offset[1]
    if vertical:
        xoff=PANELPAD+PANELINDENT-offset[0]

    for boneno in range(bonecount):
        eventbase=boneno*EVENTMAX
        framecount=len(vals[boneno])
        if not vertical:
            xoff=PANELPAD+boneno*(PANELWIDTH+PANELPAD)+PANELINDENT-offset[0]
        BGL.glColor4ub(*header)
        BGL.glRectd(xoff-PANELINDENT, yoff-PANELTOP, xoff-PANELINDENT+PANELWIDTH, yoff-PANELTOP-PANELHEAD)
        BGL.glColor4ub(*panel)
        BGL.glRectd(xoff-PANELINDENT, yoff-PANELTOP-PANELHEAD, xoff-PANELINDENT+PANELWIDTH, yoff-170-(CONTROLSIZE-1)*framecount)

        txt='parent bone'
        if boneno: txt='grand'+txt
        txt='great-'*(boneno-1)+txt
        txt=txt[0].upper()+txt[1:]
        BGL.glColor4ub(*text_hi)
        BGL.glRasterPos2d(xoff, yoff-23)
        Draw.Text(txt)

        Draw.Label("Dataref:", xoff-4, yoff-54, 100, CONTROLSIZE)
        BGL.glColor4ub(*error)	# For errors
        (valid,mbutton,bbutton,ibutton,tbutton)=drawdataref(datarefs, indices, eventbase, boneno, xoff-4, yoff-80)
        dataref_m.append(mbutton)
        dataref_b.append(bbutton)
        indices_b.append(ibutton)
        indices_t.append(tbutton)

        vals_b.append([])
        if valid:
            # is a valid or custom dataref
            Draw.Label("Dataref values:", xoff-4, yoff-132, 150, CONTROLSIZE)
            for i in range(framecount):
                Draw.Label("Frame #%d:" % (i+1), xoff-4+CONTROLSIZE, yoff-152-(CONTROLSIZE-1)*i, 100, CONTROLSIZE)
                if i>1:
                    v9='v9: '
                else:
                    v9=''
                vals_b[-1].append(Draw.Number('', i+VALS_B+eventbase, xoff+104, yoff-152-(CONTROLSIZE-1)*i, 80, CONTROLSIZE, vals[boneno][i], -NUMBERMAX, NUMBERMAX, v9+'The dataref value that corresponds to the pose in frame %d' % (i+1)))
#.........这里部分代码省略.........
开发者ID:GCTMODS,项目名称:XPlane2Blender-1,代码行数:103,代码来源:XPlaneAnimObject.py

示例8: DrawDialog

# 需要导入模块: from Blender import BGL [as 别名]
# 或者: from Blender.BGL import glRasterPos2d [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 exporter', 'large')

    BGL.glRasterPos2d(self.column(1), self.line(2))
    Draw.Text('Level export options:')

    self.activescene = Draw.Toggle('Only active scene',
                                   self.EVENT_ACTIVE_SCENE,
                                   self.column(1), self.line(4),
                                   self.width(13), self.height(1),
                                   self.activesceneBT, 'Only export the currently active scene as a level')

    self.allscenes = Draw.Toggle('All scenes',
                                 self.EVENT_ALL_SCENES,
                                 self.column(14), self.line(4),
                                 self.width(13), self.height(1),
                                 self.allscenesBT, 'Export all scenes as levels')

    self.rootpath = Draw.String('Root datapath: ',
                                self.EVENT_ROOTPATH,
                                self.column(1), self.line(5),
                                self.width(30), self.height(1),
                                self.rootpathSTR, 399, 'File path for game data')

    self.setroot = Draw.PushButton('Set root path',
                                   self.EVENT_SETPATH,
                                   self.column(31), self.line(5),
                                   self.width(10), self.height(1),
                                   'Set another root path for data')

    self.meshdialog.DrawGroup(1, 6)
    self.entitydialog.DrawGroup(1, 8)
    self.nodedialog.DrawGroup(1, 10)
    self.materialdialog.DrawGroup(1, 12)

    self.heightmultiplier = Draw.Number('heightmultiplier',
                                        self.EVENT_HEIGHTMULT,
                                        self.column(32), self.line(14),
                                        self.width(15), self.height(1),
                                        self.heightmultFLT, 0.0, 10000.0,
                                        'Intended scale of height for the heightmap')

    self.heightscale = Draw.Number('XY-scale',
                             self.EVENT_HEIGHTSCALE,
                             self.column(32), self.line(15),
                             self.width(15), self.height(1),
                             self.heightscaleFLT, 0.0, 10000.0,
                             'Intended scale for the X and Y axis of the heightmap.')

    self.heightmap = Draw.PushButton('Import heightmap',
                                     self.EVENT_HEIGHTMAP,
                                     self.column(17), self.line(15),
                                     self.width(15), self.height(2),
                                     'Import heightmap for reference')

    self.exportlevel = Draw.PushButton('Export as level(s)',
                                       self.EVENT_EXPORTLEVEL,
                                       self.column(1), self.line(15),
                                       self.width(15), self.height(2),
                                       'Export scene(s) as level(s)')

    BGL.glRasterPos2d(self.column(1), self.line(17))
    Draw.Text('Model export options:')

    self.modelpath = Draw.String('Save model as: ',
                                 self.EVENT_MODELPATH,
                                 self.column(1), self.line(19),
                                 self.width(30), self.height(1),
                                 self.modelpathSTR, 399, 'File path for meshified model')

    self.setmodel = Draw.PushButton('Set model path',
                                    self.EVENT_SETMODEL,
                                    self.column(31), self.line(19),
                                    self.width(10), self.height(1),
                                    'Set another path for meshes')

    self.exportmodel = Draw.PushButton('Export as mesh(es)',
                                       self.EVENT_EXPORTMODEL,
                                       self.column(1), self.line(21),
                                       self.width(15), self.height(2),
                                       'Export each Group as a mesh')
开发者ID:RONNCC,项目名称:pysoy,代码行数:92,代码来源:soy_export.py


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