示例#1
0
void SceneSaver::CopyCustomColorTexture(Scene *scene, const FilePath & sceneFolder, Set<String> &errorLog)
{
	Entity *land = FindLandscapeEntity(scene);
	if(!land) return;

	KeyedArchive* customProps = land->GetCustomProperties();
	if(!customProps) return;

	String pathname = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
	if(pathname.empty()) return;

    FilePath projectPath = CreateProjectPathFromPath(sceneFolder);
    if(projectPath.IsEmpty())
    {
		Logger::Error("[SceneSaver::CopyCustomColorTexture] Can't copy custom colors texture (%s)", pathname.c_str());
        return;
    }

    FilePath texPathname = projectPath + pathname;
    sceneUtils.CopyFile(texPathname, errorLog);
    
    FilePath newTexPathname = sceneUtils.GetNewFilePath(texPathname);
    FilePath newProjectPathname = CreateProjectPathFromPath(sceneUtils.dataFolder);
    if(newProjectPathname.IsEmpty())
    {
		Logger::Error("[SceneSaver::CopyCustomColorTexture] Can't save custom colors texture (%s)", pathname.c_str());
        return;
    }
    
    //save new path to custom colors texture
    customProps->SetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP, newTexPathname.GetRelativePathname(newProjectPathname));
}
void NodesPropertyControl::OnIntPropertyChanged(PropertyList *, const String &forKey, int newValue)
{
	bool needUpdatePropertyPanel = false;

    if(!createNodeProperties)
    {
        if(currentSceneNode)
        {
            KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
            if(customProperties->IsKeyExists(forKey))
            {
                customProperties->SetInt32(forKey, newValue);
				needUpdatePropertyPanel = true;
            }
        }
    }

    
    if(nodesDelegate)
    {
        nodesDelegate->NodesPropertyChanged(forKey);
	}

	if(needUpdatePropertyPanel)
		UpdateFieldsForCurrentNode();
}
void NodesPropertyControl::OnStringPropertyChanged(PropertyList *, const String &forKey, const String &newValue)
{
    if(forKey == SCENE_NODE_NAME_PROPERTY_NAME) //Entity
    {
        if(currentSceneNode)
        {
            currentSceneNode->SetName(newValue);
        }
        else if(currentDataNode)
        {
            currentDataNode->SetName(newValue);
        }
    }
    else if(!createNodeProperties)
    {
        if(currentSceneNode)
        {
            KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
            if(customProperties->IsKeyExists(forKey))
            {
                customProperties->SetString(forKey, newValue);
            }
        }
    }
    
    if(nodesDelegate)
    {
        nodesDelegate->NodesPropertyChanged(forKey);
    }
}
void NodesPropertyControl::OnMinus(BaseObject * , void * , void * )
{
    if(propControl->GetParent() || listHolder->GetParent())
    {
        return;
    }
    
    if(currentSceneNode)
    {
        KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
        Map<String, VariantType*> propsData = customProperties->GetArchieveData();
        
        int32 size = propsData.size();
        if(size)
        {
            Rect r = listHolder->GetRect();
            r.dy = Min(r.dy, (float32)size * CellHeight(NULL, 0));
            r.y = listHolder->GetRect().dy - r.dy - ControlsFactory::BUTTON_HEIGHT;
            
            deletionList = new UIList(r, UIList::ORIENTATION_VERTICAL);
            ControlsFactory::SetScrollbar(deletionList);
            ControlsFactory::CustomizePropertyCell(deletionList, false);
            
            deletionList->SetDelegate(this);
            
            listHolder->AddControl(deletionList);
            deletionList->Refresh();
            AddControl(listHolder);
        }
    }
}
void VisibilityToolPanel::RestoreState()
{
	SceneEditor2* sceneEditor = GetActiveScene();

	bool enabled = sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled();
	int32 brushSize = AreaSizeSystemToUI(sceneEditor->visibilityToolSystem->GetBrushSize());
	VisibilityToolSystem::eVisibilityToolState state = sceneEditor->visibilityToolSystem->GetState();

	int32 areaSizeMin = DEF_AREA_MIN_SIZE;
	int32 areaSizeMax = DEF_AREA_MAX_SIZE;

	KeyedArchive* customProperties = GetCustomPropertiesArchieve(sceneEditor);
	if (customProperties)
	{
		areaSizeMin = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN, DEF_AREA_MIN_SIZE);
		areaSizeMax = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX, DEF_AREA_MAX_SIZE);
	}
	
	SetWidgetsState(enabled);
	
	BlockAllSignals(true);
	sliderWidgetAreaSize->SetRangeMin(areaSizeMin);
	sliderWidgetAreaSize->SetRangeMax(areaSizeMax);
	sliderWidgetAreaSize->SetValue(brushSize);
	buttonSetVisibilityPoint->setChecked(state == VisibilityToolSystem::VT_STATE_SET_POINT);
	buttonSetVisibilityArea->setChecked(state == VisibilityToolSystem::VT_STATE_SET_AREA);
	BlockAllSignals(!enabled);
}
示例#6
0
void RenderObject::Load(KeyedArchive * archive, SceneFileV2 *sceneFile)
{
    if(NULL != archive)
    {
        if(archive->IsKeyExists("ro.type")) type = archive->GetUInt32("ro.type");
        if(archive->IsKeyExists("ro.flags")) flags = archive->GetUInt32("ro.flags");
        if(archive->IsKeyExists("ro.debugflags")) debugFlags = archive->GetUInt32("ro.debugflags");

        if(archive->IsKeyExists("ro.batchCount"))
        {
            KeyedArchive *batchesArch = archive->GetArchive("ro.batches");
            for(uint32 i = 0; i < archive->GetUInt32("ro.batchCount"); ++i)
            {
                KeyedArchive *batchArch = batchesArch->GetArchive(KeyedArchive::GenKeyFromIndex(i));
                if(NULL != batchArch)
                {
                    RenderBatch *batch = (RenderBatch *) ObjectFactory::Instance()->New(batchArch->GetString("rb.classname"));
                    if(NULL != batch)
                    {
                        batch->Load(batchArch, sceneFile);
                        AddRenderBatch(batch);
                        batch->Release();
                    }
                }
            }
        }
    }

    AnimatedObject::Load(archive);
}
CommandInternalRemoveSceneNode::CommandInternalRemoveSceneNode(Entity* node, bool removeSimilar)
:	Command(Command::COMMAND_UNDO_REDO, CommandList::ID_COMMAND_INTERNAL_REMOVE_SCENE_NODE)
{
	commandName = "Remove Object";

	if (removeSimilar)
		commandName += "s";

	if (!node || !node->GetParent())
		return;

	if (removeSimilar)
	{
		String referenceToOwner;
		Entity* nodeParent = node->GetParent();

		KeyedArchive *customProperties = node->GetCustomProperties();
		if(customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
		{
			referenceToOwner = customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER);
		}

		nodesForDeletion.reserve(nodeParent->GetChildrenCount());

		for (int32 i = 0; i < nodeParent->GetChildrenCount(); ++i)
		{
			Entity* child = nodeParent->GetChild(i);

			customProperties = child->GetCustomProperties();
			if (customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
			{
				if (customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER) == referenceToOwner)
				{
					RemoveNodeRec removeNodeRec;
					removeNodeRec.node = SafeRetain(child);
					removeNodeRec.nodeParent = nodeParent;

					int32 i = GetNodeIndex(removeNodeRec);
					if (i >= 0 && i < nodeParent->GetChildrenCount() - 1)
						removeNodeRec.insertBeforeNode = nodeParent->GetChild(i + 1);

					nodesForDeletion.push_back(removeNodeRec);
				}
			}
		}
	}
	else
	{
		RemoveNodeRec removeNodeRec;
		removeNodeRec.node = SafeRetain(node);
		removeNodeRec.nodeParent = node->GetParent();

		int32 i = GetNodeIndex(removeNodeRec);
		if (i >= 0 && i < removeNodeRec.nodeParent->GetChildrenCount() - 1)
			removeNodeRec.insertBeforeNode = removeNodeRec.nodeParent->GetChild(i + 1);
		nodesForDeletion.push_back(removeNodeRec);
	}

	selectedNode = node;
}
示例#8
0
void EditorBodyControl::ReloadNode(Entity *node, const FilePath &pathToFile)
{//если в рут ноды сложить такие же рут ноды то на релоаде все накроет пиздой
    KeyedArchive *customProperties = node->GetCustomProperties();
    if (customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER, "") == pathToFile.GetAbsolutePathname())
    {
        Entity *newNode = scene->GetRootNode(pathToFile)->Clone();
        newNode->SetLocalTransform(node->GetLocalTransform());
        newNode->GetCustomProperties()->SetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER, pathToFile.GetAbsolutePathname());
        newNode->SetSolid(true);
        
        Entity *parent = node->GetParent();
        AddedNode addN;
        addN.nodeToAdd = newNode;
        addN.nodeToRemove = node;
        addN.parent = parent;

        nodesToAdd.push_back(addN);
        return;
    }
    
    int32 csz = node->GetChildrenCount();
    for (int ci = 0; ci < csz; ++ci)
    {
        Entity * child = node->GetChild(ci);
        ReloadNode(child, pathToFile);
    }
}
void SceneEditorScreenMain::SaveToFolder(const String & folder)
{
    BodyItem *iBody = FindCurrentBody();
	iBody->bodyControl->PushDebugCamera();
    
    SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive();
    String filePath = sceneData->GetScenePathname();
    String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath();
    String::size_type pos = filePath.find(dataSourcePath);
    if(String::npos != pos)
    {
        filePath = filePath.replace(pos, dataSourcePath.length(), "");
    }
    else
    {
        DVASSERT(0);
    }
    
	// Get project path
    KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings();
    String projectPath = keyedArchieve->GetString(String("ProjectPath"));
    
    if(!SceneSaver::Instance()) new SceneSaver();
    
    String inFolder = projectPath + String("DataSource/3d/");
    SceneSaver::Instance()->SetInFolder(inFolder);
    SceneSaver::Instance()->SetOutFolder(folder);
    
    Set<String> errorsLog;
    SceneSaver::Instance()->SaveScene(iBody->bodyControl->GetScene(), filePath, errorsLog);
    
	iBody->bodyControl->PopDebugCamera();
    
    ShowErrorDialog(errorsLog);
}
UIListCell *NodesPropertyControl::CellAtIndex(UIList *list, int32 index)
{
    UIListCell *c = (UIListCell *)list->GetReusableCell("Deletion list");
    if (!c) 
    {
        c = new UIListCell(Rect(0, 0, 200, 20), "Deletion list");
    }
    
    if(currentSceneNode)
    {
        KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
        Map<String, VariantType*> propsData = customProperties->GetArchieveData();
        int32 i = 0; 
        for (Map<String, VariantType*>::iterator it = propsData.begin(); it != propsData.end(); ++it, ++i)
        {
            if(i == index)
            {
                String name = it->first;
                
                ControlsFactory::CustomizeListCell(c, StringToWString(name));
                break;
            }
        }
    }
    
    return c;
}
void EditorBodyControl::ProcessIsSolidChanging()
{
    Entity *selectedNode = scene->GetSelection();
    if(selectedNode)
    {
        KeyedArchive *customProperties = selectedNode->GetCustomProperties();
        if(customProperties && customProperties->IsKeyExists(String(Entity::SCENE_NODE_IS_SOLID_PROPERTY_NAME)))
        {
            bool isSolid = selectedNode->GetSolid();
            selectedNode->SetSolid(!isSolid);
            
            SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
            activeScene->RebuildSceneGraphNode(selectedNode);
            
			/* #### dock -->
            KeyedArchive *properties = selectedNode->GetCustomProperties();
            if(properties && properties->IsKeyExists(String("editor.referenceToOwner")))
            {
                String filePathname = properties->GetString(String("editor.referenceToOwner"));
                activeScene->OpenLibraryForFile(filePathname);
            }
			<-- */
            
            sceneGraph->SelectNode(selectedNode);
        }
    }
}
void SceneEditorScreenMain::ExportAs(ImageFileFormat format)
{
    String formatStr;
    switch (format) 
    {
        case DAVA::PNG_FILE:
            formatStr = String("png");
            break;
            
        case DAVA::PVR_FILE:
            formatStr = String("pvr");
            break;
            
        case DAVA::DXT_FILE:
            formatStr = String("dds");
            break;
            
        default:
			DVASSERT(0);
            return;
    }
    
    
    BodyItem *iBody = FindCurrentBody();
	iBody->bodyControl->PushDebugCamera();
    
    SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive();
    String filePath = sceneData->GetScenePathname();
    String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath();
    String::size_type pos = filePath.find(dataSourcePath);
    if(String::npos != pos)
    {
        filePath = filePath.replace(pos, dataSourcePath.length(), "");
    }
    else 
    {
        DVASSERT(0);
    }
    
    // Get project path
    KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings();
    String projectPath = keyedArchieve->GetString(String("ProjectPath"));
    
    if(!SceneExporter::Instance()) new SceneExporter();
    
    String inFolder = projectPath + String("DataSource/3d/");
    SceneExporter::Instance()->SetInFolder(inFolder);
    SceneExporter::Instance()->SetOutFolder(projectPath + String("Data/3d/"));
    
    SceneExporter::Instance()->SetExportingFormat(formatStr);
    
    //TODO: how to be with removed nodes?
    Set<String> errorsLog;
    SceneExporter::Instance()->ExportScene(iBody->bodyControl->GetScene(), filePath, errorsLog);
    
	iBody->bodyControl->PopDebugCamera();
    
    ShowErrorDialog(errorsLog);
}
void VisibilityToolPanel::StoreState()
{
	KeyedArchive* customProperties = GetOrCreateCustomProperties(GetActiveScene())->GetArchive();
    customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN,
                               sliderWidgetAreaSize->GetRangeMin());
    customProperties->SetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX,
                               sliderWidgetAreaSize->GetRangeMax());
}
void QSceneGraphTreeView::ShowSceneGraphMenu(const QModelIndex &index, const QPoint &point)
{
    if(!index.isValid())
    {
        return;
    }
    
    QMenu menu;
    
	// For "custom" Particles Editor nodes the "generic" ones aren't needed".
    if (sceneGraphModel->GetParticlesEditorSceneModelHelper().NeedDisplaySceneEditorPopupMenuItems(index))
    {
		SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
		LandscapesController *landsacpesController = activeScene->GetLandscapesController();

		SceneEditorScreenMain *screen = static_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen(SCREEN_MAIN_OLD));
		EditorBodyControl *c = screen->FindCurrentBody()->bodyControl;

		bool canChangeScene = !landsacpesController->EditorLandscapeIsActive() && !c->LandscapeEditorActive();
		if(!canChangeScene)
			return;



		AddActionToMenu(&menu, QString("Look at Object"), new CommandLockAtObject());
		AddActionToMenu(&menu, QString("Remove Object"), new CommandRemoveSceneNode());
	
		AddActionToMenu(&menu, QString("Debug Flags"), new CommandDebugFlags());
    
		Entity *node = static_cast<Entity *>(sceneGraphModel->ItemData(index));
		if (node)
		{
            SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
            if(node->GetParent() == activeScene->GetScene())
            {
                KeyedArchive *properties = node->GetCustomProperties();
                if (properties && properties->IsKeyExists(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER)))
                {
                    String filePathname = properties->GetString(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER));

                    AddActionToMenu(&menu, QString("Remove Root Nodes"), new CommandRemoveRootNodes());
				}
			}
			FilePath filePathForSaveAs(activeScene->GetScenePathname());
			AddActionToMenu(&menu, QString("Save Scene As"), new CommandSaveSpecifiedScene(node, filePathForSaveAs));
		}
	}
	
	// For "custom" Particles Editor nodes the "generic" ones aren't needed".
    // We might need more menu items/actions for Particles Editor.
    sceneGraphModel->GetParticlesEditorSceneModelHelper().AddPopupMenuItems(menu, index);

    connect(&menu, SIGNAL(triggered(QAction *)), this, SLOT(SceneGraphMenuTriggered(QAction *)));
    menu.exec(point);
}
int32 NodesPropertyControl::ElementsCount(UIList * )
{
    if(currentSceneNode)
    {
        KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
        Map<String, VariantType*> propsData = customProperties->GetArchieveData();
        
        return propsData.size();
    }
    
    return 0;
}
示例#16
0
FilePath CustomColorsSystem::GetCurrentSaveFileName()
{
	String currentSaveName;

	KeyedArchive* customProps = drawSystem->GetLandscapeCustomProperties();
	if (customProps && customProps->IsKeyExists(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP))
	{
		currentSaveName = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);
	}

	return GetAbsolutePathFromProjectPath(currentSaveName);
}
void LandscapeEditorCustomColors::StoreSaveFileName(const FilePath& fileName)
{
	parent->GetSceneGraph()->UpdatePropertyPanel();
	if(NULL != workingLandscapeEntity)
	{
		KeyedArchive* customProps = workingLandscapeEntity->GetCustomProperties();

		FilePath projectPath = EditorSettings::Instance()->GetProjectPath();

		customProps->SetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP, fileName.GetRelativePathname(projectPath));
	}
}
示例#18
0
void EditorScene::SetShadowColor( const Color &color )
{
	Entity *land = GetLandscapeNode(this);
	if(!land) return;

	KeyedArchive * props = land->GetCustomProperties();
	if(!props) return;
	
	props->SetVariant("ShadowColor", VariantType(color));

	UpdateShadowColorFromLandscape();
}
示例#19
0
void EditorScene::UpdateShadowColorFromLandscape()
{
	// try to get shadow color for landscape
	Entity *land = GetLandscapeNode(this);
	if(!land) return;

	KeyedArchive * props = land->GetCustomProperties();
	if (props->IsKeyExists("ShadowColor"))
	{
		GetRenderSystem()->SetShadowRectColor(props->GetVariant("ShadowColor")->AsColor());
	}
}
示例#20
0
void SceneSaver::CopyReferencedObject( Entity *node, Set<String> &errorLog )
{
	KeyedArchive *customProperties = node->GetCustomProperties();
	if(customProperties && customProperties->IsKeyExists(ResourceEditor::EDITOR_REFERENCE_TO_OWNER))
	{
		String path = customProperties->GetString(ResourceEditor::EDITOR_REFERENCE_TO_OWNER);
		sceneUtils.CopyFile(path, errorLog);
	}
	for (int i = 0; i < node->GetChildrenCount(); i++)
	{
		CopyReferencedObject(node->GetChild(i), errorLog);
	}
}
void NodesPropertyControl::NodeCreated(bool success, const String &name, int32 type, VariantType *defaultValue)
{
    RemoveControl(propControl);
    if(success && currentSceneNode)
    {
        KeyedArchive *currentProperties = currentSceneNode->GetCustomProperties();
        
        switch (type) 
        {
			case VariantType::TYPE_STRING:    
				if(defaultValue)
				{
					currentProperties->SetString(name, defaultValue->AsString());
				}
				else
				{
					currentProperties->SetString(name, "");
				}
                break;
			case VariantType::TYPE_INT32:  
				if(defaultValue)
				{
					currentProperties->SetInt32(name, defaultValue->AsInt32());
				}
				else
				{
					currentProperties->SetInt32(name, 0);
				}
                break;
			case VariantType::TYPE_FLOAT:
				if(defaultValue)
				{
					currentProperties->SetFloat(name, defaultValue->AsFloat());
				}
				else
				{
					currentProperties->SetFloat(name, 0.f);
				}
                break;
			case VariantType::TYPE_BOOLEAN:
				if(defaultValue)
				{
					currentProperties->SetBool(name, defaultValue->AsBool());
				}
				else
				{
					currentProperties->SetBool(name, false);
				}
                break;
            default:
                break;
        }
        
        UpdateFieldsForCurrentNode();
    }
}
示例#22
0
void CameraComponent::Serialize(KeyedArchive *archive, SceneFileV2 *sceneFile)
{
	Component::Serialize(archive, sceneFile);

	if(NULL != archive && NULL != camera)
	{
		KeyedArchive *camArch = new KeyedArchive();
		camera->Save(camArch);

		archive->SetArchive("cc.camera", camArch);

		camArch->Release();
	}
}
示例#23
0
void SceneSaver::CopyReferencedObject( Entity *node, Set<String> &errorLog )
{
	KeyedArchive *customProperties = node->GetCustomProperties();
	if(customProperties && customProperties->IsKeyExists("editor.referenceToOwner"))
	{
		String path = customProperties->GetString("editor.referenceToOwner");
		sceneUtils.CopyFile(path, errorLog);
	}
	for (int i = 0; i < node->GetChildrenCount(); i++)
	{
		CopyReferencedObject(node->GetChild(i), errorLog);
	}

}
示例#24
0
void SceneValidator::ConvertLightmapSizeFromProperty(Entity *ownerNode, InstanceMaterialState *materialState)
{
	KeyedArchive * props = ownerNode->GetCustomProperties();
	Map<String, VariantType*> map = props->GetArchieveData();
	for(Map<String, VariantType*>::iterator it = map.begin(); it != map.end(); it++)
	{
		String key = it->first;
		if(key.find("lightmap.size") != String::npos && ((RenderComponent*)ownerNode->GetComponent(Component::RENDER_COMPONENT))->GetRenderObject()->GetType() != RenderObject::TYPE_LANDSCAPE)
		{
			materialState->SetLightmapSize(props->GetInt32(key, 128));
			props->DeleteKey(key);
			break;
		}
	}
}
示例#25
0
void QtLayerWin32::Resize(int32 width, int32 height)
{
    DisplayMode currentMode = DisplayMode(width, height, 16, 0);

    KeyedArchive * options = Core::Instance()->GetOptions();
    if (options)
    {
        currentMode.bpp = options->GetInt32("bpp");
    }

    RenderManager::Instance()->ChangeDisplayMode(currentMode, false);
    RenderManager::Instance()->Init(currentMode.width, currentMode.height);
    UIControlSystem::Instance()->SetInputScreenAreaSize(currentMode.width, currentMode.height);
    Core::Instance()->SetPhysicalScreenSize(currentMode.width, currentMode.height);
}
示例#26
0
void LayerForceWidget::StoreVisualState(KeyedArchive* visualStateProps)
{
	if (!visualStateProps)
		return;

	KeyedArchive* props = new KeyedArchive();

	forceTimeLine->GetVisualState(props);
	visualStateProps->SetArchive("FORCE_PROPS", props);

	props->DeleteAllKeys();
	forceOverLifeTimeLine->GetVisualState(props);
	visualStateProps->SetArchive("FORCE_OVER_LIFE_PROPS", props);

	SafeRelease(props);
}
FilePath LandscapeEditorCustomColors::GetCurrentSaveFileName()
{
	if(NULL != workingLandscapeEntity)
	{
		KeyedArchive* customProps = workingLandscapeEntity->GetCustomProperties();
		if(customProps->IsKeyExists(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP))
		{
			String currentSaveName = customProps->GetString(ResourceEditor::CUSTOM_COLOR_TEXTURE_PROP);

			FilePath projectPath = EditorSettings::Instance()->GetProjectPath();
			return projectPath + currentSaveName;
		}
	}

	return FilePath();
}
示例#28
0
DAVA::Vector<String> RecentFilesManager::GetRecentFiles()
{
	DAVA::Vector<String> retVector;
	VariantType recentFilesVariant = SettingsManager::GetValue(Settings::Internal_RecentFiles);
	if(recentFilesVariant.GetType() == DAVA::VariantType::TYPE_KEYED_ARCHIVE)
	{
		KeyedArchive* archiveRecentFiles = recentFilesVariant.AsKeyedArchive();
		DAVA::uint32 size = archiveRecentFiles->Count();
		retVector.resize(size);
		for (DAVA::uint32 i = 0; i < size; ++i)
		{
			retVector[i] = archiveRecentFiles->GetString(Format("%d", i));
		}
		
	}
	return retVector;
}
示例#29
0
KeyedArchive::KeyedArchive(const KeyedArchive &arc)
{
    const Map<String, VariantType*> &customMap = arc.GetArchieveData();
    for (Map<String, VariantType*>::const_iterator it = customMap.begin(); it != customMap.end(); it++)
    {
        SetVariant(it->first, *it->second);
    }
}
示例#30
0
KeyedArchive * KeyedArchive::GetArchiveFromByteArray(const String & key)
{
    //DVWARNING(false, "Method is depriceted! Use GetArchive()");
    KeyedArchive * archive = new KeyedArchive;
    int32 size = GetByteArraySize(key);
    if (size == 0)return 0;
    const uint8 * array = GetByteArray(key);
    DynamicMemoryFile * file = DynamicMemoryFile::Create(array, size, File::OPEN | File::READ);
    if (!archive->Load(file))
    {
        SafeRelease(file);
        SafeRelease(archive);
        return 0;
    }
    SafeRelease(file);
    return archive;
}