Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Serializable
CValueProperty.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2020 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#pragma once
26
27
#include <functional>
28
29
namespace
Skylicht
30
{
31
class
CObjectSerializable
;
32
33
enum
EPropertyDataType
34
{
35
String,
36
StringW,
37
Integer,
38
UInteger,
39
Float,
40
Double,
41
DateTime,
42
Bool,
43
Vector3,
44
Vector2,
45
Quaternion,
46
Color,
47
Matrix4,
48
Object,
49
FilePath,
50
FolderPath,
51
ImageSource,
52
FrameSource,
53
Enum,
54
NumType
55
};
56
57
enum
EPropertyObjectType
58
{
59
None,
60
ObjectArray,
61
ObjectInterpolate,
62
FileArray,
63
TextureArray,
64
NumObjectType
65
};
66
67
class
SKYLICHT_API CValueProperty
68
{
69
protected
:
70
EPropertyDataType m_dataType;
71
EPropertyObjectType m_objectType;
72
73
CObjectSerializable
* m_owner;
74
75
// ui editor interface
76
std::string m_uiHeader;
77
78
float
m_uiSpace;
79
80
bool
m_hidden;
81
82
public
:
83
std::function<void(
bool
)> OnSetHidden;
84
std::function<void()> OnChanged;
85
86
public
:
87
std::string Name;
88
std::vector<std::string> OtherName;
89
90
CValueProperty(
CObjectSerializable
* owner, EPropertyDataType dataType,
const
char
* name);
91
92
virtual
~CValueProperty();
93
94
void
setOwner(
CObjectSerializable
* owner)
95
{
96
m_owner = owner;
97
}
98
99
EPropertyDataType getType()
100
{
101
return
m_dataType;
102
}
103
104
EPropertyObjectType getObjectType()
105
{
106
return
m_objectType;
107
}
108
109
virtual
void
serialize(io::IAttributes* io) = 0;
110
111
virtual
void
deserialize(io::IAttributes* io) = 0;
112
113
virtual
CValueProperty* clone() = 0;
114
115
inline
void
setUIHeader(
const
char
* header)
116
{
117
m_uiHeader = header;
118
}
119
120
inline
const
std::string& getUIHeader()
121
{
122
return
m_uiHeader;
123
}
124
125
inline
void
setUISpace(
float
space)
126
{
127
m_uiSpace = space;
128
}
129
130
inline
float
getUISpace()
131
{
132
return
m_uiSpace;
133
}
134
135
inline
void
setHidden(
bool
b)
136
{
137
m_hidden = b;
138
if
(OnSetHidden !=
nullptr
)
139
OnSetHidden(b);
140
}
141
142
inline
bool
isHidden()
143
{
144
return
m_hidden;
145
}
146
};
147
}
Skylicht::CObjectSerializable
Definition
CObjectSerializable.h:36
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Generated by
1.17.0