How to distinguish model and actor in code ?

model = loader.loadModel('models/map2.egg')
model.reparentTo(allBuilding)

actor = Actor('models/wasser.egg')
actor.reparentTo(self.allBuilding)

...

for child in self.allBuilding.getChildren():
	if child ...
...
...

How to distinguish model and actor in the “if” code ?
请问,我怎样使用程序来区分 model/actor ?

It’s worse than that: The Actor class won’t be returned from getChildren(), so your Actor won’t even be in the list at all.

You can identify the same node that corresponds to your Actor node, but it won’t have any Actor methods like play() or stop(). Actor is a high-level Python class, and doesn’t get saved in the scene graph, only the underlying node gets saved.

So you have to save your Actor object and retrieve it from wherever you saved it. You can’t find it in the scene graph.

David

Thank you! I will create a new list .