PendingImport uses the correct bounds for extracting temp schematics, and returns the source selection for imports

This commit is contained in:
David Vierra 2015-10-14 06:01:56 -10:00
parent 6f9583a741
commit 169de72a74
3 changed files with 15 additions and 7 deletions

View File

@ -303,9 +303,9 @@ class CloneTool(EditorTool):
for clone in self.pendingClones:
# TODO don't use intermediate schematic...
destDim = self.editorSession.currentDimension
dim = clone.getSourceForDim(destDim)
dim, selection = clone.getSourceForDim(destDim)
task = destDim.copyBlocksIter(dim, dim.bounds, clone.importPos,
task = destDim.copyBlocksIter(dim, selection, clone.importPos,
biomes=True, create=True, copyAir=False)
tasks.append(task)

View File

@ -226,11 +226,11 @@ class MoveTool(EditorTool):
destDim = self.editorSession.currentDimension
with command.begin():
log.info("Move: starting")
sourceDim = self.currentImport.getSourceForDim(destDim)
sourceDim, selection = self.currentImport.getSourceForDim(destDim)
# Copy to destination
log.info("Move: copying")
task = destDim.copyBlocksIter(sourceDim, sourceDim.bounds,
task = destDim.copyBlocksIter(sourceDim, selection,
self.currentImport.importPos,
biomes=True, create=True,
copyAir=self.copyAirCheckbox.isChecked())

View File

@ -415,15 +415,23 @@ class PendingImport(QtCore.QObject):
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 sourceDim.bounds.intersect(destBox).volume:
if sourceBounds.intersect(destBox).volume:
log.info("Move: using temporary")
export = extractSchematicFromIter(sourceDim, self.importBounds)
export = extractSchematicFromIter(sourceDim, self.selection)
schematic = showProgress(self.tr("Copying..."), export)
return schematic.getDimension()
# Use source as-is
return self.importDim
if self.transformedDim is not None:
selection = self.transformedDim.bounds
else:
selection = self.selection
return self.importDim, selection
@property
def rotation(self):