Пример #1
0
    def confirmImport(self):
        if self.currentImport is None:
            return

        command = MoveFinishCommand(self, self.currentImport)
        destDim = self.editorSession.currentDimension
        with command.begin():
            log.info("Move: starting")
            if self.currentImport.isMove:
                sourceDim = self.currentImport.importDim
                destBox = BoundingBox(self.currentImport.importPos,
                                      sourceDim.bounds.size)

                # Use intermediate schematic only if source and destination overlap.
                if sourceDim.bounds.intersect(destBox).volume:
                    log.info("Move: using temporary")
                    export = extractSchematicFromIter(
                        sourceDim, self.currentImport.selection)
                    schematic = showProgress(self.tr("Copying..."), export)
                    sourceDim = schematic.getDimension()

            else:
                # Use source as-is
                sourceDim = self.currentImport.importDim

            # Copy to destination
            log.info("Move: copying")
            task = destDim.copyBlocksIter(
                sourceDim,
                sourceDim.bounds,
                self.currentImport.importPos,
                biomes=True,
                create=True,
                copyAir=self.copyAirCheckbox.isChecked())

            showProgress(self.tr("Pasting..."), task)

            log.info("Move: clearing")
            # Clear source
            if self.currentImport.isMove:
                fill = destDim.fillBlocksIter(self.currentImport.selection,
                                              "air")
                showProgress(self.tr("Clearing..."), fill)

        self.editorSession.pushCommand(command)
Пример #2
0
    def confirmImport(self):
        if self.currentImport is None:
            return

        command = MoveFinishCommand(self, self.currentImport)
        destDim = self.editorSession.currentDimension
        with command.begin():
            log.info("Move: starting")
            if self.currentImport.isMove:
                sourceDim = self.currentImport.importDim
                destBox = BoundingBox(self.currentImport.importPos, sourceDim.bounds.size)

                # Use intermediate schematic only if source and destination overlap.
                if sourceDim.bounds.intersect(destBox).volume:
                    log.info("Move: using temporary")
                    export = extractSchematicFromIter(sourceDim, self.currentImport.selection)
                    schematic = showProgress(self.tr("Copying..."), export)
                    sourceDim = schematic.getDimension()

            else:
                # Use source as-is
                sourceDim = self.currentImport.importDim

            # Copy to destination
            log.info("Move: copying")
            task = destDim.copyBlocksIter(sourceDim, sourceDim.bounds,
                                          self.currentImport.importPos,
                                          biomes=True, create=True,
                                          copyAir=self.copyAirCheckbox.isChecked())

            showProgress(self.tr("Pasting..."), task)

            log.info("Move: clearing")
            # Clear source
            if self.currentImport.isMove:
                fill = destDim.fillBlocksIter(self.currentImport.selection, "air")
                showProgress(self.tr("Clearing..."), fill)

        self.editorSession.pushCommand(command)
Пример #3
0
    def getSourceForDim(self, destDim):
        if destDim is self.sourceDim:
            sourceDim = self.importDim
            destBox = self.importBounds

            if self.transformedDim is not None:
                sourceBounds = sourceDim.bounds
            else:
                sourceBounds = self.selection
            # Use intermediate schematic only if source and destination overlap.
            if sourceBounds.intersect(destBox).volume:
                log.info("Move: using temporary")
                export = extractSchematicFromIter(sourceDim, self.selection)
                schematic = showProgress(self.tr("Copying..."), export)
                tempDim = schematic.getDimension()
                return tempDim, tempDim.bounds

        # Use source as-is
        if self.transformedDim is not None:
            selection = self.transformedDim.bounds
        else:
            selection = self.selection
        return self.importDim, selection
Пример #4
0
    def getSourceForDim(self, destDim):
        if destDim is self.sourceDim:
            sourceDim = self.importDim
            destBox = self.importBounds

            if self.transformedDim is not None:
                sourceBounds = sourceDim.bounds
            else:
                sourceBounds = self.selection
            # Use intermediate schematic only if source and destination overlap.
            if sourceBounds.intersect(destBox).volume:
                log.info("Move: using temporary")
                export = extractSchematicFromIter(sourceDim, self.selection)
                schematic = showProgress(self.tr("Copying..."), export)
                tempDim = schematic.getDimension()
                return tempDim, tempDim.bounds

        # Use source as-is
        if self.transformedDim is not None:
            selection = self.transformedDim.bounds
        else:
            selection = self.selection
        return self.importDim, selection