Ah, yes, found it now. Thanks.
I will give this a try.
The AlcScript will look like this then, I assume:
- Code: Select all
- type: animationname # id 7
value: SubRampAnim_02
index: 7
- type: animation # id 8
ref: :SubWorld_02 # <= here goes the animated object, NOT its animation name!
index: 7
EDIT:
Yes! It works like a charm.
Here's the modified prp_LogicClasses.py script, just for reference. It only differs to the current PyPRP 1.60 trunk in these parts:
- uncommented the line which disabled the animation parameter, plus giving it a default of [006D]
- added Paradox's modification to allow forcing the index (ID) of parameters
Maybe it could be merged to trunk, because it does not change anything for those who dont use it.
Are animations controlled with Python scripts worth a Wiki article?
I'm guessing Python programmers are a minority, and this thread may be enough to get the idea...
EDIT2:
I forgot to mention that I additionally replaced this codeblock:
- Code: Select all
def export_object(self, obj, objscript):
plSynchedObject.export_obj(self, obj, objscript)
# check for animations
laipo = None
if obj.type == "Lamp":
laipo = obj.data.ipo
if obj.ipo or laipo:
# this will specify animation names and markers
animParams = FindInDict(objscript, "animations", [])
agmm = plAGMasterMod.FindCreate(self.getRoot(), obj.name)
if(len(animParams) == 0):
# if there is no script for the animation, make a single animation with all frames
anim = prp_AnimClasses.plATCAnim.FindCreate(self.getRoot(), obj.name)
anim.data.export_obj(obj)
agmm.data.fPrivateAnims.append(anim.data.getRef())
for animation in animParams:
# if there are animations defined in alcscript, export each separately
if(FindInDict(animation, "type", None) == "ageglobalanim"):
anim = prp_AnimClasses.plAgeGlobalAnim.FindCreate(self.getRoot(), FindInDict(animation, "name", "unnamed"))
else:
anim = prp_AnimClasses.plATCAnim.FindCreate(self.getRoot(), FindInDict(animation, "name", "unnamed"))
anim.data.export_obj(obj, animation)
agmm.data.fPrivateAnims.append(anim.data.getRef())
agmod = plAGModifier.FindCreate(self.getRoot(), obj.name)
agmod.data.fChannelName = obj.name
self.data2.append(agmod.data.getRef())
self.data2.append(agmm.data.getRef())
with this one:
- Code: Select all
def export_object(self, obj, objscript):
plSynchedObject.export_obj(self, obj, objscript)
# check for animations
laipo = None
if obj.type == "Lamp":
laipo = obj.data.ipo
if obj.ipo or laipo:
# this will specify animation names and markers
animParams = FindInDict(objscript, "animations", [])
agmm = plAGMasterMod.FindCreate(self.getRoot(), obj.name)
if(len(animParams) == 0):
# if there is no script for the animation, make a single animation with all frames
anim = prp_AnimClasses.plATCAnim.FindCreate(self.getRoot(), obj.name + "_(Entire Animation)_anim")
anim.data.export_obj(obj)
agmm.data.fPrivateAnims.append(anim.data.getRef())
#print "CREATED:PRIVATE ANIM"
for animation in animParams:
# if there are animations defined in alcscript, export each separately
if(FindInDict(animation, "type", None) == "ageglobalanim"):
anim = prp_AnimClasses.plAgeGlobalAnim.FindCreate(self.getRoot(), obj.name + "_" + FindInDict(animation, "name", "(Entire Animation)") + "_anim")
#print "CREATED:GLOBAL ANIM"
else:
anim = prp_AnimClasses.plATCAnim.FindCreate(self.getRoot(), obj.name + "_" + FindInDict(animation, "name", "(Entire Animation)") + "_anim")
#print "CREATED:PRIVATE ATCAnim"
anim.data.export_obj(obj, animation)
agmm.data.fPrivateAnims.append(anim.data.getRef())
agmod = plAGModifier.FindCreate(self.getRoot(), obj.name)
agmod.data.fChannelName = obj.name
self.data2.append(agmod.data.getRef())
self.data2.append(agmm.data.getRef())
in prp_ObjClasses.py => class plSceneObject(), because that creates ptATCAnim[00F1] entries named like in Cyan Ages.
Don't know if it's necessary though.
(Code taken from GPNMilano's contrib).