Pages: [1]
|
 |
|
Author
|
Topic: Problems with IAnimation::ID (Read 2672 times)
|
|
Pelgar
|
I'm trying to use the IAnimation::ID (get_ID()) function to get the ID of an animation but everything I try fails. I have tried all of the following in the example code below: local dwAnimID = pAnim:ID; local dwAnimID = pAnim.get_ID(); local dwAnimID = pAnim:get_ID();
local dwAnimID; pAnim.get_ID(dwAnimID);
local dwAnimID; pAnim:get_ID(dwAnimID);
I have successfully used code similar to the following to get a bone ID but this does not seem to work with an animation.
local pAnim = editChar:GetSelAnimation(); --get pointer to the selected animation (IAnimation) if (pAnim:isSet()) then -- if there is an anim currently selected local dwAnimID = pAnim.ID; else print("No Anim Selected"); end
I have tried this in FragMotion 0.9.1a and 0.9.5 with all of the above failing with an "ID no such member or child) error or "get_ID no such member or child" error. I know that I am probably missing something simple but I can't imagine what it is.
Thanks
Dale
|
|
|
|
|
Logged
|
|
|
|
|
Pelgar
|
It looks like I need to know how to either initialize a VARIANT variable in LUA or convert an int to a variant. I'm simply trying to read an animation DWORD property into a LUA script, modify the value, then write it back. Unfortunately the only functions/methods I can find to update the property require a variant.
I used IUserObject::GetValueDWORD to read the property value but hours of searching and trial and error have left me no closer to updating this simple property value than I was when I started.
Hours of Google searching and searching my Visual C++ documentation have left me drawing a blank. I can't even find a list of VARIANT methods??? I did find an MSDN article titled something like "Variant Ignorance is Rampant". You would think that article would make at least a slight effort to clear up some of the ignorance, but hey as I said it was a MSDN article!
|
|
|
|
|
Logged
|
|
|
|
|
fragmo
|
The properties aren't accessible from the specialized interfaces (IAnimation, IBone, ...) via script so you'll need to cast the object to IUserObject first. And 'ID' is a special case that isn't exposed as a property but rather as a method (Get/SetID) so try playing with a different property...
local pAnim = IUserObject(editChar:GetSelAnimation()); --get pointer to the selected animation (IAnimation) if (pAnim:isSet()) then -- if there is an anim currently selected local num = pAnim.NumFrames; pAnim.NumFrames = num * 2; print("NumFrames=", num, ": changed to ", pAnim.NumFrames); end
In case you still want to know how to work with the ID value...
local pAnim = IUserObject(editChar:GetSelAnimation()); --get pointer to the selected animation (IAnimation) if (pAnim:isSet()) then -- if there is an anim currently selected local dwAnimID = pAnim:GetID(); else print("No Anim Selected"); end
dave
|
|
|
|
|
Logged
|
|
|
|
|
Pelgar
|
Thanks Dave, I saw the See Also: link to IUserObject in the IAnimation::ID details, probably should have tried that route too just didn't think of it.
Dale
|
|
|
|
|
Logged
|
|
|
|
|
Pages: [1]
|
|
|
 |