コード例 #1
0
	MonoObject* ScriptEditorApplication::internal_SaveScene(MonoString* path)
	{
		Path nativePath = MonoUtil::monoToString(path);
		HSceneObject sceneRoot = gSceneManager().getRootNode();
		
		SPtr<ProjectResourceMeta> resMeta = gProjectLibrary().findResourceMeta(nativePath);
		HPrefab scene;
		if (resMeta != nullptr)
		{
			if (resMeta->getTypeID() != TID_Prefab)
				return nullptr;

			scene = static_resource_cast<Prefab>(gProjectLibrary().load(nativePath));
			scene->update(sceneRoot);

			gProjectLibrary().saveEntry(scene);
		}
		else
		{
			scene = Prefab::create(sceneRoot);
			gProjectLibrary().createEntry(scene, nativePath);
		}

		ScriptResourceBase* scriptPrefab = ScriptResourceManager::instance().getScriptResource(scene, true);
		return scriptPrefab->getManagedInstance();
	}
コード例 #2
0
	void GUIResourceTreeView::dragAndDropEnded(TreeElement* overTreeElement)
	{
		if(overTreeElement != nullptr && mDraggedResources != nullptr)
		{
			ResourceTreeElement* resourceTreeElement = static_cast<ResourceTreeElement*>(overTreeElement);

			Path destDir = resourceTreeElement->mFullPath;
			if(FileSystem::isFile(destDir))
				destDir = destDir.getParent();

			for(UINT32 i = 0; i < mDraggedResources->numObjects; i++)
			{
				WString filename = mDraggedResources->resourcePaths[i].getWFilename();
				Path currentParent = mDraggedResources->resourcePaths[i].getParent();

				if(currentParent != destDir)
				{
					Path newPath = destDir;
					newPath.append(filename);

					gProjectLibrary().moveEntry(mDraggedResources->resourcePaths[i], findUniquePath(newPath));
				}
			}
		}
	}
コード例 #3
0
	void GUIResourceTreeView::renameTreeElement(GUITreeView::TreeElement* element, const WString& name)
	{
		ResourceTreeElement* resourceTreeElement = static_cast<ResourceTreeElement*>(element);
		
		Path oldPath = resourceTreeElement->mFullPath;
		Path newPath = oldPath.getParent();
		newPath.append(name);

		gProjectLibrary().moveEntry(oldPath, findUniquePath(newPath));
	}
コード例 #4
0
	GUIResourceTreeView::GUIResourceTreeView(const String& backgroundStyle, const String& elementBtnStyle, const String& foldoutBtnStyle, 
		const String& highlightBackgroundStyle, const String& selectionBackgroundStyle, const String& editBoxStyle,
		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& dimensions)
		:GUITreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, highlightBackgroundStyle, 
		selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, dimensions), 
		mDraggedResources(nullptr), mCurrentWindow(nullptr), mDropTarget(nullptr), mDropTargetDragActive(false)
	{
		ResourceTreeViewLocator::_provide(this);

		gProjectLibrary().onEntryAdded.connect(std::bind(&GUIResourceTreeView::entryAdded, this, _1));
		gProjectLibrary().onEntryRemoved.connect(std::bind(&GUIResourceTreeView::entryRemoved, this, _1));

		const ProjectLibrary::LibraryEntry* rootEntry = gProjectLibrary().getRootEntry();

		mRootElement.mFullPath = rootEntry->path;
		mRootElement.mElementName = mRootElement.mFullPath.getWTail();

		expandElement(&mRootElement);

		updateFromProjectLibraryEntry(&mRootElement, rootEntry);
	}
コード例 #5
0
	void EditorApplication::saveProject()
	{
		if (!isProjectLoaded())
			return;

		Path buildDataPath = getProjectPath();
		buildDataPath.append(BUILD_DATA_PATH);

		BuildManager::instance().save(buildDataPath);
		saveWidgetLayout(EditorWidgetManager::instance().getLayout());
		saveEditorSettings();
		saveProjectSettings();

		gProjectLibrary().saveLibrary();
	}
コード例 #6
0
	void GUIResourceTreeView::entryAdded(const Path& path)
	{
		Path parentPath = path.getParent();

		ResourceTreeElement* parentElement = findTreeElement(parentPath);
		assert(parentElement != nullptr);

		ResourceTreeElement* newElement = addTreeElement(parentElement, path);
		sortTreeElement(parentElement);

		ProjectLibrary::LibraryEntry* libEntry = gProjectLibrary().findEntry(path);
		
		assert(libEntry != nullptr);
		updateFromProjectLibraryEntry(newElement, libEntry);

		_markLayoutAsDirty();
	}
コード例 #7
0
	void EditorApplication::unloadProject()
	{
		if (!isProjectLoaded())
			return;

		saveProject();

		mProjectSettings = bs_shared_ptr_new<ProjectSettings>();
		BuildManager::instance().clear();
		UndoRedo::instance().clear();

		EditorWidgetManager::instance().closeAll();
		gProjectLibrary().unloadLibrary();
		Resources::instance().unloadAllUnused();
		gSceneManager().clearScene();

		mProjectPath = Path::BLANK;
		mProjectName = StringUtil::BLANK;
		mIsProjectLoaded = false;
	}
コード例 #8
0
	void EditorApplication::loadProject(const Path& projectPath)
	{
		unloadProject();

		mProjectPath = projectPath;
		mProjectName = projectPath.getTail();
		mIsProjectLoaded = true;

		loadProjectSettings();

		Path buildDataPath = getProjectPath();
		buildDataPath.append(BUILD_DATA_PATH);

		BuildManager::instance().load(buildDataPath);
		gProjectLibrary().loadLibrary();

		// Do this before restoring windows to ensure types are loaded
		ScriptManager::instance().reload();
		
		SPtr<EditorWidgetLayout> layout = loadWidgetLayout();
		if (layout != nullptr)
			EditorWidgetManager::instance().setLayout(layout);
	}
コード例 #9
0
	void GUIResourceTreeView::deleteTreeElement(TreeElement* element) 
	{
		ResourceTreeElement* resourceTreeElement = static_cast<ResourceTreeElement*>(element);

		gProjectLibrary().deleteEntry(resourceTreeElement->mFullPath);
	}