本文整理汇总了Python中DNAUtil.getBlockFromName方法的典型用法代码示例。如果您正苦于以下问题:Python DNAUtil.getBlockFromName方法的具体用法?Python DNAUtil.getBlockFromName怎么用?Python DNAUtil.getBlockFromName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DNAUtil
的用法示例。
在下文中一共展示了DNAUtil.getBlockFromName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateCogdoGeometry
# 需要导入模块: import DNAUtil [as 别名]
# 或者: from DNAUtil import getBlockFromName [as 别名]
def generateCogdoGeometry(self, storage, np, height, barrier):
node = np.getParent().attachNewNode('cb' + self.id[2:])
node.setTransform(np.getTransform())
barrier.copyTo(node)
block = DNAUtil.getBlockFromName(self.id)
x = int(np.getX())
y = int(np.getY())
seed = block*1231 + x*83 + y
codes = storage.getNumCatalogCodes('cogdo_wall')
if codes != 0:
wallCode = storage.getCatalogCode('cogdo_wall', seed%codes)
wall = storage.findNode(wallCode)
else:
wall = None
if wall:
wallNode = wall.copyTo(node)
wallNode.setScale(self.width, 1, height)
for door in DNAUtil.getChildrenOfType(self, DNAFlatDoor):
door.generateSuitGeometry(storage, wallNode)
node.flattenStrong()
node.stash()
示例2: _postGenerate
# 需要导入模块: import DNAUtil [as 别名]
# 或者: from DNAUtil import getBlockFromName [as 别名]
def _postGenerate(self, storage, np):
height = np.getPythonTag('wall_height') or 0.0
np.clearPythonTag('wall_height')
# First, set up collisions. We need a (self.width, height)-sized square.
barrierNode = storage.findNode('wall_camera_barrier')
if not barrierNode:
raise DNAError('No wall_camera_barrier in storage.')
barrier = barrierNode.copyTo(np)
barrier.setScale(self.width, 1, height)
type = DNAUtil.getBuildingClassFromName(self.id)
if type == 'tb':
self.generateSuitGeometry(storage, np, height, barrier)
self.generateCogdoGeometry(storage, np, height, barrier)
# We need to set collisions on all of our knock knock doors:
block = DNAUtil.getBlockFromName(self.name)
if block is not None:
for collisionNP in np.findAllMatches('**/door_*/+CollisionNode'):
collisionNP.setName('KnockKnockDoorSphere_%d' % block)
# Finally, flatten down:
np.flattenStrong()
示例3: _makeNode
# 需要导入模块: import DNAUtil [as 别名]
# 或者: from DNAUtil import getBlockFromName [as 别名]
def _makeNode(self, storage, parent):
frontNode = parent.find('**/*building*_front')
if frontNode.isEmpty():
frontNode = parent.find('**/*_front')
if not frontNode.getNode(0).isGeomNode():
frontNode = frontNode.find('**/+GeomNode')
frontNode.setEffect(DecalEffect.make())
node = storage.findNode(self.code)
if node is None:
pass
doorNode = node.copyTo(frontNode, 0)
origin = parent.find('**/*door_origin')
origin.node().setPreserveTransform(ModelNode.PTNet)
self.setupDoor(doorNode, parent, origin, storage, DNAUtil.getBlockFromName(parent.getName()), self.getColor())
return doorNode
示例4: _storeData
# 需要导入模块: import DNAUtil [as 别名]
# 或者: from DNAUtil import getBlockFromName [as 别名]
def _storeData(self, data):
block = data.getBlock(DNAUtil.getBlockFromName(self.id))
block.title = self.getTitle()
block.buildingType = self.type
block.zone = self.getVisGroup().getZone()
block.node = self