當前位置: 首頁>>代碼示例>>Python>>正文


Python DNAUtil.getBlockFromName方法代碼示例

本文整理匯總了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()
開發者ID:ponyboy837,項目名稱:SecretGitLolYoloSweg2015,代碼行數:29,代碼來源:DNAFlatBuilding.py

示例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()
開發者ID:ponyboy837,項目名稱:SecretGitLolYoloSweg2015,代碼行數:27,代碼來源:DNAFlatBuilding.py

示例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
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leak,代碼行數:17,代碼來源:DNADoor.py

示例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
開發者ID:AdrianF98,項目名稱:Toontown-Rewritten,代碼行數:8,代碼來源:DNALandmarkBuilding.py


注:本文中的DNAUtil.getBlockFromName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。