本文整理汇总了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)
开发者ID:KevinKelley,项目名称:mcedit2,代码行数:7,代码来源:__init__.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:8,代码来源:editorsession.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:8,代码来源:editorsession.py
示例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)
开发者ID:cagatayikim,项目名称:mcedit2,代码行数:9,代码来源:find_replace.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:10,代码来源:editorsession.py
示例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)
开发者ID:shatteredsword,项目名称:mcedit2,代码行数:11,代码来源:replace_blocks.py
示例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.")
开发者ID:CaulyKan,项目名称:mcedit2,代码行数:15,代码来源:player.py
示例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)
开发者ID:101baja202,项目名称:mcedit2,代码行数:16,代码来源:fill.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:40,代码来源:editorsession.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:6,代码来源:editorsession.py
示例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)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:6,代码来源:editorsession.py
注:本文中的mcedit2.command.SimpleRevisionCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论