| 115 | #if USE_EDITOR |
| 116 | |
| 117 | void FindIds(ISerializable::DeserializeStream& node, Array<Guid>& output, Array<String>& files, rapidjson_flax::Value* nodeName = nullptr) |
| 118 | { |
| 119 | if (node.IsObject()) |
| 120 | { |
| 121 | for (auto i = node.MemberBegin(); i != node.MemberEnd(); ++i) |
| 122 | { |
| 123 | FindIds(i->value, output, files, &i->name); |
| 124 | } |
| 125 | } |
| 126 | else if (node.IsArray()) |
| 127 | { |
| 128 | for (rapidjson::SizeType i = 0; i < node.Size(); i++) |
| 129 | { |
| 130 | FindIds(node[i], output, files); |
| 131 | } |
| 132 | } |
| 133 | else if (node.IsString() && node.GetStringLength() != 0) |
| 134 | { |
| 135 | if (node.GetStringLength() == 32) |
| 136 | { |
| 137 | // Try parse as Guid in format `N` (32 hex chars) |
| 138 | Guid id; |
| 139 | if (!Guid::Parse(node.GetStringAnsiView(), id)) |
| 140 | { |
| 141 | output.Add(id); |
| 142 | return; |
| 143 | } |
| 144 | } |
| 145 | if (node.GetStringLength() < 512 && |
| 146 | (!nodeName || nodeName->GetStringAnsiView() != "ImportPath")) // Ignore path in ImportPath from ModelPrefab (TODO: resave prefabs/scenes before cooking to get rid of editor-only data) |
| 147 | { |
| 148 | // Try to detect file paths |
| 149 | String path = node.GetText(); |
| 150 | if (FileSystem::FileExists(path)) |
| 151 | { |
| 152 | files.Add(MoveTemp(path)); |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void JsonAssetBase::GetReferences(const StringAnsiView& json, Array<Guid>& assets) |
| 159 | { |
no test coverage detected