Animation Range of Document?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/08/2011 at 12:44, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10+ 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Howdy,

    I'm using this code:

    LONG fps = doc->GetFps();
    LONG startFrame = (LONG)doc->GetUsedMinTime(NULL).GetFrame(Real(fps));
    LONG endFrame = (LONG)doc->GetUsedMaxTime(NULL).GetFrame(Real(fps));
    GePrint("startFrame = "+LongToString(startFrame));
    GePrint("endFrame = "+LongToString(endFrame));
    

    ... to get the min and max animation key range of the document. It works fine except when there are no animation keys at all. Then it prints:

    startFrame = 3000000
    endFrame = -3000000

    Are those the animation frame absolute limits of a document?
    And, is it safe to assume so and use this code:

    if(startFrame == 3000000 && endFrame == -3000000)
    {
    	startFrame = 0;
    	endFrame = 0;
    }
    

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2011 at 13:35, xxxxxxxx wrote:

    Instead of GetUsedMinTime() and GetUsedMaxTime() you might want to use GetMinTime() and GetMaxTime(). They're also members of the BaseDocument class.

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2011 at 13:37, xxxxxxxx wrote:

    Oh wait, I might have misunderstood what you want.

    Maybe you should better check if there are any tracks in the timeline? That 30000 frame thing seems to work, but it does not seem very safe to me.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2011 at 14:11, xxxxxxxx wrote:

    Howdy,

    Do you mean loop through the object hierarchy and check for tracks on every object and tag?

    Since the GetUsedMinTime() is returning the maximum frame number and the GetUsedMaxTime() is returning the minimum number, it seems like those two functions work like setting points in an AABB bounding box class.

    So, I figured the logic would be:

    if ( getting the minimum used frame is equal to the maximum allowed frames
       and getting the maximum used frame is equal to the minimum allowed frames )
    then ( document used frames equals 0 )
    

    ... in other words no key frames have been set, yet.

    The main reason I posted was to get a confirmation that those two values (-300000 and 300000) were the frame limits of a document, since I couldn't find any constants like MAXFRAME or MINFRAME in the api headers, to indicate that those were the limits.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/08/2011 at 01:47, xxxxxxxx wrote:

    As c4dJack said, I wouldn't trust those numbers to be constant.  We're talking about Maxon here - who keeps changing constant names and method names from version to version.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/08/2011 at 06:19, xxxxxxxx wrote:

    Howdy,

    Well, there is one other bit of logic there to point out, that the resulting values are making the start frame (minimum) greater than the end frame (maximum), which should be an impossibility, right?

    So, maybe:

    if(startFrame > endFrame)
    

    ... would be a safer test.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/08/2011 at 16:06, xxxxxxxx wrote:

    That sounds safer.  Please verify that such a scenario in general is illegal for proper animation and you should be good to go.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/08/2011 at 08:23, xxxxxxxx wrote:

    I'm a bit confused now. Are you trying to retrieve the possible time limits of an document?

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/08/2011 at 08:44, xxxxxxxx wrote:

    Howdy,

    What I'm doing is testing to find the first key and last key of the document to see what the key frame range of an animated document is.

    When there are animation keys in the document, then the two functions GetUsedMinTime() and GetUsedMaxTime(), listed in my posted code, give me the correct frames for the first key of the document and the last key of the document, thus giving me the key frame range of the document.

    But, when there are no keys in the document at all, it gives me 3000000 for the first key frame of the document and -3000000 for the last key frame of the document, which seems like it can't be because the first frame is greater than the last frame.

    So if there are no keys in the document, I want to set both of my variables "startFrame" and "endFrame" to 0, rather than setting them to 3000000 and -3000000. 😉

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/08/2011 at 02:53, xxxxxxxx wrote:

    Ah ok. So figured it out yourself.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/08/2011 at 05:08, xxxxxxxx wrote:

    Howdy,

    Originally posted by xxxxxxxx

    ...Ah ok. So figured it out yourself...

    Yes, the main reason I made the post was to get verification that my assumptions were correct, since I could not find any constant definitions in the API that confirmed those assumptions.

    If I had found something like "MIN_TIME" and "MAX_TIME" defines in the API, then there would've been no question about it. 😉

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/08/2011 at 05:28, xxxxxxxx wrote:

    Yeah, the return values are strange for GetUsedMinTime/GetUsedMaxTime for a document without key frames. I will see if there is a reason for it.

    cheers,
    Matthias


Log in to reply