mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
Merge remote-tracking branch 'origin/release/1.10.x'
This commit is contained in:
commit
4a21329a79
@ -94,12 +94,12 @@ class DirectObject:
|
||||
if hasattr(self, '_taskList'):
|
||||
tasks = [task.name for task in self._taskList.values()]
|
||||
if len(events) or len(tasks):
|
||||
estr = choice(len(events), 'listening to events: %s' % events, '')
|
||||
andStr = choice(len(events) and len(tasks), ' and ', '')
|
||||
tstr = choice(len(tasks), '%srunning tasks: %s' % (andStr, tasks), '')
|
||||
estr = ('listening to events: %s' % events if len(events) else '')
|
||||
andStr = (' and ' if len(events) and len(tasks) else '')
|
||||
tstr = ('%srunning tasks: %s' % (andStr, tasks) if len(tasks) else '')
|
||||
notify = directNotify.newCategory('LeakDetect')
|
||||
func = choice(getRepository()._crashOnProactiveLeakDetect,
|
||||
self.notify.error, self.notify.warning)
|
||||
crash = getattr(getRepository(), '_crashOnProactiveLeakDetect', False)
|
||||
func = (self.notify.error if crash else self.notify.warning)
|
||||
func('destroyed %s instance is still %s%s' % (self.__class__.__name__, estr, tstr))
|
||||
|
||||
#snake_case alias:
|
||||
|
@ -28,19 +28,19 @@ namespace std {
|
||||
template<class T> class allocator;
|
||||
}
|
||||
|
||||
template<class Key, class Element, class Compare = less<Key>, class Allocator = std::allocator<pair<const Key, T> > >
|
||||
template<class Key, class T, class Compare = less<Key>, class Allocator = std::allocator<pair<const Key, T> > >
|
||||
class map {
|
||||
public:
|
||||
typedef Key key_type;
|
||||
typedef Element data_type;
|
||||
typedef Element mapped_type;
|
||||
typedef pair<const Key, Element> value_type;
|
||||
typedef T data_type;
|
||||
typedef T mapped_type;
|
||||
typedef pair<const Key, T> value_type;
|
||||
typedef Compare key_compare;
|
||||
|
||||
typedef Element *pointer;
|
||||
typedef const Element *const_pointer;
|
||||
typedef Element &reference;
|
||||
typedef const Element &const_reference;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
typedef T &reference;
|
||||
typedef const T &const_reference;
|
||||
|
||||
class iterator;
|
||||
class const_iterator;
|
||||
|
18
tests/pgraph/test_cullfaceattrib.py
Normal file
18
tests/pgraph/test_cullfaceattrib.py
Normal file
@ -0,0 +1,18 @@
|
||||
from panda3d.core import CullFaceAttrib
|
||||
|
||||
|
||||
def test_cullfaceattrib_compare():
|
||||
clockwise1 = CullFaceAttrib.make()
|
||||
clockwise2 = CullFaceAttrib.make()
|
||||
reverse1 = CullFaceAttrib.make_reverse()
|
||||
reverse2 = CullFaceAttrib.make_reverse()
|
||||
|
||||
assert clockwise1.compare_to(clockwise2) == 0
|
||||
assert clockwise2.compare_to(clockwise1) == 0
|
||||
|
||||
assert reverse1.compare_to(reverse2) == 0
|
||||
assert reverse2.compare_to(reverse1) == 0
|
||||
|
||||
assert reverse1.compare_to(clockwise1) != 0
|
||||
assert clockwise1.compare_to(reverse1) != 0
|
||||
assert reverse1.compare_to(clockwise1) == -clockwise1.compare_to(reverse1)
|
@ -107,3 +107,37 @@ def test_lightattrib_compare():
|
||||
assert lattr1.compare_to(lattr2) != 0
|
||||
assert lattr2.compare_to(lattr1) != 0
|
||||
assert lattr2.compare_to(lattr1) == -lattr1.compare_to(lattr2)
|
||||
|
||||
# An on light is not the same as an off light
|
||||
lattr1 = core.LightAttrib.make().add_on_light(spot)
|
||||
lattr2 = core.LightAttrib.make().add_off_light(spot)
|
||||
assert lattr1.compare_to(lattr2) != 0
|
||||
assert lattr2.compare_to(lattr1) != 0
|
||||
assert lattr2.compare_to(lattr1) == -lattr1.compare_to(lattr2)
|
||||
|
||||
# If both have the same off light, they are equal
|
||||
lattr1 = core.LightAttrib.make().add_off_light(spot)
|
||||
lattr2 = core.LightAttrib.make().add_off_light(spot)
|
||||
assert lattr1.compare_to(lattr2) == 0
|
||||
assert lattr2.compare_to(lattr1) == 0
|
||||
|
||||
# Off light should not be equal to empty
|
||||
lattr1 = core.LightAttrib.make().add_off_light(spot)
|
||||
lattr2 = core.LightAttrib.make_all_off()
|
||||
assert lattr1.compare_to(lattr2) != 0
|
||||
assert lattr2.compare_to(lattr1) != 0
|
||||
assert lattr2.compare_to(lattr1) == -lattr1.compare_to(lattr2)
|
||||
|
||||
# Off light should not be equal to all-off
|
||||
lattr1 = core.LightAttrib.make().add_off_light(spot)
|
||||
lattr2 = core.LightAttrib.make_all_off()
|
||||
assert lattr1.compare_to(lattr2) != 0
|
||||
assert lattr2.compare_to(lattr1) != 0
|
||||
assert lattr2.compare_to(lattr1) == -lattr1.compare_to(lattr2)
|
||||
|
||||
# Different off lights shouldn't be equal either, of course
|
||||
lattr1 = core.LightAttrib.make().add_off_light(spot)
|
||||
lattr2 = core.LightAttrib.make().add_off_light(point)
|
||||
assert lattr1.compare_to(lattr2) != 0
|
||||
assert lattr2.compare_to(lattr1) != 0
|
||||
assert lattr2.compare_to(lattr1) == -lattr1.compare_to(lattr2)
|
||||
|
@ -48,10 +48,14 @@ def test_shaderattrib_compare():
|
||||
assert shattr1.compare_to(shattr2) == 0
|
||||
assert shattr2.compare_to(shattr1) == 0
|
||||
|
||||
shattr2 = core.ShaderAttrib.make().set_flag(core.ShaderAttrib.F_subsume_alpha_test, True)
|
||||
shattr2 = core.ShaderAttrib.make().set_flag(core.ShaderAttrib.F_subsume_alpha_test, False)
|
||||
assert shattr1.compare_to(shattr2) != 0
|
||||
assert shattr2.compare_to(shattr1) != 0
|
||||
|
||||
shattr1 = core.ShaderAttrib.make().set_flag(core.ShaderAttrib.F_subsume_alpha_test, False)
|
||||
assert shattr1.compare_to(shattr2) == 0
|
||||
assert shattr2.compare_to(shattr1) == 0
|
||||
|
||||
shattr2 = core.ShaderAttrib.make().set_flag(core.ShaderAttrib.F_subsume_alpha_test, True)
|
||||
assert shattr1.compare_to(shattr2) != 0
|
||||
assert shattr2.compare_to(shattr1) != 0
|
||||
|
@ -9,6 +9,19 @@ tex2 = core.Texture("tex2")
|
||||
tex3 = core.Texture("tex3")
|
||||
|
||||
|
||||
def test_textureattrib_compose_empty():
|
||||
# Tests a case in which a child node does not alter the original.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
tattr1 = tattr1.add_on_stage(stage1, tex1)
|
||||
|
||||
tattr2 = core.TextureAttrib.make()
|
||||
|
||||
tattr3 = tattr1.compose(tattr2)
|
||||
assert tattr3.get_num_on_stages() == 1
|
||||
|
||||
assert stage1 in tattr3.on_stages
|
||||
|
||||
|
||||
def test_textureattrib_compose_add():
|
||||
# Tests a case in which a child node adds another texture.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
@ -24,6 +37,21 @@ def test_textureattrib_compose_add():
|
||||
assert stage2 in tattr3.on_stages
|
||||
|
||||
|
||||
def test_textureattrib_compose_override():
|
||||
# Tests a case in which a child node overrides a texture.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
tattr1 = tattr1.add_on_stage(stage1, tex1)
|
||||
|
||||
tattr2 = core.TextureAttrib.make()
|
||||
tattr2 = tattr2.add_on_stage(stage1, tex2)
|
||||
|
||||
tattr3 = tattr1.compose(tattr2)
|
||||
assert tattr3.get_num_on_stages() == 1
|
||||
|
||||
assert stage1 in tattr3.on_stages
|
||||
assert tattr3.get_on_texture(stage1) == tex2
|
||||
|
||||
|
||||
def test_textureattrib_compose_subtract():
|
||||
# Tests a case in which a child node disables a texture.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
@ -61,6 +89,25 @@ def test_textureattrib_compose_both():
|
||||
assert stage3 in tattr3.on_stages
|
||||
|
||||
|
||||
def test_textureattrib_implicit_sort():
|
||||
# Tests that two TextureStages with same sort retain insertion order.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
tattr1 = tattr1.add_on_stage(stage1, tex1)
|
||||
tattr1 = tattr1.add_on_stage(stage2, tex2)
|
||||
|
||||
assert tattr1.get_on_stage(0) == stage1
|
||||
assert tattr1.get_on_stage(1) == stage2
|
||||
|
||||
tattr2 = core.TextureAttrib.make()
|
||||
tattr2 = tattr1.add_on_stage(stage2, tex2)
|
||||
tattr2 = tattr1.add_on_stage(stage1, tex1)
|
||||
|
||||
assert tattr2.get_on_stage(0) == stage2
|
||||
assert tattr2.get_on_stage(1) == stage1
|
||||
|
||||
assert tattr1.compare_to(tattr2) == -tattr2.compare_to(tattr1)
|
||||
|
||||
|
||||
def test_textureattrib_compose_alloff():
|
||||
# Tests a case in which a child node disables all textures.
|
||||
tattr1 = core.TextureAttrib.make()
|
||||
|
Loading…
x
Reference in New Issue
Block a user