本文整理汇总了Python中mcedit2.command.SimpleRevisionCommand类的典型用法代码示例。如果您正苦于以下问题:Python SimpleRevisionCommand类的具体用法?Python SimpleRevisionCommand怎么用?Python SimpleRevisionCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleRevisionCommand类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeEntity
def removeEntity(self):
if self.entity is None:
return
command = SimpleRevisionCommand(self.editorSession, "Remove Entity")
with command.begin():
self.entity.chunk.Entities.remove(self.entity)
示例2: deleteSelection
def deleteSelection(self):
command = SimpleRevisionCommand(self, "Delete")
with command.begin():
fillTask = self.currentDimension.fillBlocksIter(self.currentSelection, "air")
entitiesTask = RemoveEntitiesOperation(self.currentDimension, self.currentSelection)
task = ComposeOperations(fillTask, entitiesTask)
showProgress("Deleting...", task)
self.pushCommand(command)
示例3: cut
def cut(self):
command = SimpleRevisionCommand(self, "Cut")
with command.begin():
task = self.currentDimension.exportSchematicIter(self.currentSelection)
self.copiedSchematic = showProgress("Cutting...", task)
task = self.currentDimension.fillBlocksIter(self.currentSelection, "air")
showProgress("Cutting...", task)
self.undoStack.push(command)
示例4: doReplace
def doReplace(self):
replacements = self.getReplacements()
command = SimpleRevisionCommand(self.editorSession, "Replace")
selection = self.editorSession.currentDimension.bounds
# selection = self.editorSession.currentSelection
with command.begin():
task = self.editorSession.currentDimension.fillBlocksIter(selection, replacements, updateLights=False)
showProgress("Replacing...", task)
self.editorSession.pushCommand(command)
示例5: deleteChunks
def deleteChunks(self):
if self.currentSelection is None:
return
command = SimpleRevisionCommand(self, self.tr("Delete Chunks"))
with command.begin():
for cx in range(self.currentSelection.mincx, self.currentSelection.maxcx):
for cz in range(self.currentSelection.mincz, self.currentSelection.maxcz):
self.currentDimension.deleteChunk(cx, cz)
self.pushCommand(command)
示例6: doReplace
def doReplace(self):
replacements = self.widget.replacementList.getReplacements()
command = SimpleRevisionCommand(self.editorSession, "Replace")
if self.widget.replaceBlocksInSelectionCheckbox.isChecked():
selection = self.editorSession.currentSelection
else:
selection = self.editorSession.currentDimension.bounds
with command.begin():
task = self.editorSession.currentDimension.fillBlocksIter(selection, replacements, updateLights=False)
showProgress("Replacing...", task)
self.editorSession.pushCommand(command)
示例7: movePlayerToCamera
def movePlayerToCamera(self):
view = self.editorSession.editorTab.currentView()
if view.viewID == "Cam":
command = SimpleRevisionCommand(self.editorSession, "Move Player")
with command.begin():
self.selectedPlayer.Position = view.centerPoint
try:
self.selectedPlayer.Rotation = view.yawPitch
except AttributeError:
pass
self.selectedPlayer.dirty = True # xxx do in AnvilPlayerRef
self.editorSession.pushCommand(command)
else:
raise ValueError("Current view is not camera view.")
示例8: fillCommand
def fillCommand(editorSession):
"""
:type editorSession: mcedit2.editorsession.EditorSession
"""
box = editorSession.currentSelection
if box is None or box.volume == 0:
return
widget = getFillWidget(editorSession)
if widget.exec_():
command = SimpleRevisionCommand(editorSession, "Fill")
with command.begin():
task = editorSession.currentDimension.fillBlocksIter(box, widget.blockTypeInput.block)
showProgress("Filling...", task)
editorSession.pushCommand(command)
示例9: mapItemWasDropped
def mapItemWasDropped(self, mimeData, position, face):
log.info("Map item dropped.")
assert mimeData.hasFormat(MimeFormats.MapItem)
mapIDString = mimeData.data(MimeFormats.MapItem).data()
mapIDs = mapIDString.split(", ")
mapIDs = [int(m) for m in mapIDs]
mapID = mapIDs[0] # xxx only one at a time for now
position = position + face.vector
x, y, z = position
cx = x >> 4
cz = z >> 4
try:
chunk = self.currentDimension.getChunk(cx, cz)
except ChunkNotPresent:
log.info("Refusing to import map into non-existent chunk %s", (cx, cz))
return
ref = self.worldEditor.createEntity("ItemFrame")
if ref is None:
return
facing = ref.facingForMCEditFace(face)
if facing is None:
# xxx by camera vector?
facing = ref.SouthFacing
ref.Item.Damage = mapID
ref.Item.id = "minecraft:filled_map"
ref.Position = position + (0.5, 0.5, 0.5)
ref.TilePos = position # 1.7/1.8 issues should be handled by ref...
ref.Facing = facing
log.info("Created map ItemFrame with ID %s, importing...", mapID)
command = SimpleRevisionCommand(self, self.tr("Import map %(mapID)s") % {"mapID": mapID})
with command.begin():
chunk.addEntity(ref)
log.info(nbt.nested_string(ref.rootTag))
self.pushCommand(command)
示例10: deleteEntities
def deleteEntities(self):
command = SimpleRevisionCommand(self, "Delete Entities")
with command.begin():
entitiesTask = RemoveEntitiesOperation(self.currentDimension, self.currentSelection)
showProgress("Deleting...", entitiesTask)
self.pushCommand(command)
示例11: deleteBlocks
def deleteBlocks(self):
command = SimpleRevisionCommand(self, "Delete Blocks")
with command.begin():
fillTask = self.currentDimension.fillBlocksIter(self.currentSelection, "air")
showProgress("Deleting...", fillTask)
self.pushCommand(command)