コード例 #1
0
ファイル: anvil_test.py プロジェクト: metehanboy/mcedit2
def testCopyRelight(anvilLevel, sourceLevel):
    destDim = anvilLevel.getDimension()
    exhaust(
        destDim.copyBlocksIter(sourceLevel.getDimension(),
                               BoundingBox((0, 0, 0), (
                                   32,
                                   64,
                                   32,
                               )), destDim.bounds.origin))
    anvilLevel.saveChanges()
コード例 #2
0
ファイル: anvil_test.py プロジェクト: shipbiulder101/mcedit2
def testCopyRelight(pc_world, schematic_world):
    destDim = pc_world.getDimension()
    exhaust(
        destDim.copyBlocksIter(schematic_world.getDimension(),
                               BoundingBox((0, 0, 0), (
                                   32,
                                   64,
                                   32,
                               )), destDim.bounds.origin))
    pc_world.saveChanges()
コード例 #3
0
ファイル: time_fill_ceiling.py プロジェクト: wcpe/mcedit2
def timeFillCeiling():
    temp = bench_temp_level("AnvilWorld")
    editor = temp
    dim = editor.getDimension()
    bounds = dim.bounds
    x, y, z = bounds.center
    y = 254
    x -= size // 2
    z -= size // 2
    bounds = BoundingBox((x, y, z), (size, 1, size))
    exhaust(dim.fillBlocksIter(bounds, editor.blocktypes["planks"]))
コード例 #4
0
def timeFillCeiling():
    temp = bench_temp_level("AnvilWorld")
    editor = temp
    dim = editor.getDimension()
    bounds = dim.bounds
    x, y, z = bounds.center
    y = 254
    x -= size//2
    z -= size//2
    bounds = BoundingBox((x, y, z), (size, 1, size))
    exhaust(dim.fillBlocksIter(bounds, editor.blocktypes["planks"]))
コード例 #5
0
ファイル: selection.py プロジェクト: Xelloss-HC/mcedit2
    def updateSelection(self):
        if self.dimension is None or self.selection is None:
            return

        selection = self.selection
        self.renderSelection = selection & NonAirMaskSelection(self.dimension, selection)
        self.groupNode.clear()
        self._loader = None
        if selection.chunkCount < 16:
            exhaust(self.loadSections())

            self.loadTimer.setInterval(333)
コード例 #6
0
ファイル: selection.py プロジェクト: hgroene/mcedit2
    def updateSelection(self):
        if self.dimension is None or self.selection is None:
            return

        selection = self.selection
        self.renderSelection = selection & NonAirMaskSelection(self.dimension, selection)
        self.groupNode.clear()
        self._loader = None
        if selection.chunkCount < 16:
            exhaust(self.loadSections())

            self.loadTimer.setInterval(333)
コード例 #7
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def exportSchematic(self, selection):
     """
     :type selection: mceditlib.box.BoundingBox
     :return:
     :rtype: WorldEditor
     """
     return exhaust(self.exportSchematicIter(selection))
コード例 #8
0
ファイル: worldeditor.py プロジェクト: nikitakit/mcedit2
 def exportSchematic(self, selection):
     """
     :type selection: mceditlib.box.BoundingBox
     :return:
     :rtype: WorldEditor
     """
     return exhaust(self.exportSchematicIter(selection))
コード例 #9
0
 def copyBlocks(self,
                sourceLevel,
                sourceSelection,
                destinationPoint,
                blocksToCopy=None,
                entities=True,
                create=False,
                biomes=False):
     return exhaust(
         self.copyBlocksIter(sourceLevel, sourceSelection, destinationPoint,
                             blocksToCopy, entities, create, biomes))
コード例 #10
0
ファイル: generate.py プロジェクト: wcpe/mcedit2
    def displaySchematic(self, schematic, offset):
        if schematic is not None:
            dim = schematic.getDimension()

            if self.worldScene:
                self.sceneHolderNode.removeChild(self.worldScene)
                self.loader.timer.stop()
                self.loader = None

            atlas = self.editorSession.textureAtlas
            self.worldScene = WorldScene(dim, atlas)
            self.sceneTranslate.translateOffset = offset
            self.sceneHolderNode.addChild(self.worldScene)

            self.loader = WorldLoader(self.worldScene)
            if dim.chunkCount() <= self.instantDisplayChunks:
                exhaust(self.loader.work())
            else:
                self.loader.startLoader()
        else:
            self.clearSchematic()
コード例 #11
0
ファイル: generate.py プロジェクト: hgroene/mcedit2
    def displaySchematic(self, schematic, offset):
        if schematic is not None:
            dim = schematic.getDimension()

            if self.worldScene:
                self.sceneHolderNode.removeChild(self.worldScene)
                self.loader.timer.stop()
                self.loader = None

            atlas = self.editorSession.textureAtlas
            self.worldScene = WorldScene(dim, atlas)
            self.sceneHolderNode.translateOffset = offset
            self.sceneHolderNode.addChild(self.worldScene)

            self.loader = WorldLoader(self.worldScene)
            if dim.chunkCount() <= self.instantDisplayChunks:
                exhaust(self.loader.work())
            else:
                self.loader.timer.start()
        else:
            self.clearSchematic()
コード例 #12
0
ファイル: worldeditor.py プロジェクト: Xelloss-HC/mcedit2
 def copyBlocks(
     self,
     sourceLevel,
     sourceSelection,
     destinationPoint,
     blocksToCopy=None,
     entities=True,
     create=False,
     biomes=False,
     updateLights=False,
 ):
     return exhaust(
         self.copyBlocksIter(
             sourceLevel, sourceSelection, destinationPoint, blocksToCopy, entities, create, biomes, updateLights
         )
     )
コード例 #13
0
ファイル: export.py プロジェクト: KevinKelley/mcedit2
def extractSchematicFrom(sourceDim, box, *a, **kw):
    """
    Extract a schematic from the given dimension within the given selection box. The
    minimum corner of the given box becomes the schematic's (0,0,0) coordinate.

    Parameters
    ----------
    sourceDim : WorldEditorDimension
    box : SelectionBox
    a :
    kw :

    Returns
    -------
    WorldEditor

    """
    return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
コード例 #14
0
ファイル: export.py プロジェクト: wcpe/mcedit2
def extractSchematicFrom(sourceDim, box, *a, **kw):
    """
    Extract a schematic from the given dimension within the given selection box. The
    minimum corner of the given box becomes the schematic's (0,0,0) coordinate.

    Parameters
    ----------
    sourceDim : WorldEditorDimension
    box : SelectionBox
    a :
    kw :

    Returns
    -------
    WorldEditor

    """
    return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
コード例 #15
0
ファイル: worldeditor.py プロジェクト: nikitakit/mcedit2
 def copyBlocks(self, *a, **kw):
     return exhaust(self.copyBlocksIter(*a, **kw))
コード例 #16
0
ファイル: worldeditor.py プロジェクト: nikitakit/mcedit2
 def syncToDisk(self):
     exhaust(self.syncToDiskIter())
コード例 #17
0
ファイル: worldeditor.py プロジェクト: nikitakit/mcedit2
 def saveChanges(self):
     exhaust(self.saveChangesIter())
コード例 #18
0
def showProgress(text, *tasks, **kwargs):
    """
    Show a progress dialog for the given task(s). Each task should be an iterable,
    yielding progress info as (current, max) or (current, max, statusString) tuples.
    Return the last value yielded by the task.

    :param text:
    :type text:
    :param iter:
    :type iter:
    :param cancel:
    :type cancel:
    :return:
    :rtype:
    """
    global _progressBarActive

    if _progressBarActive:
        for task in tasks:
            exhaust(task)
        return

    progress = None
    cancel = kwargs.pop('cancel', None)
    start = time.time()
    shown = False
    try:
        with LoaderTimer.stopCtx():

            dialog = MCEProgressDialog(QtGui.qApp.mainWindow)
            if not cancel:
                dialog.setCancelButtonText(None)
            dialog.setWindowTitle(text)
            dialog.setWindowModality(Qt.WindowModal)
            log.info("Starting progress: %d tasks." % len(tasks))
            totalMaximum = len(tasks) * 100
            for i, task in enumerate(tasks):
                log.info("Task #%d", i)
                task = rescaleProgress(task, i * 100, i * 100 + 100)
                for progress in task:
                    if isinstance(progress, basestring):
                        current = 0
                        maximum = 0
                        status = progress
                    elif isinstance(progress, tuple):
                        if len(progress) > 2:
                            current, maximum, status = progress[:3]
                        else:
                            current, maximum = progress
                            status = ""
                    else:
                        current = 0
                        maximum = 0
                        status = ""

                    dialog.setValue(current)
                    if maximum == 0:
                        # Task progress is indeterminate
                        dialog.setMaximum(0)
                    else:
                        dialog.setMaximum(totalMaximum)
                    dialog.setLabelText(status)
                    if time.time() > start + timeBeforeDialog:
                        if not shown:
                            dialog.show()
                            shown = True
                        QtGui.QApplication.processEvents()

                    if dialog.wasCanceled():
                        return False

            dialog.reset()
            return progress
    finally:
        _progressBarActive = False
コード例 #19
0
ファイル: selection.py プロジェクト: shipbiulder101/mcedit2
    def loadImmediateChunks(self):
        if self.selection.chunkCount < 16:
            exhaust(self.loadSections())

            self.loadTimer.setInterval(333)
コード例 #20
0
 def fillBlocks(self, box, block, blocksToReplace=(), updateLights=True):
     return exhaust(
         self.fillBlocksIter(box, block, blocksToReplace, updateLights))
コード例 #21
0
ファイル: time_fill.py プロジェクト: 101baja202/mcedit2
def timeFill():
    temp = TempLevel("AnvilWorld")
    editor = temp
    dim = editor.getDimension()
    editor.loadedChunkLimit = 1
    exhaust(dim.fillBlocksIter(dim.bounds, editor.blocktypes.OakWoodPlanks))
コード例 #22
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def commitUndo(self, revisionInfo=None):
     exhaust(self.commitUndoIter(revisionInfo))
コード例 #23
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def saveChanges(self):
     exhaust(self.saveChangesIter())
コード例 #24
0
ファイル: editorsession.py プロジェクト: EvilSupahFly/mcedit2
 def commitUndo(self):
     exhaust(self.commitUndoIter())
コード例 #25
0
ファイル: minecraft_server.py プロジェクト: wcpe/mcedit2
 def createLevel(self, level, box, simulate=False, **kw):
     return exhaust(self.createLevelIter(level, box, simulate, **kw))
コード例 #26
0
ファイル: export.py プロジェクト: 101baja202/mcedit2
def extractAnySchematic(level, box):
    return exhaust(level.extractAnySchematicIter(box))
コード例 #27
0
ファイル: export.py プロジェクト: 101baja202/mcedit2
def extractZipSchematicFrom(sourceLevel, box, zipfilename=None, entities=True):
    return exhaust(extractZipSchematicFromIter(sourceLevel, box, zipfilename, entities))
コード例 #28
0
ファイル: export.py プロジェクト: 101baja202/mcedit2
def extractSchematicFrom(sourceDim, box, entities=True):
    return exhaust(extractSchematicFromIter(sourceDim, box, entities))
コード例 #29
0
ファイル: selection.py プロジェクト: nkjcqvcpi/mcedit2
    def loadImmediateChunks(self):
        if self.selection.chunkCount < 16:
            exhaust(self.loadSections())

            self.loadTimer.setInterval(333)
コード例 #30
0
ファイル: minecraft_server.py プロジェクト: kissthink/mcedit2
 def generateChunksInLevel(self, level, chunks):
     return exhaust(self.generateChunksInLevelIter(level, chunks))
コード例 #31
0
def extractSchematicFrom(sourceDim, box, *a, **kw):
    return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
コード例 #32
0
ファイル: minecraft_server.py プロジェクト: kissthink/mcedit2
 def createLevel(self, level, box, simulate=False, **kw):
     return exhaust(self.createLevelIter(level, box, simulate, **kw))
コード例 #33
0
 def perform(self):
     if len(self.points) > 10:
         showProgress("Performing brush...", self._perform(), cancel=True)
     else:
         exhaust(self._perform())
コード例 #34
0
ファイル: minecraft_server.py プロジェクト: kissthink/mcedit2
 def generateAtPosition(self, tempWorld, tempDir, cx, cz):
     return exhaust(self.generateAtPositionIter(tempWorld, tempDir, cx, cz))
コード例 #35
0
ファイル: showprogress.py プロジェクト: KevinKelley/mcedit2
def showProgress(text, *tasks, **kwargs):
    """
    Show a progress dialog for the given task(s). Each task should be an iterable,
    yielding progress info as (current, max) or (current, max, statusString) tuples.
    Return the last value yielded by the task.

    :param text:
    :type text:
    :param iter:
    :type iter:
    :param cancel:
    :type cancel:
    :return:
    :rtype:
    """
    global _progressBarActive

    if _progressBarActive:
        for task in tasks:
            exhaust(task)
        return

    progress = None
    cancel = kwargs.pop('cancel', None)
    start = time.time()
    shown = False
    try:
        with LoaderTimer.stopCtx():

            dialog = MCEProgressDialog(QtGui.qApp.mainWindow)
            if not cancel:
                dialog.setCancelButtonText(None)
            dialog.setWindowTitle(text)
            dialog.setWindowModality(Qt.WindowModal)
            log.info("Starting progress: %d tasks." % len(tasks))
            totalMaximum = len(tasks) * 100
            for i, task in enumerate(tasks):
                log.info("Task #%d", i)
                task = rescaleProgress(task, i*100, i*100+100)
                for progress in task:
                    if isinstance(progress, basestring):
                        current = 0
                        maximum = 0
                        status = progress
                    elif isinstance(progress, tuple):
                        if len(progress) > 2:
                            current, maximum, status = progress[:3]
                        else:
                            current, maximum = progress
                            status = ""
                    else:
                        current = 0
                        maximum = 0
                        status = ""

                    dialog.setValue(current)
                    if maximum == 0:
                        # Task progress is indeterminate
                        dialog.setMaximum(0)
                    else:
                        dialog.setMaximum(totalMaximum)
                    dialog.setLabelText(status)
                    if time.time() > start + timeBeforeDialog:
                        if not shown:
                            dialog.show()
                            shown = True
                        QtGui.QApplication.processEvents()

                    if dialog.wasCanceled():
                        return False

            dialog.reset()
            return progress
    finally:
        _progressBarActive = False
コード例 #36
0
ファイル: worldeditor.py プロジェクト: nikitakit/mcedit2
 def commitUndo(self, revisionInfo=None):
     exhaust(self.commitUndoIter(revisionInfo))
コード例 #37
0
ファイル: export.py プロジェクト: nkjcqvcpi/mcedit2
def extractSchematicFrom(sourceDim, box, *a, **kw):
    return exhaust(extractSchematicFromIter(sourceDim, box, *a, **kw))
コード例 #38
0
ファイル: anvil_test.py プロジェクト: 101baja202/mcedit2
def testCopyRelight(anvilLevel, sourceLevel):
    destDim = anvilLevel.getDimension()
    exhaust(destDim.copyBlocksIter(sourceLevel.getDimension(), BoundingBox((0, 0, 0), (32, 64, 32,)),
            destDim.bounds.origin))
    anvilLevel.saveChanges()
コード例 #39
0
ファイル: minecraft_server.py プロジェクト: wcpe/mcedit2
 def generateAtPosition(self, tempWorld, tempDir, cx, cz):
     return exhaust(self.generateAtPositionIter(tempWorld, tempDir, cx, cz))
コード例 #40
0
ファイル: editorsession.py プロジェクト: Xelloss-HC/mcedit2
 def commitUndo(self):
     exhaust(self.commitUndoIter())
コード例 #41
0
ファイル: minecraft_server.py プロジェクト: wcpe/mcedit2
 def generateChunksInLevel(self, level, chunks):
     return exhaust(self.generateChunksInLevelIter(level, chunks))
コード例 #42
0
ファイル: __init__.py プロジェクト: nkjcqvcpi/mcedit2
 def perform(self):
     if len(self.points) > 10:
         showProgress("Performing brush...", self._perform(), cancel=True)
     else:
         exhaust(self._perform())
コード例 #43
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def syncToDisk(self):
     exhaust(self.syncToDiskIter())
コード例 #44
0
def extractSchematicFrom(sourceDim, box, entities=True):
    return exhaust(extractSchematicFromIter(sourceDim, box, entities))
コード例 #45
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def copyBlocks(self, *a, **kw):
     return exhaust(self.copyBlocksIter(*a, **kw))
コード例 #46
0
def extractZipSchematicFrom(sourceLevel, box, zipfilename=None, entities=True):
    return exhaust(
        extractZipSchematicFromIter(sourceLevel, box, zipfilename, entities))
コード例 #47
0
ファイル: worldeditor.py プロジェクト: pamunoz/mcedit2
 def fillBlocks(self, box, block, blocksToReplace=(), updateLights=True):
     return exhaust(self.fillBlocksIter(box, block, blocksToReplace, updateLights))
コード例 #48
0
def extractAnySchematic(level, box):
    return exhaust(level.extractAnySchematicIter(box))
コード例 #49
0
ファイル: time_fill.py プロジェクト: wcpe/mcedit2
def timeFill():
    temp = bench_temp_level("AnvilWorld")
    editor = temp
    dim = editor.getDimension()
    editor.loadedChunkLimit = 1
    exhaust(dim.fillBlocksIter(dim.bounds, editor.blocktypes.OakWoodPlanks))
コード例 #50
0
ファイル: anvil_test.py プロジェクト: nkjcqvcpi/mcedit2
def testCopyRelight(pc_world, schematic_world):
    destDim = pc_world.getDimension()
    exhaust(destDim.copyBlocksIter(schematic_world.getDimension(), BoundingBox((0, 0, 0), (32, 64, 32,)),
            destDim.bounds.origin))
    pc_world.saveChanges()