Exemplo n.º 1
0
ItemEditorWidget *ItemDelegate::createCustomEditor(QWidget *parent, const QModelIndex &index,
                                                   bool editNotes)
{
    cache(index);
    ItemEditorWidget *editor = new ItemEditorWidget(m_cache[index.row()], index, editNotes, parent);
    loadEditorSettings(editor);
    return editor;
}
	void EditorApplication::onStartUp()
	{
		// Find the path to data files
		//// First, look for EditorData folder in the direct descendant of the working directory 
		if (FileSystem::exists("EditorData"))
		{
			mBuiltinDataPath = FileSystem::getWorkingDirectoryPath();
			mBuiltinDataPath.append("EditorData/");
		}
		else
		{
			// Then check the source distribution itself, in case we're running directly from the build directory
			mBuiltinDataPath = Path(RAW_APP_ROOT) + Path("Data/");

			if (!FileSystem::exists(mBuiltinDataPath))
				LOGERR("Cannot find builtin assets for the editor at path '" + mBuiltinDataPath.toString() + "'.");
		}

		Application::onStartUp();

		// In editor we render game on a separate surface, handled in Game window
		SceneManager::instance().setMainRenderTarget(nullptr);

		loadEditorSettings();
		mProjectSettings = bs_shared_ptr_new<ProjectSettings>();

		ScriptCodeImporter* scriptCodeImporter = bs_new<ScriptCodeImporter>();
		Importer::instance()._registerAssetImporter(scriptCodeImporter);

		// Hidden dependency: Needs to be done before BuiltinEditorResources import as shader include lookup requires it
		ProjectLibrary::startUp();

		BuiltinEditorResources::startUp();

		{
			auto inputConfig = VirtualInput::instance().getConfiguration();

			inputConfig->registerButton("Copy", BC_C, ButtonModifier::Ctrl);
			inputConfig->registerButton("Cut", BC_X, ButtonModifier::Ctrl);
			inputConfig->registerButton("Paste", BC_V, ButtonModifier::Ctrl);
		}

		UndoRedo::startUp();
		EditorWindowManager::startUp();
		EditorWidgetManager::startUp();
		DropDownWindowManager::startUp();

		ScenePicking::startUp();
		Selection::startUp();
		GizmoManager::startUp();
		BuildManager::startUp();
		CodeEditorManager::startUp();

		MainEditorWindow::create(getPrimaryWindow());
		ScriptManager::startUp();
	}