PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
animation_graph_component.h
1#pragma once
2
3#include "pixelbullet/filesystem/virtual_path.h"
4#include "pixelbullet/filesystem/virtual_path_serialization.h"
5#include "pixelbullet/serialization/node.h"
6
7namespace pixelbullet
8{
10{
11 bool enabled = true;
12 VirtualPath graph_asset;
13
14 [[nodiscard]] bool operator==(const AnimationGraphComponent&) const noexcept = default;
15};
16
17inline Node& operator<<(Node& node, const AnimationGraphComponent& component)
18{
19 node["enabled"] << component.enabled;
20 node["graphAsset"] << component.graph_asset;
21 return node;
22}
23
24inline const Node& operator>>(const Node& node, AnimationGraphComponent& component)
25{
26 if (node.HasProperty("enabled"))
27 {
28 node["enabled"] >> component.enabled;
29 }
30 else
31 {
32 component.enabled = true;
33 }
34
35 if (node.HasProperty("graphAsset"))
36 {
37 node["graphAsset"] >> component.graph_asset;
38 }
39 else
40 {
41 component.graph_asset = {};
42 }
43
44 return node;
45}
46} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition virtual_path.h:10
Definition animation_graph_component.h:10