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_H 17 #define SCENE_INTERFACE_INODE_H 18 19 #include <scene/base/types.h> 20 #include <scene/interface/intf_transform.h> 21 22 SCENE_BEGIN_NAMESPACE() 23 24 class IScene; 25 26 class INode : public ITransform { 27 META_INTERFACE(ITransform, INode, "b875c0d3-e974-4106-bbd3-4dae92fe0a50") 28 public: 29 /** 30 * @brief Enable node in 3D scene. 31 */ 32 META_PROPERTY(bool, Enabled) 33 34 /// true if the node is enabled and all its parents are enabled 35 virtual Future<bool> IsEnabledInHierarchy() const = 0; 36 37 virtual BASE_NS::string GetName() const = 0; 38 virtual Future<BASE_NS::string> GetPath() const = 0; 39 40 virtual Future<INode::Ptr> GetParent() const = 0; 41 virtual Future<BASE_NS::vector<INode::Ptr>> GetChildren() const = 0; 42 43 virtual Future<bool> AddChild(const INode::Ptr& child, size_t index = -1) = 0; 44 virtual Future<bool> RemoveChild(const INode::Ptr&) = 0; 45 46 virtual BASE_NS::shared_ptr<IScene> GetScene() const = 0; 47 }; 48 49 META_REGISTER_CLASS(Node, "4e5561d1-0313-4922-b91a-816f388efbbf", META_NS::ObjectCategoryBits::NO_CATEGORY) 50 51 SCENE_END_NAMESPACE() 52 53 META_INTERFACE_TYPE(SCENE_NS::INode) 54 55 #endif 56