Пример #1
0
INode* SpriteReader::CreateNodeWithJson(INodeEditor& editor, const rapidjson::Value& nodeTree, const StringRef& className /*= StringRef::Empty*/, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
	const rapidjson::Value& fileDataNode = nodeTree["FileData"];
	StringRef path = fileDataNode.GetMember("Path", nullptr);
	Sprite* sprite = CreateSprite(path);
	SetPropsWithJson(sprite, nodeTree);
	return sprite;
}
Пример #2
0
INode* ProjectNodeReader::CreateNodeWithJson(INodeEditor& editor, const rapidjson::Value& nodeTree, const StringRef& className /*= StringRef::Empty*/, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
	const rapidjson::Value& fileDataNode = nodeTree["FileData"];
	StringRef filePath = fileDataNode.GetString("Path", nullptr);
	filePath = Path::GetFileName(filePath);
	RETURN_NULL_IF_FALSE(FileSystem::Instance().AssertExists(filePath));
	INode* node = editor.Create("", filePath,IEventArg::Empty,flags);
	SetPropsWithJson(node, nodeTree, flags);
	return node;
}
Пример #3
0
INode* LayerReader::CreateNodeWithJson(INodeEditor& editor, const rapidjson::Value& nodeTree, const StringRef& className /*= StringRef::Empty*/, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
	ILayer* node = nullptr;
	if (className.IsEmpty())
	{
		node = LayerFactory::Instance().Create<NormalLayer>(IEventArg::Empty, flags);
	}
	else
	{
		node = LayerFactory::Instance().Create(className, FileIdRef::Empty, IEventArg::Empty, flags);
	}

	SetPropsWithJson(node, nodeTree,flags);

#ifdef MEDUSA_SCRIPT
	if (ApplicationSettings::Instance().HasScriptBinding())
	{
		node->TryAttachScriptObject();
	}
#endif
	return node;
}