mirror of
https://github.com/mcneel/opennurbs.git
synced 2026-05-02 04:41:32 +08:00
Sync changes from upstream repository
This commit is contained in:
@@ -2174,6 +2174,13 @@ void ON_XMLNodePrivate::MoveBefore(ON_XMLNode& other)
|
||||
{
|
||||
pBeforeOther->_private->m_next_sibling = &m_node;
|
||||
}
|
||||
|
||||
// 13th February 2025 John Croudy, https://mcneel.myjetbrains.com/youtrack/issue/RH-86050
|
||||
if (m_parent->_private->m_last_child == &m_node)
|
||||
{
|
||||
// 'this' was the tail; redirect the parent's last child.
|
||||
m_parent->_private->m_last_child = pPrev;
|
||||
}
|
||||
}
|
||||
|
||||
void ON_XMLNodePrivate::MoveAfter(ON_XMLNode& other)
|
||||
@@ -2197,6 +2204,13 @@ void ON_XMLNodePrivate::MoveAfter(ON_XMLNode& other)
|
||||
m_parent->_private->m_first_child = m_next_sibling;
|
||||
}
|
||||
|
||||
// 13th February 2025 John Croudy, https://mcneel.myjetbrains.com/youtrack/issue/RH-86050
|
||||
if (m_parent->_private->m_last_child == &m_node)
|
||||
{
|
||||
// 'this' was the tail; redirect the parent's last child.
|
||||
m_parent->_private->m_last_child = pPrev;
|
||||
}
|
||||
|
||||
m_next_sibling = other._private->m_next_sibling;
|
||||
|
||||
other._private->m_next_sibling = &m_node;
|
||||
@@ -3774,7 +3788,7 @@ void* ON_XMLNode::PropertyIterator::EVF(const wchar_t*, void*)
|
||||
// TODO: Somehow I managed to port the non-rc version of the root node.
|
||||
// TODO: We really need the rc version.
|
||||
|
||||
static const ON_wString sXMLRootNodeName(L"xml");
|
||||
static const wchar_t* xml_root_node_name(L"xml");
|
||||
|
||||
//class ON_XMLRootNodePrivate final // For future use.
|
||||
//{
|
||||
@@ -3782,14 +3796,14 @@ static const ON_wString sXMLRootNodeName(L"xml");
|
||||
|
||||
ON_XMLRootNode::ON_XMLRootNode()
|
||||
:
|
||||
ON_XMLNode(sXMLRootNodeName)
|
||||
ON_XMLNode(xml_root_node_name)
|
||||
{
|
||||
_private = nullptr; //new ON_XMLRootNodePrivate;
|
||||
}
|
||||
|
||||
ON_XMLRootNode::ON_XMLRootNode(const ON_XMLNode& src)
|
||||
:
|
||||
ON_XMLNode(sXMLRootNodeName)
|
||||
ON_XMLNode(xml_root_node_name)
|
||||
{
|
||||
_private = nullptr; //new ON_XMLRootNodePrivate;
|
||||
*this = src;
|
||||
@@ -3797,7 +3811,7 @@ ON_XMLRootNode::ON_XMLRootNode(const ON_XMLNode& src)
|
||||
|
||||
ON_XMLRootNode::ON_XMLRootNode(const ON_XMLRootNode& src)
|
||||
:
|
||||
ON_XMLNode(sXMLRootNodeName)
|
||||
ON_XMLNode(xml_root_node_name)
|
||||
{
|
||||
_private = nullptr; //new ON_XMLRootNodePrivate;
|
||||
*this = src;
|
||||
@@ -3899,7 +3913,7 @@ void ON_XMLRootNode::Clear(void)
|
||||
{
|
||||
ON_XMLNode::Clear();
|
||||
|
||||
SetTagName(sXMLRootNodeName);
|
||||
SetTagName(xml_root_node_name);
|
||||
}
|
||||
|
||||
// ON_XMLUserData -- Specializes ON_UserData for XML use.
|
||||
@@ -3950,8 +3964,20 @@ const ON_XMLRootNode& ON_XMLUserData::XMLRootForRead(void) const
|
||||
return _private->m_XMLRoot.NodeForRead();
|
||||
}
|
||||
|
||||
ON_XMLRootNode& ON_XMLUserData::XMLRootForWrite(void) const
|
||||
ON_XMLRootNode& ON_XMLUserData::XMLRootForWrite(void) const // const is a mistake. [SDK_UNFREEZE]
|
||||
{
|
||||
// 22nd January 2025 John Croudy, https://mcneel.myjetbrains.com/youtrack/issue/RH-67878
|
||||
// Per conversation with Dale Lear, this is bad because we are actually going to change the user data while
|
||||
// it's already attached to the attributes. We're actually expected to delete the old user data and create
|
||||
// new user data with the changes in it, because otherwise Rhino can't know that it was changed. However,
|
||||
// Dale suggested the easiest way to fix this is to just bump the copy count, because the optimization in
|
||||
// CRhinoObject::ModifyAttributes() involving the copy count is really a hack anyway.
|
||||
|
||||
if (m_userdata_copycount > 0) // Zero means we are not even copying user data.
|
||||
{
|
||||
const_cast<ON_XMLUserData*>(this)->m_userdata_copycount++;
|
||||
}
|
||||
|
||||
return _private->m_XMLRoot.NodeForWrite();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user