• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SCENE_INTERFACE_INODE_IMPORT_H
17 #define SCENE_INTERFACE_INODE_IMPORT_H
18 
19 #include <scene/base/types.h>
20 #include <scene/interface/intf_scene.h>
21 
SCENE_BEGIN_NAMESPACE()22 SCENE_BEGIN_NAMESPACE()
23 
24 /**
25  * @brief Interface to support import another scene or nodes from another scene under a node
26  */
27 class INodeImport : public CORE_NS::IInterface {
28     META_INTERFACE(CORE_NS::IInterface, INodeImport, "7fb14660-382e-4d84-a55c-b040c89a04f4")
29 public:
30     /**
31      * @brief Adds child from another scene as child of this node.
32      *        The scenes must share the same context.
33      *        This will make a deep copy of the node and all children/resources it references.
34      * @param node Node in another scene
35      * @return The child node added or null if failed
36      */
37     virtual Future<INode::Ptr> ImportChild(const INode::ConstPtr& node) = 0;
38 
39     /**
40      * @brief Adds whole scene node hierarchy as child of this node.
41      *        The scenes must share the same context.
42      *        This will make a deep copy of the node and all children/resources it references.
43      *        This will also copy animations
44      * @param scene Scene to import
45      * @param nodeName Name for the scene's root that is copied (the name is usually empty so you can give better name
46      * here)
47      * @return The child node added (which was the root in given scene) or null if failed
48      */
49     virtual Future<INode::Ptr> ImportChildScene(const IScene::ConstPtr& scene, BASE_NS::string_view nodeName) = 0;
50     /**
51      * @brief Adds whole scene node hierarchy as child of this node.
52      * @param uri Uri of the scene resource to load.
53      * @param nodeName Name for the scene's root that is copied (the name is usually empty so you can give better name
54      * here)
55      * @return The child node added (which was the root in given scene) or null if failed
56      */
57     virtual Future<INode::Ptr> ImportChildScene(BASE_NS::string_view uri, BASE_NS::string_view nodeName) = 0;
58 
59     virtual void TrackImportedEntities(BASE_NS::array_view<const CORE_NS::Entity> entities) = 0;
60 };
61 
62 SCENE_END_NAMESPACE()
63 
64 META_INTERFACE_TYPE(SCENE_NS::INodeImport)
65 
66 #endif
67