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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ message(STATUS "Using Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VE
message(STATUS "Compiler at path:" ${CMAKE_CXX_COMPILER})

add_compile_definitions(
ATLAS_VERSION="Alpha 9"
ATLAS_VERSION="Release Candidate for Beta 1"
OPAL_VERSION="3 Tetrahedron"
)

Expand Down
560 changes: 283 additions & 277 deletions editor/views/editor/editor.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions editor/views/editor/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ bool ViewportPanel::applyRuntimeMaterialDirect(int id, const QString &path) {
runtimeContext->saveCurrentScene();
refreshSceneSnapshot();
setSceneDirty(true);
reloadRuntime();
return true;
}

Expand Down
44 changes: 41 additions & 3 deletions editor/views/general/contentBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@ bool isValidEntryName(const QString &name) {
!name.contains('/') && !name.contains('\\');
}

QString requestFilePath(QWidget *parent, const QString &directory,
const QString &title, const QString &label,
const QString &defaultName, const QString &extension) {
bool accepted = false;
QString name = QInputDialog::getText(parent, title, label, QLineEdit::Normal,
defaultName, &accepted)
.trimmed();
if (!accepted)
return {};

const QString suffix = "." + extension;
if (name.endsWith(suffix, Qt::CaseInsensitive))
name.chop(suffix.size());
name = name.trimmed();
if (!isValidEntryName(name)) {
QMessageBox::warning(parent, title, "Enter a valid file name.");
return {};
}

const QString path = QDir(directory).filePath(name + suffix);
if (QFileInfo::exists(path)) {
QMessageBox::warning(parent, title,
"A file with that name already exists.");
return {};
}
return path;
}

bool copyEntry(const QString &source, const QString &destination) {
const QFileInfo info(source);
if (info.isDir()) {
Expand Down Expand Up @@ -474,14 +502,20 @@ void ContentBrowserPanel::createFolder() {
}

void ContentBrowserPanel::createScene() {
const QString path = uniquePath("New Scene.ascene");
const QString path = requestFilePath(this, currentPath, "New Scene",
"Scene name", "New Scene", "ascene");
if (path.isEmpty())
return;
if (writeNewFile(path, EmptyScene)) {
gridView->setCurrentIndex(model->index(path));
}
}

void ContentBrowserPanel::createScript() {
const QString path = uniquePath("NewScript.ts");
const QString path = requestFilePath(this, currentPath, "New Script",
"Script name", "NewScript", "ts");
if (path.isEmpty())
return;
const QString relativePath = QDir(projectRoot).relativeFilePath(path);
QString componentName = QFileInfo(path).completeBaseName();
componentName.remove(QRegularExpression("[^A-Za-z0-9_$]"));
Expand All @@ -502,7 +536,11 @@ void ContentBrowserPanel::createScript() {
}

void ContentBrowserPanel::createMaterial() {
const QString path = uniquePath("New Material.amat");
const QString path = requestFilePath(this, currentPath, "New Material",
"Material name", "New Material",
"amat");
if (path.isEmpty())
return;
const QByteArray material =
"{\n"
" \"material\": {\n"
Expand Down
Loading
Loading