• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python cf.BaseEditMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

 def __init__(self, _logic):
     BaseEditMode.__init__(self, _logic, "Geometry edit")
     
     # last scroll position
     self.last_scroll_pos = None
     
     # grid align mode
     self.grid_align = True
     self.mouse_pos = (0, 0)
     self.objectInfoPanel = geom_controls.ObjectInfoPanel()
     
     # objects we works with
     self.highlighted_obj = None
     # current edit state
     self.state = GeometryEditMode.ES_None
     # current object we worked with
     self.active_object = None
     # candidate object to be processed with mouse
     self.candidate_object = None
     # line creation mode
     self.__pointSpirit = GeometryPoint()
     self.__pointSpirit.setState(Object.OS_Normal)
     self.__pointSpirit.setScale(ogre.Vector3(0.5, 0.5, 0.5))
     self.__lineSpirit = GeometryLineSection()
     self.__lineSpirit.setState(Object.OS_Normal)        
     self.__lineSpirit.setEnd(self.__pointSpirit) 
     self.__lineBegin = None
开发者ID:aifabregaz,项目名称:pyUI,代码行数:27,代码来源:geom_modes.py


示例2: _unselectObject

 def _unselectObject(self, _object):
     BaseEditMode._unselectObject(self, _object)
     
     selected = self._logic._getSheet().getSelected()
     if len(selected) > 0:
         self.objectInfoPanel.setObject(selected[-1])
     else:
         self.objectInfoPanel.setObject(None)
开发者ID:aifabregaz,项目名称:pyUI,代码行数:8,代码来源:geom_modes.py


示例3: _onKeyReleased

 def _onKeyReleased(self, _evt):
     """Key released event
     """
     BaseEditMode._onKeyReleased(self, _evt)
     
     key = _evt.key
     
     if key == ois.KC_LSHIFT:
         self._shift = False
            
     return False
开发者ID:Okne,项目名称:ymapostis,代码行数:11,代码来源:scg_modes.py


示例4: __init__

    def __init__(self, _logic):
        BaseEditMode.__init__(self, _logic, "Edit mode")
        
        # mouse objects for line creation mode
        self.line_mode_beg = None
        self.line_mode_obj = scg_alphabet.createSCgNode('mnode')
        self.line_mode_obj.setScale(ogre.Vector3(0.1, 0.1, 0.1))
        self.line_mode_obj.setPosition(ogre.Vector3(0, 0, 0))
        self.line_mode_line = scg_alphabet.createSCgPair('mpair')
        self.line_mode_line.setEnd(self.line_mode_obj)
        self.line_mode_line.setState(objects.Object.OS_Normal)
        # highlighted object
        self.highlighted_obj = None
        
        # widgets
        self.type_combo = None
        self.content_combo = None
        
        # object we worked on in current state
        self.object_active = None
        # current editor state
        self.state = SCgEditMode.ES_None
        # current mouse position
        self.mouse_pos = (0, 0)
        
        # visual menu
#        self.vis_menu = None
#        self._createVisualMenu()
        
        # 3d navigation mode
        self.rotX = 0.0 
        self.rotY = 0.0
        self.move = ogre.Vector3(0.0, 0.0, 0.0)
        self.moveSpeed = 5.0
        self.moveScale = 5.0
        
        self.animationState = None
        
        # tool bar
#        self.toolbar = ToolBar()
#        self.toolbar.setVisible(False)
#        self.toolbar.setEnabled(True)
#        for idx in xrange(self.EM_Count):
#            button = self.toolbar.appendButton("", "scg_toolbar_icons.png", idx, (32, 32), (0, 0, 256, 32))
#            button.setCheckable(True)
#            button.setUserData(idx)
#            button.eventPush = self._onToolBarButtonPush
#            
#        self.toolbar.setButtonSize(38)

        #contour points
        self.contour_points = []
        self.contour_lines = []
开发者ID:Prokopenko,项目名称:pyUI,代码行数:53,代码来源:scg_modes.py


示例5: __init__

 def __init__(self, _logic):
     BaseEditMode.__init__(self, _logic)
     
     self.mouse_pos = (0, 0)
     # objects we works with
     self.highlighted_obj = None
     
     # 3d navigation mode
     self.rotX = 0.0 
     self.rotY = 0.0
     self.move = ogre.Vector3(0.0, 0.0, 0.0)
     self.moveSpeed = 15.0
     self.moveScale = 1.0
     self.navigation = False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:14,代码来源:chem_modes.py


示例6: delete

    def delete(self):
        """Deletion message
        """
        BaseEditMode.delete(self)
        
#        self.vis_menu.delete()
        
        self.line_mode_beg = None
        
        self.line_mode_line.delete()
        self.line_mode_line = None
        self.line_mode_obj.delete()
        self.line_mode_obj = None
        
        self.object_active = None
开发者ID:Okne,项目名称:ymapostis,代码行数:15,代码来源:scg_modes.py


示例7: _onMouseMoved

 def _onMouseMoved(self, _evt):
     """Mouse moved notification event
     """
     if BaseEditMode._onMouseMoved(self, _evt):  return True
   
     mstate = _evt.get_state()
     mpos = self._getMousePos(mstate)
     self.mouse_pos = (mstate.X.abs, mstate.Y.abs)
     
     if self.state is GeometryEditMode.ES_Move:
         self.active_object.setPosition(render_engine.pos2dTo3dIsoPos(mpos))
         return True
     
     elif self.state is GeometryEditMode.ES_LineCreate:
         self.__pointSpirit.setPosition(render_engine.pos2dTo3dIsoPos(mpos))
         self._updateLineSpirits()
         self._highlight()
         return True
     elif self.state is GeometryEditMode.ES_CircleCreate:
         radius = self.active_object.getPosition().distance(render_engine.pos2dTo3dIsoPos(mpos))
         self.active_object.setRadius(radius)
     
     self._highlight()
     
     return False
开发者ID:aifabregaz,项目名称:pyUI,代码行数:25,代码来源:geom_modes.py


示例8: _onMouseReleased

 def _onMouseReleased(self, _evt, _id):
     """Mouse button released event
     """
     if BaseEditMode._onMouseReleased(self, _evt, _id):  return True
     
     if _id == ois.MB_Left and self.navigation:
         self.navigation = False
     
     return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:9,代码来源:chem_modes.py


示例9: _onKeyReleased

    def _onKeyReleased(self, _evt):
        """Key released event
        """
        BaseEditMode._onKeyReleased(self, _evt)
        
        key = _evt.key
        
        if key == ois.KC_LSHIFT:
            self._shift = False
            
        elif key == ois.KC_B:
            if self.state == SCgEditMode.ES_BusCreate:
                sheet = self._logic._getSheet()
                render_engine.SceneNode.removeChild(sheet.sceneNodeChilds, self.line_mode_line.sceneNode)
                self.line_mode_line.setBegin(None)
                self.line_mode_beg = None

                self.state = SCgEditMode.ES_None
               
        return False
开发者ID:herasimchuk-aa,项目名称:pyUI,代码行数:20,代码来源:scg_modes.py


示例10: __init__

 def __init__(self, _logic):
     BaseEditMode.__init__(self, _logic, "Graph edit")
     
     # last scroll position
     self.last_scroll_pos = None
     
     # grid align mode
     self.mouse_pos = (0, 0)
     
     # objects we works with
     self.highlighted_obj = None
     # current edit state
     self.state = GraphEditMode.ES_None
     # current object we worked with
     self.active_object = None
     # line creation mode
     self.__pointSpirit = GraphVertex()
     self.__pointSpirit.setState(Object.OS_Normal)
     self.__pointSpirit.setScale(ogre.Vector3(0.5, 0.5, 0.5))
     self.__lineSpirit = GraphLink()
     self.__lineSpirit.setState(Object.OS_Normal)        
     self.__lineSpirit.setEnd(self.__pointSpirit) 
     self.__lineBegin = None
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:23,代码来源:graph_modes.py


示例11: __init__

    def __init__(self, _logic):
        BaseEditMode.__init__(self, _logic, "Edit mode")
        
        # mouse objects for line creation mode
        self.line_mode_beg = None
        self.line_mode_obj = scg_alphabet.createSCgNode('mnode')
        self.line_mode_obj.setScale(ogre.Vector3(0.1, 0.1, 0.1))
        self.line_mode_obj.setPosition(ogre.Vector3(0, 0, 0))
        self.line_mode_line = scg_alphabet.createSCgPair('mpair')
        self.line_mode_line.setEnd(self.line_mode_obj)
        self.line_mode_line.setState(objects.Object.OS_Normal)
        # highlighted object
        self.highlighted_obj = None
        
        # widgets
        self.type_combo = None
        self.content_combo = None
        
        # object we worked on in current state
        self.object_active = None
        # current editor state
        self.state = SCgEditMode.ES_None
        # current mouse position
        self.mouse_pos = (0, 0)
        
        # visual menu
#        self.vis_menu = None
#        self._createVisualMenu()
        
        # 3d navigation mode
        self.rotX = 0.0 
        self.rotY = 0.0
        self.move = ogre.Vector3(0.0, 0.0, 0.0)
        self.moveSpeed = 5.0
        self.moveScale = 5.0
        
        self.animationState = None
开发者ID:Okne,项目名称:ymapostis,代码行数:37,代码来源:scg_modes.py


示例12: _onMouseMoved

 def _onMouseMoved(self, _evt):
     """Mouse moved event
     """
     
     if BaseEditMode._onMouseMoved(self, _evt):  return True
     mstate = _evt.get_state()
     self.mouse_pos = (mstate.X.abs, mstate.Y.abs)
     
     self._highlight()
     
     if self.navigation:
         self.rotX = ogre.Degree(-mstate.X.rel * 0.13)
         self.rotY = ogre.Degree(-mstate.Y.rel * 0.13)
     
     return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:15,代码来源:chem_modes.py


示例13: _onKeyPressed

    def _onKeyPressed(self, _evt):
        """Keyboard button pressed event
        """
        if BaseEditMode._onKeyPressed(self, _evt):  return True
        
        if _evt.key == ois.KC_F9:
            
            if render_engine.viewMode is render_engine.Mode_Isometric:
                self._logic._getSheet().changeMode(render_engine.Mode_Perspective)
            else:
                self._logic._getSheet().changeMode(render_engine.Mode_Isometric)
            self.navigation = False
            
        # create link between objects    
        if _evt.key == ois.KC_SPACE:
            _args = self._logic._getSheet().getSelected()
            if len(_args) == 2 and isinstance(_args[0], chem_objects.ChemistryAtom) and isinstance(_args[1], chem_objects.ChemistryAtom):
                self._logic.addLink(_args[0], _args[1])
                
        # create random element
        if _evt.key == ois.KC_F1:
            import random
            atoms_num = random.randint(50, 100)
            links_num = random.randint(0, atoms_num)
            names = self.type_bindings.values()
            atoms = []
            for a in xrange(atoms_num):
                _atom = self._logic.addAtom(ogre.Vector3(float(random.randint(-10, 10)), float(random.randint(-10, 10)), 0.0), 'C')
                if len(atoms) > 0:
                    a1 = random.randint(0, len(atoms) - 1)
                    self._logic.addLink(atoms[a1], _atom)
                    
                atoms.append(_atom)
                
#            for l in xrange(links_num):
#                a1 = random.randint(0, atoms_num - 1)
#                a2 = random.randint(0, atoms_num - 1)
#                while a1 == a2:
#                    a2 = random.randint(0, atoms_num - 1)
#                self._logic.addLink(atoms[a1], atoms[a2])
        
        # test type changing
        if self.type_bindings.has_key(_evt.key):
            self.setSelectionName(self.type_bindings[_evt.key])
        
        
        return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:47,代码来源:chem_modes.py


示例14: _onMouseReleased

    def _onMouseReleased(self, _evt, _id):
        """Event on mouse button released
        """
        if BaseEditMode._onMouseReleased(self, _evt, _id):  return True
        
        mstate = _evt.get_state()
        mpos = self._getMousePos(mstate)
        
        if _id == ois.MB_Left:
            
            # moving state finishing
            if self.state is GeometryEditMode.ES_Move:
                self.state = GeometryEditMode.ES_None
#                self._selectObject(self.active_object)
                self.active_object = None                
        
        return False
开发者ID:aifabregaz,项目名称:pyUI,代码行数:17,代码来源:geom_modes.py


示例15: _onMousePressed

 def _onMousePressed(self, _evt, _id):
     """Mouse button pressed event
     """
     if BaseEditMode._onMousePressed(self, _evt, _id):   return True
     
     # getting objects under mouse
     mobjects = self._logic._getSheet()._getObjectsUnderMouse(True, True, self.mouse_pos)
     
     if _id == ois.MB_Right:
         if len(mobjects) == 0:
             if render_engine.viewMode is render_engine.Mode_Perspective:
                 self._logic.addAtom(render_engine.pos2dToViewPortRay(self.mouse_pos).getPoint(10.0), "H")
             else:
                 self._logic.addAtom(render_engine.pos2dTo3dIsoPos(self.mouse_pos), "H")
              
      
     elif _id == ois.MB_Left:
         if len(mobjects) > 0:
             self._selectObject(mobjects[0][1])
         else:
             if render_engine.viewMode is render_engine.Mode_Perspective:
                 self.navigation = True
     
     return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:24,代码来源:chem_modes.py


示例16: _onMousePressed

    def _onMousePressed(self, _evt, _id):
        """Event on mouse button pressed
        """
        if BaseEditMode._onMousePressed(self, _evt, _id):   return True
        
        mstate = _evt.get_state()
        original_mpos = (mstate.X.abs, mstate.Y.abs)
        mpos = self._getMousePos(mstate)

        # getting objects under mouse
        mobjects = self._logic._getSheet()._getObjectsUnderMouse(True, True, self.mouse_pos)

        if _id == ois.MB_Right:
            # none any mode
            if self.state is GeometryEditMode.ES_None:
                # creating point if there is no any objects under mouse
                if len(mobjects) is 0:
                    obj = self._logic.createPoint(mpos)
                    sheet = self._logic._getSheet()
                    sheet.addChild(obj)
                    return True
                else:
                    # get line sections
                    line = comutils._getFirstObjectTypeFromList(mobjects, [GeometryLineSection, GeometryCircle])
                    if line is not None:
                        # create point
                        point = self._logic.createPoint(original_mpos)
                        sheet = self._logic._getSheet()
                        sheet.addChild(point)
                        
                        # append it into line section
                        line.addPoint(point, line._calculatePointRelPosition(render_engine.pos2dTo3dIsoPos(original_mpos)))
                        
                        self.objectInfoPanel.update()
                        return True
                    
                    obj = comutils._getFirstObjectTypeFromList(mobjects, [GeometryPoint])
                    if obj is not None:
                        self.state = GeometryEditMode.ES_LineCreate
                        self.__lineSpirit.setBegin(obj)
                        sheet = self._logic._getSheet()
                        sheet.sceneNodeChilds.addChild(self.__lineSpirit.sceneNode)
                        sheet.sceneNodeChilds.addChild(self.__pointSpirit.sceneNode)
                        self.__lineBegin = obj
                        self.__pointSpirit.setPosition(render_engine.pos2dTo3dIsoPos(mpos))
                        self._updateLineSpirits()
                        
                        self.objectInfoPanel.update()
                        return True
            # on line creation mode finishing line
            elif self.state is GeometryEditMode.ES_LineCreate:
                obj = comutils._getFirstObjectTypeFromList(mobjects, [GeometryPoint])
                sheet = self._logic._getSheet()
                if obj is not None:
                    # creating line
                    line = self._logic.createLineSection(self.__lineBegin, obj)
                    sheet.addChild(line)
                    
                # removing state
                self.state = GeometryEditMode.ES_None
                sheet.sceneNodeChilds.removeChild(self.__lineSpirit.sceneNode)
                sheet.sceneNodeChilds.removeChild(self.__pointSpirit.sceneNode)
                self.__lineBegin = None
                    
            
        elif _id == ois.MB_Left:
            # if there is an any object under mouse, then starts moving
            if len(mobjects) > 0 and self.state is GeometryEditMode.ES_None:
                if self.candidate_object is not None and self.candidate_object._getSelected() and not self._shift:
                    self._unselectObject(self.candidate_object)
                self._next_candidate()
                self.active_object = self.candidate_object#comutils._getFirstObjectTypeFromList(mobjects, [GeometryPoint])
                if self.active_object is not None:
                    self.state = GeometryEditMode.ES_Move
                    self._selectObject(self.active_object)
                else:
                    # selecting first object under mouse
                    self._selectObject(mobjects[0][1])
                
                return True
            elif self.state is GeometryEditMode.ES_CircleCreate:
                
                _point = comutils._getFirstObjectTypeFromList(mobjects, [GeometryPoint])
                if _point is not None:
                    self.active_object.setRadiusPoint(_point)
                
                self.active_object = None
                self.state = GeometryEditMode.ES_None
            
        return False
开发者ID:aifabregaz,项目名称:pyUI,代码行数:90,代码来源:geom_modes.py


示例17: _onMousePressed

    def _onMousePressed(self, _evt, _id):
        """Event on mouse button pressed
        """
        if BaseEditMode._onMousePressed(self, _evt, _id):   return True
        
        mstate = _evt.get_state()
        mpos = self._getMousePos(mstate)

        # getting objects under mouse
        mobjects = self._logic._getSheet()._getObjectsUnderMouse(True, True, self.mouse_pos)

        if _id == ois.MB_Right:
            # none any mode
            if self.state is GraphEditMode.ES_None:
                # creating point if there is no any objects under mouse
                if len(mobjects) is 0:
                    obj = self._logic.createVertex(mpos)
                    sheet = self._logic._getSheet()
                    sheet.addChild(obj)
                    return True
                else:
                    obj = comutils._getFirstObjectTypeFromList(mobjects, [GraphVertex])
                    if obj is not None:
                        self.state = GraphEditMode.ES_LineCreate
                        self.__lineSpirit.setBegin(obj)
                        sheet = self._logic._getSheet()
                        sheet.sceneNodeChilds.addChild(self.__lineSpirit.sceneNode)
                        sheet.sceneNodeChilds.addChild(self.__pointSpirit.sceneNode)
                        self.__lineBegin = obj
                        self.__pointSpirit.setPosition(render_engine.pos2dTo3dIsoPos(mpos))
                        self._updateLineSpirits()
                        return True
            # on line creation mode finishing line
            elif self.state is GraphEditMode.ES_LineCreate:
                obj = comutils._getFirstObjectTypeFromList(mobjects, [GraphVertex])
                sheet = self._logic._getSheet()
                if obj is not None:
                    # creating line
                    line = self._logic.createLink(self.__lineBegin, obj)
                    sheet.addChild(line)
                    
                # removing state
                self.state = GraphEditMode.ES_None
                sheet.sceneNodeChilds.removeChild(self.__lineSpirit.sceneNode)
                sheet.sceneNodeChilds.removeChild(self.__pointSpirit.sceneNode)
                self.__lineBegin = None
                    
            
        elif _id == ois.MB_Left:
            # if there is an any object under mouse, then starts moving
            if len(mobjects) > 0 and self.state is GraphEditMode.ES_None:
                self.active_object = comutils._getFirstObjectTypeFromList(mobjects, [GraphVertex])
                if self.active_object is not None:
                    self.state = GraphEditMode.ES_Move
                    self._selectObject(self.active_object)
                else:
                    # selecting first object under mouse
                    self.active_object = comutils._getFirstObjectTypeFromList(mobjects, [GraphLink])
                    self._selectObject(mobjects[0][1])
                
                
                return True
            
        return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:64,代码来源:graph_modes.py


示例18: _onKeyPressed

 def _onKeyPressed(self, _evt):
     """Event on key pressed
     """
     if BaseEditMode._onKeyPressed(self, _evt):  return True
             
     return False
开发者ID:Alexandra-H,项目名称:pyUI,代码行数:6,代码来源:graph_modes.py


示例19: _selectObject

 def _selectObject(self, _object):
     BaseEditMode._selectObject(self, _object)
     
     self.objectInfoPanel.setObject(_object)
开发者ID:aifabregaz,项目名称:pyUI,代码行数:4,代码来源:geom_modes.py


示例20: _onRootChanged

 def _onRootChanged(self, _isRoot):
     BaseEditMode._onRootChanged(self, _isRoot)
     self.objectInfoPanel.setVisible(_isRoot)
开发者ID:aifabregaz,项目名称:pyUI,代码行数:3,代码来源:geom_modes.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cf.BaseModeLogic类代码示例发布时间:2022-05-27
下一篇:
Python util.timestamp_to_elapsed_string函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap