From 9904980ce4b03c87c25876c8a183efe8baaa7661 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Sep 2016 17:29:02 +0200 Subject: [PATCH 1/2] Fix async flatten of node without parents --- doc/ReleaseNotes | 1 + panda/src/pgraph/modelFlattenRequest.cxx | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 37f755d200..4cbfd69fb4 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -34,6 +34,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Support for InvSphere, Box and Tube solids in bam2egg * Add normalized() method to vectors * asyncFlattenStrong with inPlace=True caused node to disappear +* Fix asyncFlattenStrong called on nodes without parent ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/pgraph/modelFlattenRequest.cxx b/panda/src/pgraph/modelFlattenRequest.cxx index 7d98406477..b6c5cca4c8 100644 --- a/panda/src/pgraph/modelFlattenRequest.cxx +++ b/panda/src/pgraph/modelFlattenRequest.cxx @@ -25,10 +25,19 @@ TypeHandle ModelFlattenRequest::_type_handle; //////////////////////////////////////////////////////////////////// AsyncTask::DoneStatus ModelFlattenRequest:: do_task() { - // We make another instance of the original node, so we can safely - // flatten that without affecting the original copy. + // We make another instance of the original node, so we can safely flatten + // that without affecting the original copy. NodePath np("flatten_root"); - np.attach_new_node(_orig); + + // Except if we try to attach a node without parents, this will cause the + // original NodePath to be affected, so we have to make a (shallow) copy. + if (_orig->get_num_parents() == 0) { + PT(PandaNode) copy = _orig->make_copy(); + copy->copy_children(_orig); + np.attach_new_node(copy); + } else { + np.attach_new_node(_orig); + } np.flatten_strong(); _model = np.get_child(0).node(); _is_ready = true; From 2c651dc96bcc4882e474caa0985ab0b720c9c812 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Sep 2016 20:55:57 +0200 Subject: [PATCH 2/2] Fix is_playing() when playing an animation backwards --- doc/ReleaseNotes | 1 + panda/src/putil/animInterface.cxx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 4cbfd69fb4..49ed03cd78 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -35,6 +35,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Add normalized() method to vectors * asyncFlattenStrong with inPlace=True caused node to disappear * Fix asyncFlattenStrong called on nodes without parent +* Fix is_playing() check when playing an animation backwards ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/putil/animInterface.cxx b/panda/src/putil/animInterface.cxx index 515c54027a..690afa89d8 100644 --- a/panda/src/putil/animInterface.cxx +++ b/panda/src/putil/animInterface.cxx @@ -415,7 +415,12 @@ is_playing() const { return false; case PM_play: - return get_f() < _play_frames; + if (_effective_frame_rate < 0.0) { + // If we're playing backwards, check if we're at the beginning. + return get_f() > 0; + } else { + return get_f() < _play_frames; + } case PM_loop: case PM_pingpong: