mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
Merge branch 'release/1.10.x'
This commit is contained in:
commit
7a2a83572c
@ -37,7 +37,12 @@ def test_wheel(wheel, verbose=False):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Install pytest into the environment, as well as our wheel.
|
# Install pytest into the environment, as well as our wheel.
|
||||||
packages = ["pytest", wheel]
|
packages = [wheel]
|
||||||
|
if sys.version_info >= (3, 10):
|
||||||
|
packages += ["pytest>=6.2.4"]
|
||||||
|
else:
|
||||||
|
packages += ["pytest"]
|
||||||
|
|
||||||
if sys.version_info[0:2] == (3, 4):
|
if sys.version_info[0:2] == (3, 4):
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
packages += ["colorama==0.4.1"]
|
packages += ["colorama==0.4.1"]
|
||||||
|
@ -1306,7 +1306,7 @@ compare_tags(const PandaNode *other) const {
|
|||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp = strcmp(a_data.get_key(ai).c_str(), b_data.get_key(bi).c_str());
|
cmp = strcmp(a_data.get_data(ai).c_str(), b_data.get_data(bi).c_str());
|
||||||
if (cmp != 0) {
|
if (cmp != 0) {
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,57 @@ def test_weak_nodepath_comparison():
|
|||||||
assert weak.node() == path.node()
|
assert weak.node() == path.node()
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
def test_nodepath_flatten_tags_same_key():
|
||||||
|
from panda3d.core import NodePath, PandaNode
|
||||||
|
|
||||||
|
# Don't flatten nodes with different tag keys
|
||||||
|
node1 = PandaNode("node1")
|
||||||
|
node1.set_tag("key1", "value")
|
||||||
|
node2 = PandaNode("node2")
|
||||||
|
node2.set_tag("key2", "value")
|
||||||
|
|
||||||
|
path = NodePath("parent")
|
||||||
|
path.node().add_child(node1)
|
||||||
|
path.node().add_child(node2)
|
||||||
|
|
||||||
|
path.flatten_strong()
|
||||||
|
assert len(path.children) == 2
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
def test_nodepath_python_tags():
|
def test_nodepath_python_tags():
|
||||||
from panda3d.core import NodePath
|
from panda3d.core import NodePath
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user