Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ int main(int argc, char *argv[]) {
Engine::setPlatformAdaptor(&EditorPlatform::instance());

ProjectSettings::instance()->init(parser.value(sourceFileOption).toStdString(), parser.value(targetDirectoryOption).toStdString());
ProjectSettings::instance()->loadSettings();

PluginManager::instance()->init(&engine);
AssetManager::instance()->init();

ProjectSettings::instance()->loadSettings();
ProjectSettings::instance()->loadPlatforms();

if(!PluginManager::instance()->rescanProject(ProjectSettings::instance()->pluginsPath())) {
Expand Down
8 changes: 1 addition & 7 deletions engine/src/editor/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,7 @@ void PluginManager::destroy() {
void PluginManager::init(Engine *engine) {
m_engine = engine;

QString uiKit;

#if defined(Q_OS_UNIX)/* && !defined(Q_OS_MAC)*/
uiKit = QCoreApplication::applicationDirPath() + "/../lib/uikit-editor" + gShared;
#else
uiKit = QCoreApplication::applicationDirPath() + "/uikit-editor" + gShared;
#endif
syncWhiteList();

loadPlugin((QCoreApplication::applicationDirPath() + "/uikit-editor" + gShared).toStdString());
rescanPath((QCoreApplication::applicationDirPath() + "/plugins").toStdString());
Expand Down
84 changes: 49 additions & 35 deletions engine/src/editor/viewport/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,42 +83,44 @@ void Viewport::init() {
m_rhiWindow->installEventFilter(this);
layout()->addWidget(QWidget::createWindowContainer(m_rhiWindow));

PipelineContext *pipelineContext = m_renderSystem->pipelineContext();
m_guiLayer = pipelineContext->renderTasks().back();
PipelineContext *ctx = m_renderSystem->pipelineContext();
if(!ctx->renderTasks().empty()) {
m_guiLayer = ctx->renderTasks().back();

m_color = pipelineContext->resultTexture();
m_color->setFlags(m_color->flags() | Texture::Feedback);
m_color = ctx->resultTexture();
m_color->setFlags(m_color->flags() | Texture::Feedback);

m_debugRender = new DebugRender;
m_debugRender = new DebugRender;

if(!m_gameView) {
m_gridRender = new GridRender;
m_gridRender->setController(m_controller);
m_gridRender->setInput(0, m_guiLayer->output(0));
m_gridRender->setInput(1, pipelineContext->textureBuffer("depthMap"));
if(!m_gameView) {
m_gridRender = new GridRender;
m_gridRender->setController(m_controller);
m_gridRender->setInput(0, m_guiLayer->output(0));
m_gridRender->setInput(1, ctx->textureBuffer("depthMap"));

m_outlinePass = new Outline;
m_outlinePass->setController(m_controller);
m_outlinePass->setInput(0, m_guiLayer->output(0));
m_outlinePass = new Outline;
m_outlinePass->setController(m_controller);
m_outlinePass->setInput(0, m_guiLayer->output(0));

m_gizmoRender = new GizmoRender;
m_gizmoRender->setController(m_controller);
m_gizmoRender->setInput(0, m_guiLayer->output(0));
m_gizmoRender->setInput(1, pipelineContext->textureBuffer("depthMap"));
m_gizmoRender = new GizmoRender;
m_gizmoRender->setController(m_controller);
m_gizmoRender->setInput(0, m_guiLayer->output(0));
m_gizmoRender->setInput(1, ctx->textureBuffer("depthMap"));

if(m_controller) {
m_controller->init(this);
}
if(m_controller) {
m_controller->init(this);
}

pipelineContext->insertRenderTask(m_gridRender, m_guiLayer);
pipelineContext->insertRenderTask(m_outlinePass, m_guiLayer);
pipelineContext->insertRenderTask(m_gizmoRender);
ctx->insertRenderTask(m_gridRender, m_guiLayer);
ctx->insertRenderTask(m_outlinePass, m_guiLayer);
ctx->insertRenderTask(m_gizmoRender);

Handles::init();
}
Handles::init();
}

pipelineContext->insertRenderTask(m_debugRender, m_guiLayer);
pipelineContext->subscribePost(Viewport::readPixels, this);
ctx->insertRenderTask(m_debugRender, m_guiLayer);
ctx->subscribePost(Viewport::readPixels, this);
}
}
}

Expand Down Expand Up @@ -279,33 +281,45 @@ void Viewport::setGameView(bool enabled) {
}

void Viewport::setGridEnabled(bool enabled) {
m_gridRender->setEnabled(enabled);
if(m_gridRender) {
m_gridRender->setEnabled(enabled);
}
}
void Viewport::setGizmoEnabled(bool enabled) {
m_gizmoRender->setEnabled(enabled);
if(m_gizmoRender) {
m_gizmoRender->setEnabled(enabled);
}
}
void Viewport::setOutlineEnabled(bool enabled) {
m_outlinePass->setEnabled(enabled);
if(m_outlinePass) {
m_outlinePass->setEnabled(enabled);
}
}
void Viewport::setGuiEnabled(bool enabled) {
m_guiLayer->setEnabled(enabled);
if(m_guiLayer) {
m_guiLayer->setEnabled(enabled);
}
}

void Viewport::showCube(bool enabled) {
m_gizmoRender->showCube(enabled);
if(m_gizmoRender) {
m_gizmoRender->showCube(enabled);
}
}

void Viewport::showGizmos(bool enabled) {
m_gizmoRender->showGizmos(enabled);
if(m_gizmoRender) {
m_gizmoRender->showGizmos(enabled);
}
}

void Viewport::onInProgressFlag(bool flag) {
m_frameInProgress = flag;
}

void Viewport::addRenderTask(PipelineTask *task) {
PipelineContext *pipelineContext = m_renderSystem->pipelineContext();
pipelineContext->insertRenderTask(task, pipelineContext->renderTasks().front());
PipelineContext *ctx = m_renderSystem->pipelineContext();
ctx->insertRenderTask(task, ctx->renderTasks().empty() ? nullptr : ctx->renderTasks().front());
}

void Viewport::readPixels(void *object) {
Expand Down
14 changes: 9 additions & 5 deletions engine/src/pipelinecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ void PipelineContext::draw(Camera *camera) {
}
}

m_finalMaterial->setTexture(gTexture, resultTexture());
if(m_finalMaterial) {
m_finalMaterial->setTexture(gTexture, resultTexture());

// Finish
m_buffer->setRenderTarget(m_defaultTarget);
m_buffer->drawMesh(defaultPlane(), 0, Material::Opaque, *m_finalMaterial);
// Finish
m_buffer->setRenderTarget(m_defaultTarget);
m_buffer->drawMesh(defaultPlane(), 0, Material::Opaque, *m_finalMaterial);
}

for(auto it : m_postObservers) {
(*it.first)(it.second);
Expand Down Expand Up @@ -297,7 +299,9 @@ Mesh *PipelineContext::defaultCube() {
static Mesh *cube = nullptr;
if(cube == nullptr) {
cube = Engine::loadResource<Mesh>(".embedded/cube.fbx/Box001");
cube->incRef();
if(cube) {
cube->incRef();
}
}
return cube;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>uikit-editor.lib;angel-editor.lib;bullet-editor.lib;media-editor.lib;motiontools.lib;network-editor.lib;particletools.lib;pipelinetools.lib;qbstools.lib;rendergl-editor.lib;shadertools.lib;spineimporter.lib;texteditor.lib;texturetools.lib;tiledimporter.lib;timeline.lib;webtools.lib;next-editor.lib;engine-editor.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalDependencies>uikit-editor.lib;angel-editor.lib;bullet-editor.lib;media-editor.lib;motiontools.lib;network-editor.lib;particletools.lib;pipelinetools.lib;rendergl-editor.lib;shadertools.lib;spineimporter.lib;texteditor.lib;texturetools.lib;tiledimporter.lib;timeline.lib;webtools.lib;next-editor.lib;engine-editor.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>${sdkPath}/windows/x86_64/lib;${sdkPath}/windows/x86_64/bin;${sdkPath}/windows/x86_64/bin/plugins;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
<DataExecutionPrevention>
Expand Down Expand Up @@ -160,7 +160,7 @@
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>uikit-editor.lib;angel-editor.lib;bullet-editor.lib;media-editor.lib;motiontools.lib;network-editor.lib;particletools.lib;pipelinetools.lib;qbstools.lib;rendergl-editor.lib;shadertools.lib;spineimporter.lib;texteditor.lib;texturetools.lib;tiledimporter.lib;timeline.lib;webtools.lib;next-editor.lib;engine-editor.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalDependencies>uikit-editor.lib;angel-editor.lib;bullet-editor.lib;media-editor.lib;motiontools.lib;network-editor.lib;particletools.lib;pipelinetools.lib;rendergl-editor.lib;shadertools.lib;spineimporter.lib;texteditor.lib;texturetools.lib;tiledimporter.lib;timeline.lib;webtools.lib;next-editor.lib;engine-editor.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>${sdkPath}/windows/x86_64/lib;${sdkPath}/windows/x86_64/bin;${sdkPath}/windows/x86_64/bin/plugins;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
<DataExecutionPrevention>
Expand All @@ -183,7 +183,7 @@
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="plugin.cpp" />
<ClCompile Include="../generated/plugin.cpp" />
${FilesList}
</ItemGroup>
<ItemGroup />
Expand Down
1 change: 1 addition & 0 deletions thirdparty/next/inc/os/aprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class NEXT_LIBRARY_EXPORT Process : public Object {
int exitCode() const;
bool isRunning() const;

static bool openUrl(const TString &url);
static bool startDetached(const TString &program, const StringList &arguments, const TString &workingDirectory, const ProcessEnvironment &environment);

public: // signals
Expand Down
16 changes: 15 additions & 1 deletion thirdparty/next/src/os/aprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#endif

#include "processenvironment.h"
#include "log.h"

class ProcessPrivate {
public:
Expand Down Expand Up @@ -251,6 +250,21 @@ bool Process::start(const TString &program, const StringList &arguments) {
return true;
}

bool Process::openUrl(const TString &url) {
StringList args;
#ifdef _WIN32
TString command(url);
#elif __APPLE__
TString command("open");
args.push_back(url);
#else
TString command("xdg-open");
args.push_back(url);
#endif

return startDetached(command, args, TString(), ProcessEnvironment::systemEnvironment());
}

bool Process::startDetached(const TString &program, const StringList &arguments, const TString &workingDirectory, const ProcessEnvironment &environment) {
#ifdef _WIN32
TString commandLine = program + " ";
Expand Down
16 changes: 11 additions & 5 deletions worldeditor/src/main/documentmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <editor/projectsettings.h>
#include <editor/pluginmanager.h>

#include <os/aprocess.h>

DocumentModel::DocumentModel() {
for(auto &it : PluginManager::instance()->extensions("editor")) {
addEditor(reinterpret_cast<AssetEditor *>(PluginManager::instance()->getPluginObject(it)));
Expand Down Expand Up @@ -48,7 +50,7 @@ void DocumentModel::newFile(AssetEditor *editor) {
}
}

AssetEditor *DocumentModel::openFile(const QString &path) {
AssetEditor *DocumentModel::openFile(const QString &path) {
QDir dir(ProjectSettings::instance()->contentPath().data());
AssetConverterSettings *settings = AssetManager::instance()->fetchSettings(dir.absoluteFilePath(path).toStdString());

Expand Down Expand Up @@ -81,10 +83,14 @@ AssetEditor *DocumentModel::openFile(const QString &path) {
}
}

if(editor && settings) {
editor->loadAsset(settings);
if(std::find(m_documents.begin(), m_documents.end(), editor) == m_documents.end()) {
m_documents.push_back(editor);
if(settings) {
if(editor) {
editor->loadAsset(settings);
if(std::find(m_documents.begin(), m_documents.end(), editor) == m_documents.end()) {
m_documents.push_back(editor);
}
} else {
Process::openUrl(settings->source());
}
}

Expand Down
6 changes: 2 additions & 4 deletions worldeditor/src/main/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ void MainWindow::setGameMode(bool mode) {
void MainWindow::onOpenProject(const QString &path) {
ProjectModel::addProject(path.toStdString());
m_projectSettings->init(path.toStdString());
m_projectSettings->loadSettings();

PluginManager::instance()->init(m_engine);

Expand All @@ -301,7 +302,6 @@ void MainWindow::onOpenProject(const QString &path) {

AssetManager::instance()->init();

m_projectSettings->loadSettings();
m_projectSettings->loadPlatforms();
// Read settings early for converters
m_editorSettings->loadSettings();
Expand Down Expand Up @@ -334,7 +334,7 @@ void MainWindow::onImportFinished() {
m_preview = new Preview(this);

m_editorSettings->loadSettings();
m_projectSettings->loadSettings();

m_editorSettingsBrowser->init();
m_projectSettingsBrowser->init();

Expand Down Expand Up @@ -641,8 +641,6 @@ void MainWindow::build(QString platform) {
args << "-p" << platform;
}

qDebug() << args.join(" ");

m_builder->start("Builder", args);
if(!m_builder->waitForStarted()) {
aError() << qPrintable(m_builder->errorString());
Expand Down
Loading