-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: <EntitySelector> component to modify specific entities (#238)
- Loading branch information
Showing
15 changed files
with
297 additions
and
58 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
// | ||
// Created by Hanno Gödecke on 18.07.24. | ||
// | ||
#include "RNFNameComponentManagerWrapper.h" | ||
|
||
namespace margelo { | ||
|
||
void NameComponentManagerWrapper::loadHybridMethods() { | ||
registerHybridMethod("getEntityName", &NameComponentManagerWrapper::getEntityName, this); | ||
} | ||
|
||
// TODO: This code is similar to EntityNameMap AnimatorWrapper::createEntityNameMap, consider refactoring | ||
std::optional<std::string> | ||
NameComponentManagerWrapper::getEntityName(std::shared_ptr<EntityWrapper> entityWrapper) { | ||
if (!entityWrapper) { | ||
throw std::invalid_argument("EntityWrapper is null"); | ||
} | ||
|
||
Entity entity = entityWrapper->getEntity(); | ||
bool hasEntity = pointee()->hasComponent(entity); | ||
if (!hasEntity) { | ||
Logger::log(TAG, "Entity wasn't found in NameComponentManager"); | ||
return std::nullopt; | ||
} | ||
|
||
NameComponentManager::Instance instance = pointee()->getInstance(entity); | ||
if (!instance || !instance.isValid()) { | ||
Logger::log(TAG, "Instance wasn't found in NameComponentManager"); | ||
return std::nullopt; | ||
} | ||
return pointee()->getName(instance); | ||
} | ||
} |
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
Oops, something went wrong.