[Closed] CAT controller error
/EDIT never mind I solved this problem, see bottom
I am trying to avoid using a try, catch in a script handling a CAT rig.
I am calling for example; $.scale.controller.keys[1]
When I call this on bones with controllers that exclude scale, rotation or pos I am getting a – Unknown property: “scale” in $Object:CATRigLArm2 @ [2.105013,-0.275645,4.236701] error. I’m new to scripting animation tools and I can’t figure out how to check if an obj has scale as a property to begin with.
Has anyone else had a similar problem?
Further information:
On bone that doesn’t throw error I get
hasProperty $ #scale
false
isPropertyAnimatable $ #scale
false
getproperty $ #scale
[1,1,1]
On bone that does throw error I get
hasProperty $ #scale
false
isPropertyAnimatable $ #scale
false
getproperty $ #scale
– Unknown property: “scale” in $Object:CATRigneck2 @ [-0.013510,2.019181,4.893921]
Found that hasProperty wasn’t relevant. I needed isProperty.
Good bone;
isProperty $ #scale
true
Bad bone;
isProperty $ #scale
false
if you were trying to avoid try/catch, then your problem is not really solved. isProperty carries the same penalty on performance as try/catch
Do you have a suggestion to avoid both in this instance? It’s not incredibly important but it might be later on as the tools develop.
Perhaps check which classes of controllers have the property, and filter by classof.
try/catch is better it doesn’t leak as isproperty.
another way to check some property existence is to ask its subanim (of course not all properties have subanim).
<controller>[#scale]
Unfortunately Lo, all class’s return the same. Now I’m going to have to go through and replace isProp with try/Catch. Thanks for your help!
not sure what you mean by ‘all classes return the same’. Could you explain or show code?
All of the bones on the rig return CATBone when asked classof $
Since I’m testing the tool at the moment I thought I’d point out its use. We were experiencing some trouble with exporting to FBX from a CAT rig. Max seems to want to bake a keyframe for every frame on the rig so I was basically re-importing then deleting the keys that weren’t in the original rig. I had to have a way to differentiate between the bones controlled purely by the IK and the ones with their own keyframes to delete properly. I also had to allow baked properties for keyframes controlled by foot nodes.
It’s just about working. Just trying to use FBX’s inbuilt keyframe optimiser now to further reduce the size of the exports.
you should be checking the class of their controller, not the bone itself; #scale is a property of the transform.
classof $.controller