1 2 // 3 // This source file is part of appleseed. 4 // Visit https://appleseedhq.net/ for additional information and resources. 5 // 6 // This software is released under the MIT license. 7 // 8 // Copyright (c) 2016-2018 Esteban Tovagliari, The appleseedhq Organization 9 // 10 // Permission is hereby granted, free of charge, to any person obtaining a copy 11 // of this software and associated documentation files (the "Software"), to deal 12 // in the Software without restriction, including without limitation the rights 13 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 // copies of the Software, and to permit persons to whom the Software is 15 // furnished to do so, subject to the following conditions: 16 // 17 // The above copyright notice and this permission notice shall be included in 18 // all copies or substantial portions of the Software. 19 // 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 // THE SOFTWARE. 27 // 28 29 #pragma once 30 31 // appleseed.renderer headers. 32 #include "renderer/modeling/scene/basegroup.h" 33 #include "renderer/modeling/scene/iassemblyfactory.h" 34 #include "renderer/modeling/scene/proceduralassembly.h" 35 36 // appleseed.foundation headers. 37 #include "foundation/platform/compiler.h" 38 #include "foundation/utility/autoreleaseptr.h" 39 40 // appleseed.main headers. 41 #include "main/dllsymbol.h" 42 43 // Forward declarations. 44 namespace foundation { class Dictionary; } 45 namespace foundation { class DictionaryArray; } 46 namespace foundation { class IAbortSwitch; } 47 namespace foundation { class StringArray; } 48 namespace foundation { class StringDictionary; } 49 namespace renderer { class ParamArray; } 50 namespace renderer { class Project; } 51 52 namespace renderer 53 { 54 55 // 56 // An archive assembly loads and references geometries, materials and lights 57 // from other appleseed projects. 58 // 59 60 class APPLESEED_DLLSYMBOL ArchiveAssembly 61 : public ProceduralAssembly 62 { 63 public: 64 // Delete this instance. 65 void release() override; 66 67 // Return a string identifying the model of this entity. 68 const char* get_model() const override; 69 70 // Expose asset file paths referenced by this entity to the outside. 71 void collect_asset_paths(foundation::StringArray& paths) const override; 72 void update_asset_paths(const foundation::StringDictionary& mappings) override; 73 74 private: 75 friend class ArchiveAssemblyFactory; 76 77 // Constructor. 78 ArchiveAssembly( 79 const char* name, 80 const ParamArray& params); 81 82 // Expand the contents of the assembly. 83 bool do_expand_contents( 84 const Project& project, 85 const Assembly* parent, 86 foundation::IAbortSwitch* abort_switch = nullptr) override; 87 88 bool m_archive_opened; 89 }; 90 91 92 // 93 // ArchiveAssembly factory. 94 // 95 96 class APPLESEED_DLLSYMBOL ArchiveAssemblyFactory 97 : public IAssemblyFactory 98 { 99 public: 100 // Delete this instance. 101 void release() override; 102 103 // Return a string identifying this assembly model. 104 const char* get_model() const override; 105 106 // Return metadata for this assembly model. 107 foundation::Dictionary get_model_metadata() const override; 108 109 // Return metadata for the inputs of this assembly model. 110 foundation::DictionaryArray get_input_metadata() const override; 111 112 // Create a new assembly. 113 foundation::auto_release_ptr<Assembly> create( 114 const char* name, 115 const ParamArray& params = ParamArray()) const override; 116 }; 117 118 } // namespace renderer 119