Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New project format #2854

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
26 changes: 13 additions & 13 deletions src/appleseed.python/bindproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,27 +248,28 @@ namespace
}

bpy::object project_file_reader_read_default_opts(
ProjectFileReader* reader,
const char* project_filename,
const char* schema_filename)
{
auto_release_ptr<Project> project(reader->read(project_filename, schema_filename));
auto_release_ptr<Project> project(
ProjectFileReader::read(project_filename, schema_filename));
return bpy::object(project);
}

bpy::object project_file_reader_read_with_opts(
ProjectFileReader* reader,
const char* project_filename,
const char* schema_filename,
const ProjectFileReader::Options opts)
{
auto_release_ptr<Project> project(reader->read(project_filename, schema_filename, opts));
auto_release_ptr<Project> project(
ProjectFileReader::read(project_filename, schema_filename, opts));
return bpy::object(project);
}

bpy::object project_file_reader_load_builtin(ProjectFileReader* reader, const char* project_name)
bpy::object project_file_reader_load_builtin(const char* project_name)
{
auto_release_ptr<Project> project(reader->load_builtin(project_name));
auto_release_ptr<Project> project(
ProjectFileReader::load_builtin(project_name));
return bpy::object(project);
}

Expand Down Expand Up @@ -353,9 +354,9 @@ void bind_project()
.value("OmitProjectSchemaValidation", ProjectFileReader::OmitProjectSchemaValidation);

bpy::class_<ProjectFileReader>("ProjectFileReader")
.def("read", &project_file_reader_read_default_opts)
.def("read", &project_file_reader_read_with_opts)
.def("load_builtin", &project_file_reader_load_builtin);
.def("read", &project_file_reader_read_default_opts).staticmethod("read")
.def("read", &project_file_reader_read_with_opts).staticmethod("read")
.def("load_builtin", &project_file_reader_load_builtin).staticmethod("load_builtin");

bpy::enum_<ProjectFileWriter::Options>("ProjectFileWriterOptions")
.value("Defaults", ProjectFileWriter::Defaults)
Expand All @@ -365,8 +366,7 @@ void bind_project()
.value("CopyAllAssets", ProjectFileWriter::CopyAllAssets);

bpy::class_<ProjectFileWriter>("ProjectFileWriter")
// These methods are static but for symmetry with ProjectFileReader we're exposing them as non-static.
.def("write", write_project_default_opts)
.def("write", write_project_with_opts)
.def("write", write_project_with_opts_and_comments);
.def("write", write_project_default_opts).staticmethod("write")
.def("write", write_project_with_opts).staticmethod("write")
.def("write", write_project_with_opts_and_comments).staticmethod("write");
}
1 change: 1 addition & 0 deletions src/appleseed.qtcommon/project/projectmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

// appleseed.foundation headers.
#include "foundation/platform/compiler.h"
#include "foundation/utility/searchpaths.h"

// Qt headers.
#include <QFutureWatcher>
Expand Down
6 changes: 2 additions & 4 deletions src/appleseed.studio/mainwindow/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,8 @@ bool MainWindow::save_project(QString filepath)
if (!m_project_manager.is_project_open())
return false;

const QString Extension = "appleseed";

if (QFileInfo(filepath).suffix() != Extension)
filepath += "." + Extension;
if (QFileInfo(filepath).suffix().isEmpty())
filepath += ".appleseed";

if (m_project_file_watcher)
stop_monitoring_project_file();
Expand Down
8 changes: 8 additions & 0 deletions src/appleseed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,10 @@ source_group ("renderer\\modeling\\postprocessingstage" FILES
)

set (renderer_modeling_project_sources
renderer/modeling/project/appleseedprojectfilereader.cpp
renderer/modeling/project/appleseedprojectfilereader.h
renderer/modeling/project/appleseedprojectfilewriter.cpp
renderer/modeling/project/appleseedprojectfilewriter.h
renderer/modeling/project/assethandler.cpp
renderer/modeling/project/assethandler.h
renderer/modeling/project/configuration.cpp
Expand All @@ -2028,6 +2032,10 @@ set (renderer_modeling_project_sources
renderer/modeling/project/projecttracker.cpp
renderer/modeling/project/projecttracker.h
renderer/modeling/project/renderingtimer.h
renderer/modeling/project/xmlprojectfilereader.cpp
renderer/modeling/project/xmlprojectfilereader.h
renderer/modeling/project/xmlprojectfilewriter.cpp
renderer/modeling/project/xmlprojectfilewriter.h
)
list (APPEND appleseed_sources
${renderer_modeling_project_sources}
Expand Down
8 changes: 4 additions & 4 deletions src/appleseed/foundation/utility/z85.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ unsigned char decoder [96] =

}

size_t z85_encoded_size(const size_t size)
std::size_t z85_encoded_size(const std::size_t size)
{
assert(size % 4 == 0);
return size * 5 / 4;
}

size_t z85_decoded_size(const size_t size)
std::size_t z85_decoded_size(const std::size_t size)
{
assert(size % 5 == 0);
return size * 4 / 5;
}

void z85_encode(const unsigned char* src, const size_t size, char* dst)
void z85_encode(const unsigned char* src, const std::size_t size, char* dst)
{
assert(size % 4 == 0);

Expand Down Expand Up @@ -115,7 +115,7 @@ void z85_encode(const unsigned char* src, const size_t size, char* dst)
assert(char_nbr == z85_encoded_size(size));
}

void z85_decode(const char* src, const size_t size, unsigned char* dst)
void z85_decode(const char* src, const std::size_t size, unsigned char* dst)
{
assert(size % 5 == 0);

Expand Down
8 changes: 4 additions & 4 deletions src/appleseed/foundation/utility/z85.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
namespace foundation
{

size_t z85_encoded_size(const size_t size);
size_t z85_decoded_size(const size_t size);
size_t z85_encoded_size(const std::size_t size);
size_t z85_decoded_size(const std::size_t size);

void z85_encode(const unsigned char* src, const size_t size, char* dst);
void z85_decode(const char* src, const size_t size, unsigned char* dst);
void z85_encode(const unsigned char* src, const std::size_t size, char* dst);
void z85_decode(const char* src, const std::size_t size, unsigned char* dst);

} // namespace foundation
Loading