Using Open Reality SDK, the class HFBCamera members Near and Far are not Animatable even the UI allow to Animate them

Using Open Reality SDK, the class HFBCamera members Near and Far are not Animatable even the UI allow to Animate them

aguyet
Observer Observer
443 Views
2 Replies
Message 1 of 3

Using Open Reality SDK, the class HFBCamera members Near and Far are not Animatable even the UI allow to Animate them

aguyet
Observer
Observer

Hello,

My names is Alain Guyet, CTO at Asobo Studio France, working a AAA titles as MSFS 2020 and The Plague Tale.

 

I want to export Near & Far HFBCamera members, this work, but i can't find a way to export them if they are animated.

 

In the header there's a back comp comment (inserted below), and i didn't succeed to retrieve animated Near&Far Node and Curve.

 


////////////////WARNING////////////////////////////////////
BACK-COMP implementation:
The proper implementation is to change UseDepthOfField from
FBPropertyBool to FBPropertyAnimatableBool. This breaks
backward compatibility and should only be done for major releases
////////////////WARNING////////////////////////////////////

void GetAnimatableFarPlane(FBPropertyAnimatableDouble *pProp);
void GetAnimatableNearPlane(FBPropertyAnimatableDouble *pProp);

 

 

So, i try to use this (code below), to find the FBPropertyFCurve that should contain all keyframed Near or Far values, but the GetAnimatedNode is null.

 

   FBPropertyAnimatableDouble nearPlaneAnimatable;
   pCamera->GetAnimatableFarPlane(&nearPlaneAnimatable);

   if(nearPlaneAnimatable.GetAnimationNode()!=NULL)
   {
        FBPropertyFCurve &curve=nearPlaneAnimatable.GetAnimationNode()->FCurve;

  }

 

 

So could you help me ? Maybe there's another way i didn't find, i think the SDK didn't match the MotionBuilder 2019, so if it's the case a code sample will be appreciated.

 

Thanks a lot!

 

 

0 Likes
444 Views
2 Replies
Replies (2)
Message 2 of 3

Mocappy
Advocate
Advocate

Hello Alain,

 

Not sure if I've understood you correctly, but in python you can use something like this to get the 'frame' and 'value' of a keyframe on the Near Plane property of a camera...

 

from pyfbsdk import*

camera_obj = FBFindModelByLabelName("Camera")

cam_near_plane_anim_node = camera_obj.AnimatableNearPlane.GetAnimationNode()

if cam_near_plane_anim_node:
    for curve_key in cam_near_plane_anim_node.FCurve.Keys:
        frame = FBTime.GetFrame(curve_key.Time, FBPlayerControl().GetTransportFps())
        value = curve_key.Value
        print "Camera Near Plane has value {} on frame {}".format(value, frame)
else:
    print "Camera Near Plane is not animated"

 

Hope this helps,

0 Likes
Message 3 of 3

aguyet
Observer
Observer

Hello and sorry if my message wasn't enough clear.

Thanks for the phyton sample, it work fine.

 

But i don't use python to export , i use the C++ SDK, since a while now and i don't want to migrate to phyton.

 

So using the OpenReality SDK, the C++ FBCamera class didn't expose the animatable property for Near and Far, check below the class provided by the SDK.  

 

 

class FBSDK_DLL FBCamera : public FBModel {
__FBClassDeclare( FBCamera,FBModel );
public:
....
FBPropertyDouble NearPlaneDistance; //!< <b>Read Write Property:</b> Near plane distance.
FBPropertyDouble FarPlaneDistance; //!< <b>Read Write Property:</b> Far plane distance.
...

/*
////////////////WARNING////////////////////////////////////
BACK-COMP implementation:
The proper implementation is to change UseDepthOfField from
FBPropertyBool to FBPropertyAnimatableBool. This breaks
backward compatibility and should only be done for major releases
////////////////WARNING////////////////////////////////////
*/
void GetAnimatableFarPlane(FBPropertyAnimatableDouble *pProp);
void GetAnimatableNearPlane(FBPropertyAnimatableDouble *pProp);
};

 

I try using the GetAnimatableNearPlane(FBPropertyAnimatableDouble *pProp) that seem to be a workaround, but it didn't work.

Could you transfer my problem to someone who knows the c++ sdk, i believe the phyton is more up to date.

 

Thanks.

0 Likes