Esempio n. 1
0
void CommandLineHandler::print_program_usage(
    const char*     program_name,
    SuperLogger&    logger) const
{
    SaveLogFormatterConfig save_config(logger);
    logger.set_format(LogMessage::Info, "{message}");

    LOG_INFO(logger, "usage: %s [project.appleseed]", program_name);
    LOG_INFO(logger, "options:");

    parser().print_usage(logger);

#ifdef _WIN32

    const StringLogTarget& target =
        static_cast<const StringLogTarget&>(logger.get_log_target());
    const QString str = QString::fromStdString(target.get_string());

    QMessageBox msgbox;
    msgbox.setWindowTitle("appleseed.studio Program Usage");
    msgbox.setIcon(QMessageBox::Information);
    msgbox.setText("<pre>" + str + "</pre>");
    msgbox.setStandardButtons(QMessageBox::Ok);
    msgbox.setDefaultButton(QMessageBox::Ok);
    msgbox.exec();

#endif
}
Esempio n. 2
0
int main(int argc, const char* argv[])
{
    SuperLogger logger;

    Application::check_installation(logger);

    CommandLineHandler cl;
    cl.parse(argc, argv, logger);

    global_logger().add_target(&logger.get_log_target());

    // Construct the schema filename.
    const filesystem::path schema_path =
          filesystem::path(Application::get_root_path())
        / "schemas/project.xsd";

    // Load the input project from disk.
    ProjectFileReader reader;
    auto_release_ptr<Project> project(
        reader.read(
            cl.m_filename.values()[0].c_str(),
            schema_path.file_string().c_str()));

    // Bail out if the project couldn't be loaded.
    if (project.get() == 0)
        return 1;

    // Write the project back to disk.
    return ProjectFileWriter::write(project.ref()) ? 0 : 1;
}
Esempio n. 3
0
int main(int argc, const char* argv[])
{
    SuperLogger logger;
    Application::check_installation(logger);

    CommandLineHandler cl;
    cl.parse(argc, argv, logger);

    // Initialize the renderer's logger.
    global_logger().add_target(&logger.get_log_target());

    // Retrieve the input file path.
    const string& input_filepath = cl.m_filename.value();

    // Construct the schema file path.
    const filesystem::path schema_filepath =
          filesystem::path(Application::get_root_path())
        / "schemas"
        / "project.xsd";

    // Read the input project from disk.
    // Note: it is crucial that we read mesh files as well, so that we can collect
    // material slots declared by objects. Material slots are required by the project
    // file updater, for instance when migrating projects from rev. 7 to rev. 8.
    ProjectFileReader reader;
    auto_release_ptr<Project> project(
        reader.read(
            input_filepath.c_str(),
            schema_filepath.string().c_str(),
            ProjectFileReader::OmitProjectFileUpdate));

    // Bail out if the project couldn't be loaded.
    if (project.get() == 0)
        return 1;

    // Update the project file to the desired revision.
    ProjectFileUpdater updater;
    if (cl.m_to_revision.is_set())
        updater.update(project.ref(), cl.m_to_revision.value());
    else updater.update(project.ref());

    // Write the project back to disk.
    const bool success =
        ProjectFileWriter::write(
            project.ref(),
            project->get_path(),
            ProjectFileWriter::OmitWritingGeometryFiles | ProjectFileWriter::OmitBringingAssets);

    return success ? 0 : 1;
}
Esempio n. 4
0
void CommandLineHandler::print_program_usage(
    const char*     program_name,
    SuperLogger&    logger) const
{
    LogTargetBase& log_target = logger.get_log_target();

    const LogMessage::FormattingFlags old_flags =
        log_target.set_formatting_flags(LogMessage::Info, LogMessage::DisplayMessage);

    LOG_INFO(logger, "usage: %s [options] project.appleseed", program_name);
    LOG_INFO(logger, "options:");

    parser().print_usage(logger);

    log_target.set_formatting_flags(LogMessage::Info, old_flags);
}
Esempio n. 5
0
int main(int argc, const char* argv[])
{
    SuperLogger logger;

    Application::check_installation(logger);

    CommandLineHandler cl;
    cl.parse(argc, argv, logger);

    global_logger().add_target(&logger.get_log_target());

    // Retrieve the input file path.
    const string& input_filepath = cl.m_filename.values()[0];

    // Construct the schema file path.
    const string schema_filepath =
        (filesystem::path(Application::get_root_path())
        / "schemas" / "project.xsd").string();

    // Load the input project from disk.
    ProjectFileReader reader;
    auto_release_ptr<Project> project(
        reader.read(
            input_filepath.c_str(),
            schema_filepath.c_str(),
            ProjectFileReader::OmitReadingMeshFiles | ProjectFileReader::OmitProjectFileUpdate));

    // Bail out if the project couldn't be loaded.
    if (project.get() == 0)
        return 1;

    // Update the project file to the desired revision.
    ProjectFileUpdater updater;
    if (cl.m_to_revision.is_set())
        updater.update(project.ref(), cl.m_to_revision.values()[0]);
    else updater.update(project.ref());

    // Write the project back to disk.
    const bool success =
        ProjectFileWriter::write(
            project.ref(),
            project->get_path(),
            ProjectFileWriter::OmitWritingMeshFiles | ProjectFileWriter::OmitCopyingAssets);

    return success ? 0 : 1;
}
Esempio n. 6
0
int main(int argc, const char* argv[])
{
    SuperLogger logger;
    Application::check_installation(logger);

    CommandLineHandler cl;
    cl.parse(argc, argv, logger);

    // Initialize the renderer's logger.
    global_logger().add_target(&logger.get_log_target());

    // Retrieve the command line arguments.
    const string& input_filepath = cl.m_filenames.values()[0];
    const string& output_filepath = cl.m_filenames.values()[1];
    const FluffParams params(cl);

    // Construct the schema file path.
    const filesystem::path schema_filepath =
          filesystem::path(Application::get_root_path())
        / "schemas"
        / "project.xsd";

    // Read the input project from disk.
    ProjectFileReader reader;
    auto_release_ptr<Project> project(
        reader.read(
            input_filepath.c_str(),
            schema_filepath.string().c_str()));

    // Bail out if the project couldn't be loaded.
    if (project.get() == 0)
        return 1;

    // Fluffify the project.
    make_fluffy(project.ref(), params);

    // Write the project back to disk.
    const bool success =
        ProjectFileWriter::write(
            project.ref(),
            output_filepath.c_str());

    return success ? 0 : 1;
}
Esempio n. 7
0
int main(int argc, const char* argv[])
{
    SuperLogger logger;

    Application::check_installation(logger);

    g_cl.parse(argc, argv, logger);

    global_logger().add_target(&logger.get_log_target());

    const string base_output_filename =
        filesystem::path(g_cl.m_filenames.values()[1]).stem().string();

    auto_ptr<AnimationGenerator> generator;

    if (g_cl.m_animation_path.is_set())
        generator.reset(new PathAnimationGenerator(base_output_filename, logger));
    else generator.reset(new TurntableAnimationGenerator(base_output_filename, logger));

    generator->generate();

    return 0;
}