MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Serialize

Method Serialize

Source/Engine/UI/UIControl.cpp:71–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69#endif
70
71void UIControl::Serialize(SerializeStream& stream, const void* otherObj)
72{
73 // Base
74 Actor::Serialize(stream, otherObj);
75
76 SERIALIZE_GET_OTHER_OBJ(UIControl);
77 SERIALIZE_MEMBER(NavTargetUp, _navTargetUp);
78 SERIALIZE_MEMBER(NavTargetDown, _navTargetDown);
79 SERIALIZE_MEMBER(NavTargetLeft, _navTargetLeft);
80 SERIALIZE_MEMBER(NavTargetRight, _navTargetRight);
81
82#if !COMPILE_WITHOUT_CSHARP
83 PROFILE_MEM(UI);
84 void* params[2];
85 MString* controlType = nullptr;
86 params[0] = &controlType;
87 params[1] = other ? other->GetOrCreateManagedInstance() : nullptr;
88 MObject* exception = nullptr;
89 const auto invokeResultStr = (MString*)UIControl_Serialize->Invoke(GetOrCreateManagedInstance(), params, &exception);
90 if (exception)
91 {
92 MException ex(exception);
93 ex.Log(LogType::Error, TEXT("UIControl::Serialize"));
94 return;
95 }
96
97 // No control
98 if (!controlType)
99 {
100 if (!other)
101 {
102 stream.JKEY("Control");
103 stream.String("", 0);
104
105 stream.JKEY("Data");
106 stream.RawValue("{}", 2);
107 }
108 return;
109 }
110
111 const StringView controlTypeChars = MCore::String::GetChars(controlType);
112 if (controlTypeChars.Length() != 0)
113 {
114 stream.JKEY("Control");
115 stream.String(controlTypeChars);
116 }
117
118 const StringView invokeResultStrChars = MCore::String::GetChars(invokeResultStr);
119 stream.JKEY("Data");
120 stream.RawValue(invokeResultStrChars);
121#endif
122}
123
124void UIControl::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
125{

Callers

nothing calls this directly

Calls 8

SerializeFunction · 0.50
InvokeMethod · 0.45
LogMethod · 0.45
StringMethod · 0.45
RawValueMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected