-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
823 additions
and
167 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[{000214A0-0000-0000-C000-000000000046}] | ||
Prop3=19,11 | ||
[InternetShortcut] | ||
IDList= | ||
URL=https://stackedit.io/app#providerId=googleDriveWorkspace&folderId=1Fx2lndtJ9DBJ2F0ZI_aIb0fk-ppD27Si |
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
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,43 @@ | ||
#include "ModelChangeAction.h" | ||
#include <browedit/util/Util.h> | ||
#include <browedit/util/ResourceManager.h> | ||
#include <browedit/components/Rsw.h> | ||
#include <browedit/components/Rsm.h> | ||
#include <browedit/components/RsmRenderer.h> | ||
#include <browedit/Node.h> | ||
|
||
ModelChangeAction::ModelChangeAction(Node* node, const std::string& newFileName) : node(node), newFileName(newFileName) | ||
{ | ||
auto rswModel = node->getComponent<RswModel>(); | ||
oldFileName = "data\\model\\" + util::utf8_to_iso_8859_1(rswModel->fileName); | ||
|
||
} | ||
|
||
void ModelChangeAction::perform(Map* map, BrowEdit* browEdit) | ||
{ | ||
auto rswModel = node->getComponent<RswModel>(); | ||
rswModel->fileName = util::iso_8859_1_to_utf8(newFileName); | ||
auto removed = node->removeComponent<Rsm>(); | ||
for (auto r : removed) | ||
util::ResourceManager<Rsm>::unload(r); | ||
node->addComponent(util::ResourceManager<Rsm>::load(newFileName)); | ||
node->getComponent<RsmRenderer>()->begin(); | ||
node->getComponent<RswModelCollider>()->begin(); | ||
} | ||
|
||
void ModelChangeAction::undo(Map* map, BrowEdit* browEdit) | ||
{ | ||
auto rswModel = node->getComponent<RswModel>(); | ||
rswModel->fileName = util::iso_8859_1_to_utf8(oldFileName); | ||
auto removed = node->removeComponent<Rsm>(); | ||
for (auto r : removed) | ||
util::ResourceManager<Rsm>::unload(r); | ||
node->addComponent(util::ResourceManager<Rsm>::load(oldFileName)); | ||
node->getComponent<RsmRenderer>()->begin(); | ||
node->getComponent<RswModelCollider>()->begin(); | ||
} | ||
|
||
std::string ModelChangeAction::str() | ||
{ | ||
return "Changing model for " + node->name; | ||
} |
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,16 @@ | ||
#pragma once | ||
|
||
#include "Action.h" | ||
class Node; | ||
|
||
class ModelChangeAction : public Action | ||
{ | ||
Node* node; | ||
std::string newFileName; | ||
std::string oldFileName; | ||
public: | ||
ModelChangeAction(Node* node, const std::string& newFileName); // ISO format | ||
virtual void perform(Map* map, BrowEdit* browEdit) override; | ||
virtual void undo(Map* map, BrowEdit* browEdit) override; | ||
virtual std::string str() override; | ||
}; |
Oops, something went wrong.