That’s a good solution but when the code is growing larger you don’t even know where the function will be created. Besides in OOP it’s impossible to pass every variable into every functions created.
i haven’t figure it out using another DirectObject, currently i’m using only one of it and everything works normal.
The only way that i’ve found so far is using a tricky way, injecting into the _messengerId, which is:
DirectObject need to be created for creating an unique messenger acceptation (i’ve never use it before though, and don’t understand why it should be there, besides the implementation looks odd)
The only purpose to reassign the DirectObject in each class i’ve found so far is just to create an unique id of each messenger accept… what a waste.
messenger is one of the best and the most usefull function in panda, it allows developer to communicate each object without passing variables to each other. Thus i really really recommend this one to be perfected.
if it only about the id then why not find another workaround, there are many ways to do the uniqueness, maybe like this:
if unique_id is not present then the old dictionary will be replaced,
while if different unique_id assigned then it will create a new acceptation list.
and i recommend using just the base, one for all, all for all, why not, besides it will simplify user’s logic anyway.
Well the only purpose inheriting the DO that i’ve found so far is only for the messenger.accept
Don’t know if there’s another purpose yet
It’s a waste of procedure.
In the other hand, it create some ambiguity about how each DO connect each other.
Maybe in my case like the CollisionTraverser that is created inside the class object, say:
with another class object
we create different Collision Traverser but they implement the same self.accept in DO, which is triggered from the addIn/OutPattern.
Then a newbie will almost likely got confused while accepting the pattern from different object. Is it still related or not?
And the other bad side of implementing DO per class object is that we unable create 2 output function from one trigger key in the same class. ex:
only one of them will be executed in the same class.
why not just release the messenger into a global function, then we don’t have to bother about variables scoping, as i recommend before, what if we just use base.accept() …
we send it, then everywhere will accept if it is well determined.
hmmm kinda hard to explain this in english, hope you get it though