Code review

This commit is contained in:
Atlante45 2014-04-08 11:06:48 -07:00
parent ee5ebae89e
commit 22cab29d25
2 changed files with 7 additions and 1 deletions

View file

@ -51,6 +51,8 @@ void VoxelsScriptingInterface::setVoxelNonDestructive(float x, float y, float z,
AddVoxelCommand* command = new AddVoxelCommand(_tree,
addVoxelDetail,
getVoxelPacketSender());
// As QUndoStack automatically executes redo() on push, we don't need to execute the command ourselves.
_undoStack->push(command);
} else {
// queue the add packet
@ -89,11 +91,12 @@ void VoxelsScriptingInterface::setVoxel(float x, float y, float z, float scale,
deleteVoxelDetail,
getVoxelPacketSender());
_undoStack->beginMacro(addCommand->text());
qDebug() << "Macro";
// As QUndoStack automatically executes redo() on push, we don't need to execute the command ourselves.
_undoStack->push(delCommand);
_undoStack->push(addCommand);
_undoStack->endMacro();
} else {
// As QUndoStack automatically executes redo() on push, we don't need to execute the command ourselves.
_undoStack->push(addCommand);
}
} else {
@ -123,6 +126,7 @@ void VoxelsScriptingInterface::eraseVoxel(float x, float y, float z, float scale
DeleteVoxelCommand* command = new DeleteVoxelCommand(_tree,
deleteVoxelDetail,
getVoxelPacketSender());
// As QUndoStack automatically executes redo() on push, we don't need to execute the command ourselves.
_undoStack->push(command);
} else {
getVoxelPacketSender()->queueVoxelEditMessages(PacketTypeVoxelErase, 1, &deleteVoxelDetail);

View file

@ -18,6 +18,8 @@
#include "VoxelEditPacketSender.h"
#include "VoxelTree.h"
class QUndoStack;
/// handles scripting of voxel commands from JS passed to assigned clients
class VoxelsScriptingInterface : public OctreeScriptingInterface {
Q_OBJECT