Skip to content

Commit 3b36197

Browse files
committed
actor: improve API documentation for Actor.cleanup()
Intended to address panda3d/panda3d-docs#40 [skip ci]
1 parent 2871181 commit 3b36197

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

direct/src/actor/Actor.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,12 @@ def pprint(self):
500500

501501
def cleanup(self):
502502
"""
503-
Actor cleanup function
503+
This method should be called when intending to destroy the Actor, and
504+
cleans up any additional resources stored on the Actor class before
505+
removing the underlying node using `removeNode()`.
506+
507+
Note that `removeNode()` itself is not sufficient to destroy actors,
508+
which is why this method exists.
504509
"""
505510
self.stop(None)
506511
self.clearPythonData()
@@ -512,6 +517,11 @@ def cleanup(self):
512517
self.removeNode()
513518

514519
def removeNode(self):
520+
"""
521+
You should call `cleanup()` for Actor objects instead, since
522+
:meth:`~panda3d.core.NodePath.removeNode()` is not sufficient for
523+
completely destroying Actor objects.
524+
"""
515525
if self.__geomNode and (self.__geomNode.getNumChildren() > 0):
516526
assert self.notify.warning("called actor.removeNode() on %s without calling cleanup()" % self.getName())
517527
NodePath.removeNode(self)
@@ -525,7 +535,7 @@ def clearPythonData(self):
525535

526536
def flush(self):
527537
"""
528-
Actor flush function
538+
Actor flush function. Used by `cleanup()`.
529539
"""
530540
self.clearPythonData()
531541

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy