Example #1
0
def test_nodepath_flatten_tags_same_value():
    from panda3d.core import NodePath, PandaNode

    # Don't flatten nodes with different tag values
    node1 = PandaNode("node1")
    node1.set_tag("key", "value1")
    node2 = PandaNode("node2")
    node2.set_tag("key", "value2")

    path = NodePath("parent")
    path.node().add_child(node1)
    path.node().add_child(node2)

    path.flatten_strong()
    assert len(path.children) == 2
Example #2
0
def test_nodepath_flatten_tags_identical():
    from panda3d.core import NodePath, PandaNode

    # Do flatten nodes with same tags
    node1 = PandaNode("node1")
    node1.set_tag("key", "value")
    node2 = PandaNode("node2")
    node2.set_tag("key", "value")

    path = NodePath("parent")
    path.node().add_child(node1)
    path.node().add_child(node2)

    path.flatten_strong()
    assert len(path.children) == 1