|
|
|
|
|
|
|
|
if node.parent is not None: |
|
|
if node.parent is not None: |
|
|
if node.parent == self: |
|
|
if node.parent == self: |
|
|
return # Nothing to do. Given node already parented to this node. |
|
|
return # Nothing to do. Given node already parented to this node. |
|
|
if reparent = False: |
|
|
|
|
|
|
|
|
if reparent == False: |
|
|
raise NodeError("Node already parented.") |
|
|
raise NodeError("Node already parented.") |
|
|
if node.parent.remove_node(node) != node: |
|
|
if node.parent.remove_node(node) != node: |
|
|
raise NodeError("Failed to remove given node from it's current parent.") |
|
|
raise NodeError("Failed to remove given node from it's current parent.") |