In tinkering with LOD, I’ve found some funny things- I 'd like some clarification.
First, when you create a new LOD for an LODNode the argument is listed in the Panda API as “lodName” or string. However, looking at the LODNode section of the API (and experiencing some errors when doing stuff like getLODNames) leads me to believe that name should actually be an integer. Any insight into this?
Second, here’s what I am trying to do and failing. First, I have a create a bunch of objects for my scene which are basically classes with an actor, for example Box or Table. Now, AFTER I’ve already initialized Box.actor or Table.actor etc I want to go back and add LOD to these actors. I’ve found I can add a LODNode with an LOD like this:
for o in self.objects:
ln = LODNode('LODNode')
o.myActor.setLODNode(ln)
o.myActor.addLOD(1000, inDist=1000, outDist=40)
o.myActor.loadModel(gOthersPath+"Flat/flat_model.egg",lodName="1000")
But now I need to get access to my originally loaded actor model and also assign it to an LOD. I would think I could simply access ‘lodRoot’ which is supposed to be the default LOD and indeed it appears when I print the actor like this:
print str(o.myActor)
which yields
Actor: partBundleDict = {'lodRoot': {'modelRoot': render/<Bush.Bush instance at 0x0EC317F0>_top/bush/actorGeom/__A
ctor_modelRoot}, '1000': {'modelRoot': render/<Bush.Bush instance at 0x0EC317F0>_top/bush/actorGeom/LODNode/1000/_
_Actor_modelRoot}}, animControlDict = {}
However, attepts to setLOD(“lodRoot”, in, out throw errors since (this is my suspicion) internally LODNode doesn’t like string names for LODs. Here’s the error:
File "C:\Panda\direct\src\actor\Actor.py", line 424, in setLOD
self.__LODNode.node().setSwitch(index, inDist, outDist)
File "LODNode", line 137, in setSwitch
AssertionError: index >= 0 && index < (int)cdata->_lod._switch_vector.size() at line 90 of c:\dev\panda\panda3dsrc
\panda\src\pgraph\lodNode.I
SO- how do I a) get my already loaded actor geometry to move under some new LOD node; or b) change “lodRoot”'s in and out settings?
Insight is appreciated!