Example #1
0
void Scene::collect_asset_paths(StringArray& paths) const
{
    BaseGroup::collect_asset_paths(paths);

    do_collect_asset_paths(paths, cameras());

    if (impl->m_environment.get())
        impl->m_environment->collect_asset_paths(paths);

    do_collect_asset_paths(paths, environment_edfs());
    do_collect_asset_paths(paths, environment_shaders());
}
Example #2
0
bool AssetHandler::handle_assets() const
{
    StringArray paths;

    Scene* scene = m_project.get_scene();
    if (scene)
        scene->collect_asset_paths(paths);

    Frame* frame = m_project.get_frame();
    if (frame)
        frame->collect_asset_paths(paths);

    do_collect_asset_paths(paths, m_project.render_layer_rules());
    do_collect_asset_paths(paths, m_project.configurations());

    vector<string> unique_paths = array_vector<vector<string> >(paths);
    sort(unique_paths.begin(), unique_paths.end());
    unique_paths.erase(
        unique(unique_paths.begin(), unique_paths.end()),
        unique_paths.end());

    StringDictionary mappings;
    bool success = true;

    for (size_t i = 0, e = unique_paths.size(); i < e; ++i)
    {
        string asset_path = unique_paths[i];

        if (!handle_asset(asset_path))
            success = false;

        mappings.insert(unique_paths[i], asset_path);
    }

    if (!success)
        return false;

    if (scene)
        scene->update_asset_paths(mappings);

    if (frame)
        frame->update_asset_paths(mappings);

    do_update_asset_paths(mappings, m_project.render_layer_rules());
    do_update_asset_paths(mappings, m_project.configurations());

    // If we copied all assets, we no longer need the absolute search paths, so remove them.
    if (m_mode == CopyAllAssets)
        remove_absolute_search_paths(m_project.search_paths());

    return true;
}
Example #3
0
void BaseGroup::collect_asset_paths(StringArray& paths) const
{
    do_collect_asset_paths(paths, colors());
    do_collect_asset_paths(paths, textures());
    do_collect_asset_paths(paths, texture_instances());
#ifdef APPLESEED_WITH_OSL
    do_collect_asset_paths(paths, shader_groups());
#endif
    do_collect_asset_paths(paths, assemblies());
    do_collect_asset_paths(paths, assembly_instances());
}