コード例 #1
0
        self.names = []
        iterator = OpenMaya.MItDependencyNodes()
        while not iterator.isDone():
            obj = iterator.thisNode()
            self.names.append(OpenMaya.MFnDependencyNode(obj).name())
            iterator.next()

        self.paths = []
        iterator = OpenMaya.MItDag()
        iterator.traverseUnderWorld(True)
        dagPath = OpenMaya.MDagPath()
        while not iterator.isDone():
            iterator.getPath(dagPath)
            self.paths.append(dagPath.fullPathName())
            iterator.next()

    def benchBnMatchFullName(self):
        match = OpenMaya.MGlobal.bnMakeMatchFullNameFunction('*Shape*')
        for name in self.names:
            match(name)

    def benchBnMatchFullPath(self):
        match = OpenMaya.MGlobal.bnMakeMatchFullPathFunction('*|*Shape*')
        for path in self.paths:
            match(path)


if __name__ == '__main__':
    from benchmarks.run import run
    run('__main__')
コード例 #2
0
    @classmethod
    def setUpClass(cls):
        OpenMaya.MFileIO.newFile(True)
        revl.run(benchmarks._preset.DEEP, 10000, seed=1.23)

    def benchBnFind1(self):
        for _ in OpenMaya.MFnDependencyNode.bnFind():
            pass

    def benchBnFind2(self):
        for _ in OpenMaya.MFnDependencyNode.bnFind(pattern='*'):
            pass

    def benchBnFind3(self):
        for _ in OpenMaya.MFnDependencyNode.bnFind(pattern='*Shape*'):
            pass

    def benchBnFind4(self):
        for _ in OpenMaya.MFnDependencyNode.bnFind(pattern='*:*Shape*'):
            pass

    def benchBnFind5(self):
        for _ in OpenMaya.MFnDependencyNode.bnFind(pattern='node'):
            pass


if __name__ == '__main__':
    from benchmarks.run import run
    run('__main__')