Made animNames can be defined in objectPalette

This commit is contained in:
Gyedo Jeon 2010-02-02 01:30:44 +00:00
parent 5d724d16a8
commit d020a8bbb7
2 changed files with 11 additions and 4 deletions

View File

@ -106,12 +106,18 @@ class ObjectMgr:
newobj = loader.loadModel(Filename.fromOsSpecific(model).getFullpath())
anim = ''
if len(objDef.anims) > 0:
anim = objDef.anims[0]
i = 0
defaultAnim = ''
for i in range(len(objDef.anims)):
anim = objDef.anims[i]
# load new anim
animName = os.path.basename(anim)
if i < len(objDef.animNames):
animName = objDef.animNames[i]
newAnim = newobj.loadAnims({animName:anim})
newobj.loop(animName)
if i == 0:
defaultAnim = animName
newobj.loop(defaultAnim)
if newobj is None:
return None

View File

@ -4,13 +4,14 @@ import ObjectGlobals as OG
class ObjectBase:
""" Base class for obj definitions """
def __init__(self, name='', createFunction = None, model = None, models= [], anims = [], properties={},
def __init__(self, name='', createFunction = None, model = None, models= [], anims = [], animNames = [], properties={},
movable = True, actor = False):
self.name = name
self.createFunction = createFunction
self.model = model
self.models = models[:]
self.anims = anims[:]
self.animNames = animNames[:]
self.properties = copy.deepcopy(properties)
self.movable = movable
self.actor = actor