Skip to content

Commit

Permalink
We are now using our own IDs as entity references
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkTreasure1 committed Nov 30, 2023
1 parent 5eeb19f commit 4b59618
Show file tree
Hide file tree
Showing 124 changed files with 1,857 additions and 1,445 deletions.
4 changes: 2 additions & 2 deletions Engine/Launcher.exe
Git LFS file not shown
4 changes: 2 additions & 2 deletions Engine/Sandbox.exe
Git LFS file not shown
4 changes: 2 additions & 2 deletions Engine/Scripts/Volt-ScriptCore.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions Engine/Scripts/Volt-ScriptCore.pdb
Git LFS file not shown
30 changes: 5 additions & 25 deletions Volt/Amp/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@ project "Amp"

warnings "Extra"

flags
{
"FatalWarnings"
}

disablewarnings
{
"4005",
"4201",
"4100"
}

linkoptions
{
"/ignore:4006",
"/ignore:4099"
}
AddCommonFlags()
AddCommonWarnings()
AddCommonLinkOptions()
AddCommonIncludeDirs()
AddCommonDefines()

files
{
Expand All @@ -45,21 +33,13 @@ project "Amp"
"%{IncludeDir.yaml}",
"%{IncludeDir.spdlog}",
"%{IncludeDir.ImGui}",
"%{IncludeDir.Optick}",
"%{IncludeDir.fmod}",
"%{IncludeDir.glm}",
"%{IncludeDir.wwise}"
}

defines
{
"NOMINMAX",
"_HAS_STD_BYTE=0",
"_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS",
"PX_PHYSX_STATIC_LIB",

"GLM_FORCE_DEPTH_ZERO_TO_ONE",
"GLM_FORCE_LEFT_HANDED"
}

filter "files:vendor/**.cpp"
Expand Down
28 changes: 5 additions & 23 deletions Volt/GraphKey/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@ project "GraphKey"

warnings "Extra"

flags
{
"FatalWarnings"
}

disablewarnings
{
"4005",
"4201",
"4100"
}

linkoptions
{
"/ignore:4006",
"/ignore:4099"
}
AddCommonFlags()
AddCommonWarnings()
AddCommonLinkOptions()
AddCommonIncludeDirs()
AddCommonDefines()

buildoptions
{
Expand All @@ -50,10 +38,8 @@ project "GraphKey"
"../Nexus/src",

"%{IncludeDir.yaml}",
"%{IncludeDir.Optick}",
"%{IncludeDir.spdlog}",

"%{IncludeDir.glm}",
"%{IncludeDir.fmod}",

"%{IncludeDir.ImGui}",
Expand All @@ -68,11 +54,7 @@ project "GraphKey"

defines
{
"_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS",
"PX_PHYSX_STATIC_LIB",

"GLM_FORCE_DEPTH_ZERO_TO_ONE",
"GLM_FORCE_LEFT_HANDED"
}

filter "files:vendor/**.cpp"
Expand Down
6 changes: 3 additions & 3 deletions Volt/GraphKey/src/GraphKey/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace GraphKey
}
}

Graph::Graph(entt::entity entity)
Graph::Graph(Volt::EntityID entity)
: myEntity(entity)
{
}
Expand Down Expand Up @@ -303,7 +303,7 @@ namespace GraphKey
{
Ref<GraphKey::Node> newNode;

if (dstGraph->GetEntity() != entt::null)
if (dstGraph->GetEntity() != Volt::Entity::NullID())
{
newNode = n->CreateCopy(dstGraph.get(), dstGraph->GetEntity());
}
Expand All @@ -323,7 +323,7 @@ namespace GraphKey
newLink.output = l.output;
}

if (dstGraph->myEntity == entt::null)
if (dstGraph->myEntity == Volt::Entity::NullID())
{
dstGraph->myEntity = srcGraph->myEntity;
}
Expand Down
8 changes: 4 additions & 4 deletions Volt/GraphKey/src/GraphKey/Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace GraphKey
{
public:
Graph();
Graph(entt::entity entity);
Graph(Volt::EntityID entity);
~Graph() override = default;

void OnEvent(Volt::Event& e);
Expand All @@ -56,14 +56,14 @@ namespace GraphKey

const bool IsAttributeLinked(const Volt::UUID id) const;

inline const entt::entity GetEntity() const { return myEntity; }
inline const Volt::EntityID GetEntity() const { return myEntity; }
inline std::vector<Ref<Node>>& GetNodes() { return myNodes; }
inline std::vector<Link>& GetLinks() { return myLinks; }
inline std::vector<GraphParameter>& GetBlackboard() { return myParentBlackboard ? *myParentBlackboard : myBlackboard; }
inline std::vector<GraphEvent>& GetEvents() { return myGraphEvents; }
inline EventSystem& GetEventSystem() { return myEventSystem; }

inline void SetEntity(entt::entity id) { myEntity = id; }
inline void SetEntity(Volt::EntityID id) { myEntity = id; }
inline void SetParentBlackboard(std::vector<GraphParameter>* blackboard) { myParentBlackboard = blackboard; }

void AddEvent(const std::string& name, const Volt::UUID id = {});
Expand Down Expand Up @@ -105,7 +105,7 @@ namespace GraphKey
std::vector<GraphParameter> myBlackboard;
std::vector<GraphEvent> myGraphEvents;

entt::entity myEntity = entt::null;
Volt::EntityID myEntity = Volt::Entity::NullID();

std::vector<Ref<Node>> myNodes;
std::vector<Link> myLinks;
Expand Down
2 changes: 1 addition & 1 deletion Volt/GraphKey/src/GraphKey/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace GraphKey
}
}

Ref<Node> Node::CreateCopy(Graph* ownerGraph, entt::entity entity)
Ref<Node> Node::CreateCopy(Graph* ownerGraph, Volt::EntityID entity)
{
Ref<Node> newNode = Registry::Create(GetRegistryName());

Expand Down
4 changes: 2 additions & 2 deletions Volt/GraphKey/src/GraphKey/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace GraphKey

virtual void Serialize(YAML::Emitter&) {}
virtual void Deserialize(const YAML::Node&) {}
virtual Ref<Node> CreateCopy(Graph* ownerGraph, entt::entity entity = entt::null);
virtual Ref<Node> CreateCopy(Graph* ownerGraph, Volt::EntityID entity = Volt::Entity::NullID());

virtual const std::string GetName() = 0;
virtual const glm::vec4 GetColor() = 0;
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace GraphKey
void SetOutputData(uint32_t index, const T& data);

Volt::UUID id{};
entt::entity nodeEntity = entt::null;
Volt::EntityID nodeEntity = Volt::Entity::NullID();

std::vector<Attribute> inputs;
std::vector<Attribute> outputs;
Expand Down
2 changes: 1 addition & 1 deletion Volt/GraphKey/src/GraphKey/Nodes/Animation/BlendNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ namespace GraphKey
}
}

Ref<Node> LayeredBlendPerBoneNode::CreateCopy(Graph* ownerGraph, entt::entity entityId)
Ref<Node> LayeredBlendPerBoneNode::CreateCopy(Graph* ownerGraph, Volt::EntityID entityId)
{
Ref<Node> copy = Node::CreateCopy(ownerGraph, entityId);
Ref<LayeredBlendPerBoneNode> blendNode = std::reinterpret_pointer_cast<LayeredBlendPerBoneNode>(copy);
Expand Down
2 changes: 1 addition & 1 deletion Volt/GraphKey/src/GraphKey/Nodes/Animation/BlendNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace GraphKey
inline std::vector<BlendFilter>& GetBlendIncludeFilters() { return myIncludeFilters; }
inline std::vector<BlendFilter>& GetBlendExcludeFilters() { return myExcludeFilters; }

Ref<Node> CreateCopy(Graph* ownerGraph, entt::entity entity = entt::null) override;
Ref<Node> CreateCopy(Graph* ownerGraph, Volt::EntityID entity = Volt::EntityID(0)) override;

private:
void TryApplyLayeredBlendPerBone();
Expand Down
4 changes: 2 additions & 2 deletions Volt/GraphKey/src/GraphKey/Nodes/Animation/SequenceNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ namespace GraphKey

const uint32_t currentFrame = anim->GetFrameFromStartTime(animGraph->GetStartTime(), speed);
const int32_t animationIndex = character->GetAnimationIndexFromHandle(animHandle);
if (myGraph->GetEntity() != entt::null && Volt::SceneManager::GetActiveScene().lock() && animationIndex != -1 && character->HasAnimationEvents((uint32_t)animationIndex))
if (myGraph->GetEntity() != Volt::Entity::NullID() && Volt::SceneManager::GetActiveScene() && animationIndex != -1 && character->HasAnimationEvents((uint32_t)animationIndex))
{
const auto& animEvents = character->GetAnimationEvents((uint32_t)animationIndex);
for (const auto& event : animEvents)
{
if (event.frame == currentFrame && (int32_t)currentFrame != myLastFrame)
{
Volt::Entity entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
Volt::Entity entity = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
if (!entity)
{
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace GraphKey
return "State Machine";
}

Ref<Node> StateMachineNode::CreateCopy(Graph* ownerGraph, entt::entity entity)
Ref<Node> StateMachineNode::CreateCopy(Graph* ownerGraph, Volt::EntityID entity)
{
Ref<Node> copy = Node::CreateCopy(ownerGraph, entity);
Ref<StateMachineNode> stateMachineNode = std::reinterpret_pointer_cast<StateMachineNode>(copy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace GraphKey
void Deserialize(const YAML::Node& node) override;

const std::string GetName() override;
Ref<Node> CreateCopy(Graph* ownerGraph, entt::entity entity = entt::null) override;
Ref<Node> CreateCopy(Graph* ownerGraph, Volt::EntityID entity = Volt::Entity::NullID()) override;

inline const glm::vec4 GetColor() override { return { 1.f }; }
inline const Ref<Volt::AnimationStateMachine> GetStateMachine() const { return myStateMachine; }
Expand Down
4 changes: 2 additions & 2 deletions Volt/GraphKey/src/GraphKey/Nodes/ComponentNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace GraphKey
{
void LightNode::Initialize()
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}

void LightNode::SetProperties()
Expand All @@ -28,7 +28,7 @@ namespace GraphKey

void ChangeLightColorNode::Initialize()
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}

void ChangeLightColorNode::OnEvent(Volt::Event& e)
Expand Down
10 changes: 5 additions & 5 deletions Volt/GraphKey/src/GraphKey/Nodes/Entity/BaseEntityNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace GraphKey
void CreateEntityNode::CreateEntity()
{
auto activeScene = Volt::SceneManager::GetActiveScene();
auto scenePtr = activeScene.lock();
auto scenePtr = activeScene;

if (scenePtr)
{
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(outputs[0].data))
{
outputs[0].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
outputs[0].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand All @@ -81,7 +81,7 @@ namespace GraphKey
auto activeScene = Volt::SceneManager::GetActiveScene();
auto entity = GetInput<Volt::Entity>(1);

auto scenePtr = activeScene.lock();
auto scenePtr = activeScene;

if (scenePtr && entity)
{
Expand All @@ -108,7 +108,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[0].data))
{
inputs[0].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[0].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand All @@ -133,7 +133,7 @@ namespace GraphKey

void SelfNode::Initialize()
{
outputs[0].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
outputs[0].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}

void SelfNode::GetEntity()
Expand Down
10 changes: 5 additions & 5 deletions Volt/GraphKey/src/GraphKey/Nodes/Entity/TransformNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[0].data))
{
inputs[0].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[0].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[1].data))
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[1].data))
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand Down Expand Up @@ -146,7 +146,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[1].data))
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand Down Expand Up @@ -180,7 +180,7 @@ namespace GraphKey
{
if (!std::any_cast<Volt::Entity>(inputs[1].data))
{
inputs[1].data = Volt::Entity{ myGraph->GetEntity(), Volt::SceneManager::GetActiveScene() };
inputs[1].data = Volt::SceneManager::GetActiveScene()->GetEntityFromUUID(myGraph->GetEntity());
}
}

Expand Down
Loading

0 comments on commit 4b59618

Please sign in to comment.