예제 #1
0
void GameView::init(Lumix::WorldEditor& editor)
{
	m_editor = &editor;
	auto& engine = editor.getEngine();
	auto* renderer = static_cast<Lumix::Renderer*>(engine.getPluginManager().getPlugin("renderer"));
	Lumix::Path path("pipelines/game_view.lua");
	m_pipeline = Lumix::Pipeline::create(*renderer, path, engine.getAllocator());
	m_pipeline->load();

	editor.universeCreated().bind<GameView, &GameView::onUniverseCreated>(this);
	editor.universeDestroyed().bind<GameView, &GameView::onUniverseDestroyed>(this);
	onUniverseCreated();
}
예제 #2
0
bool SceneView::init(LogUI& log_ui, Lumix::WorldEditor& editor, Lumix::Array<Action*>& actions)
{
	m_log_ui = &log_ui;
	m_editor = &editor;
	auto& engine = editor.getEngine();
	auto& allocator = engine.getAllocator();
	auto* renderer = static_cast<Lumix::Renderer*>(engine.getPluginManager().getPlugin("renderer"));
	m_is_opengl = renderer->isOpenGL();
	Lumix::Path path("pipelines/main.lua");
	m_pipeline = Lumix::Pipeline::create(*renderer, path, engine.getAllocator());
	m_pipeline->load();
	m_pipeline->addCustomCommandHandler("renderGizmos")
		.callback.bind<SceneView, &SceneView::renderGizmos>(this);
	m_pipeline->addCustomCommandHandler("renderIcons")
		.callback.bind<SceneView, &SceneView::renderIcons>(this);

	editor.universeCreated().bind<SceneView, &SceneView::onUniverseCreated>(this);
	editor.universeDestroyed().bind<SceneView, &SceneView::onUniverseDestroyed>(this);

	m_toggle_gizmo_step_action =
		LUMIX_NEW(editor.getAllocator(), Action)("Enable/disable gizmo step", "toggleGizmoStep");
	m_toggle_gizmo_step_action->is_global = false;
	actions.push(m_toggle_gizmo_step_action);

	m_move_forward_action = LUMIX_NEW(editor.getAllocator(), Action)("Move forward", "moveForward");
	m_move_forward_action->is_global = false;
	actions.push(m_move_forward_action);

	m_move_back_action = LUMIX_NEW(editor.getAllocator(), Action)("Move back", "moveBack");
	m_move_back_action->is_global = false;
	actions.push(m_move_back_action);

	m_move_left_action = LUMIX_NEW(editor.getAllocator(), Action)("Move left", "moveLeft");
	m_move_left_action->is_global = false;
	actions.push(m_move_left_action);

	m_move_right_action = LUMIX_NEW(editor.getAllocator(), Action)("Move right", "moveRight");
	m_move_right_action->is_global = false;
	actions.push(m_move_right_action);

	m_move_up_action = LUMIX_NEW(editor.getAllocator(), Action)("Move up", "moveUp");
	m_move_up_action->is_global = false;
	actions.push(m_move_up_action);

	m_move_down_action = LUMIX_NEW(editor.getAllocator(), Action)("Move down", "moveDown");
	m_move_down_action->is_global = false;
	actions.push(m_move_down_action);

	return true;
}
예제 #3
0
AssetBrowser::AssetBrowser(Lumix::WorldEditor& editor, Metadata& metadata)
	: m_editor(editor)
	, m_metadata(metadata)
	, m_resources(editor.getAllocator())
	, m_selected_resource(nullptr)
	, m_autoreload_changed_resource(true)
	, m_changed_files(editor.getAllocator())
	, m_is_focus_requested(false)
	, m_changed_files_mutex(false)
	, m_history(editor.getAllocator())
	, m_plugins(editor.getAllocator())
	, m_on_resource_changed(editor.getAllocator())
{
	m_is_update_enabled = true;
	m_filter[0] = '\0';
	m_current_type = 0;
	m_is_opened = false;
	m_activate = false;
	m_resources.emplace(editor.getAllocator());

	findResources();

	const char* base_path = editor.getEngine().getDiskFileDevice()->getBasePath();
	m_watchers[0] = FileSystemWatcher::create(base_path, editor.getAllocator());
	m_watchers[0]->getCallback().bind<AssetBrowser, &AssetBrowser::onFileChanged>(this);
	if (editor.getEngine().getPatchFileDevice())
	{
		base_path = editor.getEngine().getPatchFileDevice()->getBasePath();
		m_watchers[1] = FileSystemWatcher::create(base_path, editor.getAllocator());
		m_watchers[1]->getCallback().bind<AssetBrowser, &AssetBrowser::onFileChanged>(this);
	}
	else
	{
		m_watchers[1] = nullptr;
	}
}