| 3880 | } |
| 3881 | |
| 3882 | static dmGui::Result CloneNodeListToTable(lua_State* L, dmGui::HScene scene, uint16_t start_index, dmGui::HNode parent) |
| 3883 | { |
| 3884 | uint32_t index = start_index; |
| 3885 | dmGui::Result result = dmGui::RESULT_OK; |
| 3886 | |
| 3887 | dmArray<uint32_t> indices; |
| 3888 | |
| 3889 | // Make sure we know the indices to copy up front, as the cloning will modify the "node->m_NextIndex" list. |
| 3890 | while (index != INVALID_INDEX && result == dmGui::RESULT_OK) |
| 3891 | { |
| 3892 | if (indices.Full()) |
| 3893 | indices.OffsetCapacity(32); |
| 3894 | |
| 3895 | indices.Push(index); |
| 3896 | |
| 3897 | InternalNode* node = &scene->m_Nodes[index]; |
| 3898 | index = node->m_NextIndex; |
| 3899 | } |
| 3900 | |
| 3901 | for (uint32_t i = 0; i < indices.Size(); ++i) |
| 3902 | { |
| 3903 | index = indices[i]; |
| 3904 | InternalNode* node = &scene->m_Nodes[index]; |
| 3905 | |
| 3906 | dmGui::HNode out_node; |
| 3907 | result = CloneNodeToTable(L, scene, node, &out_node); |
| 3908 | if (result == dmGui::RESULT_OK) |
| 3909 | { |
| 3910 | dmGui::SetNodeParent(scene, out_node, parent, false); |
| 3911 | } |
| 3912 | } |
| 3913 | return result; |
| 3914 | } |
| 3915 | |
| 3916 | /*# clone a node including its children |
| 3917 | * Make a clone instance of a node and all its children. |
no test coverage detected