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


Python CommonFilters.cleanup方法代码示例

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


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

示例1: Dockit

# 需要导入模块: from direct.filter.CommonFilters import CommonFilters [as 别名]
# 或者: from direct.filter.CommonFilters.CommonFilters import cleanup [as 别名]

#.........这里部分代码省略.........
            r.setScale(4.0 / Dockit.radius_scale)
            r.setColor(LVecBase4f(1.0, 0.59, 0.0, 1.0))
            r.setColorScale(LVecBase4f(1, 1, 1, 1))
            r.reparentTo(node)
        node.flattenStrong()
        
        
    def apply_color(self, a3d, atom, color_map):
        ''' Apply a color map to the element '''
        if isinstance(color_map, BFactor):
            color = color_map.get_color_by_bfactor(atom.get_b_factor())
        else:
            color = color_map.get_color_by_element(atom.get_element())
        red, green, blue, alpha = color.get_rgba() 
        a3d.setColor(LVecBase4f(red, green, blue, alpha))
        a3d.setColorScale(LVecBase4f(1, 1, 1, 1))
    
    
    def toggle_cartoon(self):
        ''' Use Cartoon ink filter '''
        self.cartoon = not self.cartoon
        if self.cartoon:
            tempnode = NodePath(PandaNode("temp node"))
            tempnode.setAttrib(LightRampAttrib.makeSingleThreshold(0.4, 0.6))
            tempnode.setShaderAuto()
            base.cam.node().setInitialState(tempnode.getState())
            self.separation = 1.3 # Pixels
            self.filters = CommonFilters(base.win, base.cam)
            self.filters.setCartoonInk(separation=self.separation)
            # Currently using MAuto antialias, uncomment to use different
            #render.setAntialias(AntialiasAttrib.MBetter)
            #self.filters.finalQuad.setAntialias(AntialiasAttrib.MBetter)
        else:
            self.filters.cleanup()
            base.cam.node().setInitialState(self.alight.getState())
    
    
    def toggle_control_structures(self):
        ''' Show control structures as lights and center nodes and bounds if required '''
        self.structures = not self.structures
        for light in self.lights:
            if not self.structures:
                light.detachNode()
            else:
                light.reparentTo(render)
        
        if self.structures:
            self.receptor_node.showBounds()
            self.ligand_node.showBounds()
            self.center.reparentTo(render)
            print "Number of multisamples available: %d" % self.multisamples
        else:
            self.receptor_node.hideBounds()
            self.ligand_node.hideBounds()
            self.center.detachNode()
    
    
    def center_proteins(self):
        ''' Move receptor and ligand to a centered position depending on its size '''
        # Center the receptor
        receptor_radius = self.receptor_node.getBounds().getRadius()
        receptor_center = self.receptor_node.getBounds().getCenter()
        self.receptor_node.setPos(0,receptor_radius,0)
        
        # Center the ligand
        ligand_radius = self.ligand_node.getBounds().getRadius()
开发者ID:brianjimenez,项目名称:dockit,代码行数:70,代码来源:dockit.py


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