Copy-paste no longer clears previous selection.

This commit is contained in:
David Vierra 2015-09-08 10:45:04 -10:00
parent 66747461b5
commit daf729eedb
2 changed files with 15 additions and 8 deletions

View File

@ -60,11 +60,12 @@ currentViewSetting = sessionSettings.getOption("currentview", unicode, "cam")
# chunks into its viewports.
class PendingImport(object):
def __init__(self, sourceDim, pos, selection, text):
def __init__(self, sourceDim, pos, selection, text, isMove=False):
self.selection = selection
self.text = text
self.pos = pos
self.sourceDim = sourceDim
self.isMove = isMove
def __repr__(self):
return "%s(%r, %r, %r)" % (self.__class__.__name__, self.sourceDim, self.selection, self.pos)

View File

@ -341,7 +341,8 @@ class MoveTool(EditorTool):
# blocks will be moved.
pos = self.editorSession.currentSelection.origin
pendingImport = PendingImport(self.editorSession.currentDimension, pos,
self.editorSession.currentSelection, self.tr("<Moved Object>"))
self.editorSession.currentSelection, self.tr("<Moved Object>"),
isMove=True)
moveCommand = MoveSelectionCommand(self, pendingImport)
self.editorSession.pushCommand(moveCommand)
@ -360,13 +361,18 @@ class MoveTool(EditorTool):
with command.begin():
# TODO don't use intermediate schematic...
export = self.currentImport.sourceDim.exportSchematicIter(self.currentImport.selection)
schematic = showProgress("Copying...", export)
if self.currentImport.isMove:
export = self.currentImport.sourceDim.exportSchematicIter(self.currentImport.selection)
schematic = showProgress("Copying...", export)
dim = schematic.getDimension()
fill = self.editorSession.currentDimension.fillBlocksIter(self.currentImport.selection, "air")
showProgress("Clearing...", fill)
else:
dim = self.currentImport.sourceDim
fill = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.currentSelection, "air")
showProgress("Clearing...", fill)
task = self.editorSession.currentDimension.importSchematicIter(schematic, self.currentImport.pos)
task = self.editorSession.currentDimension.copyBlocksIter(dim, dim.bounds,
self.currentImport.pos,
biomes=True, create=True)
showProgress(self.tr("Pasting..."), task)
self.editorSession.pushCommand(command)