本文整理匯總了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()