-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add layer rename in LayerEditor (#47)
- Loading branch information
Showing
8 changed files
with
133 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifdef TOOLS_ENABLED | ||
|
||
#include "change_layer_name_command.h" | ||
|
||
using namespace editor::commands; | ||
|
||
void ChangeLayerNameCommand::redo() { | ||
context_node->set_layer_name(layer_id, new_layer_name); | ||
|
||
Command::redo(); | ||
} | ||
|
||
void ChangeLayerNameCommand::undo() { | ||
context_node->set_layer_name(layer_id, former_layer_name); | ||
|
||
Command::undo(); | ||
} | ||
|
||
void ChangeLayerNameCommand::set_layer_id(uint32_t p_layer_id) { | ||
layer_id = p_layer_id; | ||
} | ||
|
||
void ChangeLayerNameCommand::set_new_layer_name(const String& p_new_layer_name) { | ||
new_layer_name = p_new_layer_name; | ||
} | ||
|
||
void ChangeLayerNameCommand::set_former_layer_name(const String& p_former_layer_name) { | ||
former_layer_name = p_former_layer_name; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef ISOMETRIC_MAPS_CHANGE_LAYER_NAME_COMMAND_H | ||
#define ISOMETRIC_MAPS_CHANGE_LAYER_NAME_COMMAND_H | ||
|
||
#include "command.h" | ||
#include "node/isometric_map.h" | ||
#ifdef TOOLS_ENABLED | ||
|
||
namespace editor { | ||
namespace commands { | ||
class ChangeLayerNameCommand : public Command<node::IsometricMap> { | ||
public: | ||
void redo() override; | ||
void undo() override; | ||
|
||
void set_layer_id(uint32_t p_layer_id); | ||
void set_new_layer_name(const String& p_new_layer_name); | ||
void set_former_layer_name(const String& p_former_layer_name); | ||
|
||
ChangeLayerNameCommand() = default; | ||
~ChangeLayerNameCommand() override = default; | ||
|
||
private: | ||
String new_layer_name; | ||
String former_layer_name; | ||
uint32_t layer_id; | ||
}; | ||
} | ||
} | ||
|
||
#endif | ||
|
||
#endif// ISOMETRIC_MAPS_CHANGE_LAYER_NAME_COMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters