1/****************************************************************************************
2
3 Copyright (C) 2015 Autodesk, Inc.
4 All rights reserved.
5
6 Use of this software is subject to the terms of the Autodesk license agreement
7 provided at the time of installation or download, or which otherwise accompanies
8 this software in either electronic or hard copy form.
9
10****************************************************************************************/
11
12//! \file fbxtime.h
13#ifndef _FBXSDK_CORE_BASE_TIME_H_
14#define _FBXSDK_CORE_BASE_TIME_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxtimecode.h>
19#include <fbxsdk/core/base/fbxstring.h>
20
21#include <fbxsdk/fbxsdk_nsbegin.h>
22
23#define FBXSDK_TIME_INFINITE FbxTime(FBXSDK_TC_INFINITY)
24#define FBXSDK_TIME_MINUS_INFINITE FbxTime(FBXSDK_TC_MINFINITY)
25#define FBXSDK_TIME_ZERO FbxTime(FBXSDK_TC_ZERO)
26#define FBXSDK_TIME_EPSILON FbxTime(FBXSDK_TC_EPSILON)
27#define FBXSDK_TIME_ONE_SECOND FbxTime(FBXSDK_TC_SECOND)
28#define FBXSDK_TIME_ONE_MINUTE FbxTime(FBXSDK_TC_MINUTE)
29#define FBXSDK_TIME_ONE_HOUR FbxTime(FBXSDK_TC_HOUR)
30#define FBXSDK_TIME_ASSERT_EPSILON 0.5
31#define FBXSDK_TIME_FORWARD 1
32#define FBXSDK_TIME_BACKWARD -1
33
34class FbxTimeModeObject;
35
36/** Class to encapsulate time units.
37 * \nosubgrouping
38 * FbxTime can measure time in hour, minute, second, frame, field, residual and also combination of these units.
39 * It is recommended to use FbxTime for all time related operations. For example, currently it is used in FbxGlobalSettings,
40 * FbxGlobalTimeSettings, FbxCache, all curve filters and all animation-related classes, etc.
41 * FbxTime is just used to represent a moment, to represent a period of time, FbxTimeSpan should be used.
42 * \see FbxTimeSpan
43 */
44class FBXSDK_DLL FbxTime
45{
46public:
47 /** Long long constructor.
48 * \param pTime Initial value defined as a 64bit integer.
49 */
50 FbxTime(const FbxLongLong pTime=0){ mTime = pTime; }
51
52 /**
53 * \name Time Modes and Protocols
54 */
55 //@{
56 /** Time modes.
57 * \remarks
58 * EMode \c eNTSCDropFrame is used for broadcasting operations where
59 * clock time must be (almost) in sync with time code. To bring back color
60 * NTSC time code with clock time, this mode drops 2 frames per minute
61 * except for every 10 minutes (00, 10, 20, 30, 40, 50). 108 frames are
62 * dropped per hour. Over 24 hours the error is 2 frames and 1/4 of a
63 * frame. A time-code of 01:00:03:18 equals a clock time of 01:00:00:00
64 *
65 * \par
66 * EMode \c eNTSCFullFrame represents a time address and therefore is NOT
67 * IN SYNC with clock time. A time code of 01:00:00:00 equals a clock time
68 * of 01:00:03:18.
69 *
70 * - \e eDefaultMode
71 * - \e eFrames120 120 frames/s
72 * - \e eFrames100 100 frames/s
73 * - \e eFrames60 60 frames/s
74 * - \e eFrames50 50 frames/s
75 * - \e eFrames48 48 frame/s
76 * - \e eFrames30 30 frames/s (black and white NTSC)
77 * - \e eFrames30Drop 30 frames/s (use when display in frame is selected, equivalent to NTSC drop)
78 * - \e eNTSCDropFrame ~29.97 frames/s drop color NTSC
79 * - \e eNTSCFullFrame ~29.97 frames/s color NTSC
80 * - \e ePAL 25 frames/s PAL/SECAM
81 * - \e eFrames24 24 frames/s Film/Cinema
82 * - \e eFrames1000 1000 milli/s (use for date time)
83 * - \e eFilmFullFrame ~23.976 frames/s
84 * - \e eCustom Custom frame rate value
85 * - \e eFrames96 96 frames/s
86 * - \e eFrames72 72 frames/s
87 * - \e eFrames59dot94 ~59.94 frames/s
88 * - \e eModesCount Number of time modes
89 */
90 enum EMode
91 {
92 eDefaultMode,
93 eFrames120,
94 eFrames100,
95 eFrames60,
96 eFrames50,
97 eFrames48,
98 eFrames30,
99 eFrames30Drop,
100 eNTSCDropFrame,
101 eNTSCFullFrame,
102 ePAL,
103 eFrames24,
104 eFrames1000,
105 eFilmFullFrame,
106 eCustom,
107 eFrames96,
108 eFrames72,
109 eFrames59dot94,
110 eModesCount
111 };
112
113 /** Time protocols enumaration
114 * - \e eSMPTE SMPTE EProtocol
115 * - \e eFrameCount Frame count
116 * - \e eDefaultProtocol Default protocol (initialized to eFRAMES)
117 */
118 enum EProtocol {eSMPTE, eFrameCount, eDefaultProtocol};
119
120 /** Set default time mode.
121 * \param pTimeMode Time mode identifier.
122 * \param pFrameRate Custom framerate, only have effect in case of pTimeMode = FbxTime::eCustom
123 * \remarks It is meaningless to set default time mode to \c eDefaultMode.
124 */
125 static void SetGlobalTimeMode(EMode pTimeMode, double pFrameRate=0.0);
126
127 /** Get default time mode.
128 * \return Currently set time mode identifier.
129 * \remarks Default time mode initial value is eFrames30.
130 */
131 static EMode GetGlobalTimeMode();
132
133 /** Set default time protocol.
134 * \param pTimeProtocol Time protocol identifier.
135 * \remarks It is meaningless to set default time protocol to \c eDefaultProtocol.
136 */
137 static void SetGlobalTimeProtocol(EProtocol pTimeProtocol);
138
139 /** Get default time protocol.
140 * \return Currently set time protocol identifier.
141 * \remarks Default time protocol initial value is eSMPTE.
142 */
143 static EProtocol GetGlobalTimeProtocol();
144
145 /** Get frame rate associated with time mode, in frames per second.
146 * \param pTimeMode Time mode identifier.
147 * \return Frame rate value.
148 */
149 static double GetFrameRate(EMode pTimeMode);
150
151 /** Get time mode associated with frame rate.
152 * \param pFrameRate The frame rate value.
153 * \param pPrecision The tolerance value.
154 * \return The corresponding time mode identifier or \c eDefaultMode if no time
155 * mode associated to the given frame rate is found.
156 */
157 static EMode ConvertFrameRateToTimeMode(double pFrameRate, double pPrecision=0.00000001);
158 //@}
159
160 /**
161 * \name Time Conversion
162 */
163 //@{
164 /** Set time in internal format.
165 * \param pTime Time value to set.
166 */
167 inline void Set(FbxLongLong pTime){ mTime = pTime; }
168
169 /** Get time in internal format.
170 * \return Time value.
171 */
172 inline FbxLongLong Get() const { return mTime; }
173
174 /** Set time in milliseconds.
175 * \param pMilliSeconds Time value to set.
176 */
177 inline void SetMilliSeconds(FbxLongLong pMilliSeconds){ mTime = pMilliSeconds * FBXSDK_TC_MILLISECOND; }
178
179 /** Get time in milliseconds.
180 * \return Time value.
181 */
182 inline FbxLongLong GetMilliSeconds() const { return mTime / FBXSDK_TC_MILLISECOND; }
183
184 /** Set time in seconds.
185 * \param pTime Time value to set.
186 */
187 void SetSecondDouble(double pTime);
188
189 /** Get time in seconds.
190 * \return Time value.
191 */
192 double GetSecondDouble() const;
193
194 /** Set time in hour/minute/second/frame/field format.
195 * \param pHour The hours value.
196 * \param pMinute The minutes value.
197 * \param pSecond The seconds value.
198 * \param pFrame The frames values.
199 * \param pField The field value.
200 * \param pTimeMode Time mode identifier.
201 * \remarks Parameters pHour, pMinute, pSecond, pFrame and pField are summed together.
202 * For example, it is possible to set the time to 83 seconds in the following
203 * ways: SetTime(0,1,23) or SetTime(0,0,83).
204 */
205 void SetTime(int pHour, int pMinute, int pSecond, int pFrame=0, int pField=0, EMode pTimeMode=eDefaultMode);
206
207 /** Set time in hour/minute/second/frame/field/residual format.
208 * \param pHour The hours value.
209 * \param pMinute The minutes value.
210 * \param pSecond The seconds value.
211 * \param pFrame The frames values.
212 * \param pField The field value.
213 * \param pResidual The hundredths of frame value.
214 * \param pTimeMode Time mode identifier.
215 * \remarks Parameters pHour, pMinute, pSecond, pFrame, pField and pResidual
216 * are summed together, just like above.
217 * pResidual represents hundredths of frame, and won't necessarily
218 * correspond to an exact internal value.
219 *
220 * \remarks The time mode can't have a default value, because
221 * otherwise SetTime(int, int, int, int, int, int)
222 * would be ambiguous. Please specify DEFAULT_MODE.
223 */
224 void SetTime(int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, EMode pTimeMode);
225
226 /** Get time in hour/minute/second/frame/field/residual format.
227 * \param pHour The returned hours value.
228 * \param pMinute The returned minutes value.
229 * \param pSecond The returned seconds value.
230 * \param pFrame The returned frames values.
231 * \param pField The returned field value.
232 * \param pResidual The returned hundredths of frame value.
233 * \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
234 * \return \c true if the pTimeMode parameter is a valid identifier and thus the extraction
235 * succeeded. If the function returns \c false, all the values are set to 0.
236 */
237 bool GetTime(int& pHour, int& pMinute, int& pSecond, int& pFrame, int& pField, int& pResidual, EMode pTimeMode=eDefaultMode) const;
238
239 /** Snaps a time value to the time value associated with the nearest frame.
240 * \param pRound If \c true the return value is rounded to the nearest integer.
241 * \return The snapped time value.
242 */
243 FbxTime GetFramedTime(bool pRound=true) const;
244
245 /** Set time in frame format.
246 * \param pFrames The number of frames.
247 * \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
248 */
249 void SetFrame(FbxLongLong pFrames, EMode pTimeMode=eDefaultMode);
250
251 /** Set time in frame format, including fractions.
252 * \param pFrames The number of frames in decimal value.
253 * \param pTimeMode The time mode identifier which will dictate the extraction algorithm.
254 */
255 void SetFramePrecise(FbxDouble pFrames, EMode pTimeMode=eDefaultMode);
256
257 /** Get number of hours in time.
258 * \return Hours value.
259 */
260 int GetHourCount() const;
261
262 /** Get number of minutes in time.
263 * \return Minutes value.
264 */
265 int GetMinuteCount() const;
266
267 /** Get number of seconds in time.
268 * \return Seconds value.
269 */
270 int GetSecondCount() const;
271
272 /** Get number of frames in time.
273 * \param pTimeMode Time mode identifier.
274 * \return Integer value representing the frame count.
275 */
276 FbxLongLong GetFrameCount(EMode pTimeMode=eDefaultMode) const;
277
278 /** Get precise number of frames in time, including fractions.
279 * \param pTimeMode Time mode identifier.
280 * \return Decimal value representing the frame count, including fractions.
281 */
282 FbxDouble GetFrameCountPrecise(EMode pTimeMode=eDefaultMode) const;
283
284 /** Get number of fields in time.
285 * \param pTimeMode Time mode identifier.
286 * \return Fields value.
287 */
288 FbxLongLong GetFieldCount(EMode pTimeMode=eDefaultMode) const;
289
290 /** Get residual time exceeding last full field.
291 * \param pTimeMode Time mode identifier.
292 * \return Residual value.
293 */
294 int GetResidual(EMode pTimeMode=eDefaultMode) const;
295
296 /** Test for Drop Frame mode
297 * \param pTimeMode Time mode identifier.
298 * \return True if the pTimeMode is a Drop Frame mode.
299 */
300 static bool IsDropFrame(EMode pTimeMode=eDefaultMode);
301
302 /** Separator char between second and frame.
303 * \param pTimeMode Time mode identifier.
304 * \return ';' is returned if pTimeMode is a DropFrame mode otherwise ':'.
305 */
306 char GetFrameSeparator(EMode pTimeMode=eDefaultMode) const;
307
308 /** Get time in a human readable format.
309 * \param pTimeString An array large enough to contain a minimum of 19 characters.
310 * \param pTimeStringSize Size of the pTimeString buffer used with secure functions.
311 * \param pInfo The amount of information if time protocol is \c eSMPTE:
312 * <ul><li>1 means hours only
313 * <li>2 means hours and minutes
314 * <li>3 means hours, minutes and seconds
315 * <li>4 means hours, minutes, seconds and frames
316 * <li>5 means hours, minutes, seconds, frames and field
317 * <li>6 means hours, minutes, seconds, frames, field and residual value</ul>
318 * \param pTimeMode Requested time mode.
319 * \param pTimeFormat Requested time protocol.
320 * \return pTimeString parameter filled with a time value or set to a empty string
321 * if parameter pInfo is not valid.
322 */
323 char* GetTimeString(char* pTimeString, const FbxUShort& pTimeStringSize, int pInfo=5, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const;
324
325 enum EElement {eHours, eMinutes, eSeconds, eFrames, eField, eResidual};
326
327 /** Get the time in a human readable format.
328 * \param pStart The starting element type used to format the time string.
329 * \param pEnd The last element type used to format the time string.
330 * \param pTimeMode The time mode requested.
331 * \param pTimeFormat The time format requested.
332 * \return The human readable time string. */
333 FbxString GetTimeString(EElement pStart=eHours, EElement pEnd=eResidual, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const;
334
335 /** Set time in a human readable format.
336 * \param pTime An array of a maximum of 18 characters.
337 * If time protocol is \c eSMPTE, pTimeString must be formatted this way:
338 * "[hours:]minutes[:seconds[.frames[.fields]]]". Hours, minutes, seconds,
339 * frames and fields are parsed as integers and brackets indicate optional
340 * parts.
341 * If time protocol is \c eFRAME, pTimeString must be formatted this way:
342 * "frames". Frames is parsed as a 64 bits integer.
343 * \param pTimeMode Given time mode.
344 * \param pTimeFormat Given time protocol.
345 * \return True if the set time string succeed, otherwise return false.
346 */
347 bool SetTimeString(const char* pTime, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol);
348 //@}
349
350 /**
351 * \name Time Operators
352 */
353 //@{
354 /** Equality operator.
355 * \param pTime The FbxTime to be compared.
356 * \return \c true if equal, \c false otherwise.
357 */
358 inline bool operator==(const FbxTime& pTime) const { return mTime == pTime.mTime; }
359
360 /** Inequality operator.
361 * \param pTime The FbxTime to be compared.
362 * \return \c true if unequal, \c false otherwise.
363 */
364 inline bool operator!=(const FbxTime& pTime) const { return mTime != pTime.mTime; }
365
366 /** Superior or equal to operator.
367 * \param pTime The FbxTime to be compared.
368 * \return \c true if this FbxTime is superior or equal to the passed FbxTime, \c false otherwise.
369 */
370 inline bool operator>=(const FbxTime& pTime) const { return mTime >= pTime.mTime; }
371
372 /** Inferior or equal to operator.
373 * \param pTime The FbxTime to be compared.
374 * \return \c true if this FbxTime is inferior or equal to the passed FbxTime, \c false otherwise.
375 */
376 inline bool operator<=(const FbxTime& pTime) const { return mTime <= pTime.mTime; }
377
378 /** Superior to operator.
379 * \param pTime The FbxTime to be compared.
380 * \return \c true if this FbxTime is superior to the passed FbxTime, \c false otherwise.
381 */
382 inline bool operator>(const FbxTime& pTime) const { return mTime > pTime.mTime; }
383
384 /** Inferior to operator.
385 * \param pTime The FbxTime to be compared.
386 * \return \c true if this FbxTime is inferior to the passed FbxTime, \c false otherwise.
387 */
388 inline bool operator<(const FbxTime& pTime) const { return mTime < pTime.mTime; }
389
390 /** Assignment operator.
391 * \param pTime The FbxTime to be assigned.
392 */
393 inline FbxTime& operator=(const FbxTime& pTime) { mTime = pTime.mTime; return *this; }
394
395 /** Addition operator.
396 * \param pTime The FbxTime to be added.
397 * \return This FbxTime after addition.
398 */
399 inline FbxTime& operator+=(const FbxTime& pTime) { mTime += pTime.mTime; return *this; }
400
401 /** Subtraction operator.
402 * \param pTime The FbxTime to be subtracted.
403 * \return This FbxTime after subtraction.
404 */
405 inline FbxTime& operator-=(const FbxTime& pTime) { mTime -= pTime.mTime; return *this; }
406
407 /** Addition operator.
408 * \param pTime The FbxTime to be added.
409 * \return A temporary FbxTime after addition.
410 */
411 FbxTime operator+(const FbxTime& pTime) const;
412
413 /** Subtraction operator.
414 * \param pTime The FbxTime to be subtracted.
415 * \return A temporary FbxTime after subtraction.
416 */
417 FbxTime operator-(const FbxTime& pTime) const;
418
419 /** Multiplication operator.
420 * \param Mult Multiply this FbxTime by int Mult.
421 * \return A temporary FbxTime after multiplication.
422 */
423 FbxTime operator*(const int Mult) const;
424
425 /** Division operator.
426 * \param pTime Divide this FbxTime by pTime.
427 * \return A temporary FbxTime after division.
428 */
429 FbxTime operator/(const FbxTime& pTime) const;
430
431 /** Multiplication operator.
432 * \param pTime Multiply this FbxTime by pTime.
433 * \return A temporary FbxTime after multiplication.
434 */
435 FbxTime operator*(const FbxTime& pTime) const;
436/*
437 //! Increment time of one unit of the internal format (prefix form).
438 inline FbxTime& operator++() { mTime += 1; return (*this); }
439
440 //! Increment time of one unit of the internal format (postfix form).
441 inline const FbxTime operator++(int) { FbxTime lOld = *this; ++(*this); return lOld; }
442
443 //! Decrement time of one unit of the internal format (prefix form).
444 inline FbxTime& operator--() { mTime -= 1; return (*this); }
445
446 //! Decrement time of one unit of the internal format (postfix form).
447 inline const FbxTime operator--(int) { FbxTime lOld = *this; --(*this); return lOld; }*/
448 //@}
449
450 /** One frame value for a specified time mode.
451 * \param pTimeMode Time mode identifier.
452 * \return the time code of a one frame.
453 */
454 static FbxLongLong GetOneFrameValue(EMode pTimeMode=eDefaultMode);
455
456/*****************************************************************************************************************************
457** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
458*****************************************************************************************************************************/
459#ifndef DOXYGEN_SHOULD_SKIP_THIS
460 // Keep compatibility with old fbx format
461 enum EOldMode
462 {
463 eOLD_DEFAULT_MODE, //Default mode set using FbxTime::SetGlobalTimeMode(EMode pTimeMode)
464 eOLD_CINEMA, //24 frameOLD_s/s
465 eOLD_PAL, //25 frameOLD_s/s PAL/SECAM
466 eOLD_FRAMES30, //30 frameOLD_s/s BLACK & WHITE NTSC
467 eOLD_NTSC_DROP_FRAME, //29.97002617 frameOLD_s/s COLOR NTSC
468 eOLD_FRAMES50, //50 frameOLD_s/s
469 eOLD_FRAMES60, //60 frameOLD_s/s
470 eOLD_FRAMES100, //100 frameOLD_s/s
471 eOLD_FRAMES120, //120 frameOLD_s/s
472 eOLD_NTSC_FULL_FRAME, //29.97002617 frameOLD_s/s COLOR NTSC
473 eOLD_FRAMES30_DROP, //30 frameOLD_s/s
474 eOLD_FRAMES1000 //1000 frameOLD_s/s
475 };
476
477private:
478 FbxLongLong mTime; //In 1 / 46,186,158,000 Seconds
479
480 static EMode gsGlobalTimeMode;
481 static EProtocol gsGlobalTimeProtocol;
482 static FbxTimeModeObject* gsTimeObject;
483
484 void InternalSetTime(int pHour, int pMinute, int pSecond, FbxLongLong pFrame, int pField, EMode pTimeMode);
485
486 friend FBXSDK_DLL FbxTime::EMode FbxGetGlobalTimeMode();
487 friend FBXSDK_DLL FbxTimeModeObject* FbxGetGlobalTimeModeObject();
488 friend FBXSDK_DLL FbxTime::EProtocol FbxGetGlobalTimeFormat();
489 friend FBXSDK_DLL void FbxSetGlobalTimeMode(FbxTime::EMode pTimeMode, double pFrameRate);
490 friend FBXSDK_DLL void FbxSetGlobalTimeFormat(FbxTime::EProtocol pTimeFormat);
491#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
492};
493
494/** FbxTime in seconds constructor.
495 * \param pTime
496 */
497FBXSDK_DLL inline FbxTime FbxTimeSeconds(const FbxDouble& pTime=0.0)
498{
499 FbxTime lTime;
500 lTime.SetSecondDouble(pTime);
501 return lTime;
502}
503
504/** Class to encapsulate time intervals.
505 * \nosubgrouping
506 * \see FbxTime
507 */
508class FBXSDK_DLL FbxTimeSpan
509{
510public:
511 //! Constructor.
512 FbxTimeSpan() {}
513
514 /** Constructor.
515 * \param pStart Beginning of the time interval.
516 * \param pStop Ending of the time interval.
517 */
518 FbxTimeSpan(FbxTime pStart, FbxTime pStop){ mStart = pStart; mStop = pStop; }
519
520 /** Set start and stop time.
521 * \param pStart Beginning of the time interval.
522 * \param pStop Ending of the time interval.
523 */
524 inline void Set(FbxTime pStart, FbxTime pStop){ mStart = pStart; mStop = pStop; }
525
526 /** Set start time.
527 * \param pStart Beginning of the time interval.
528 */
529 inline void SetStart(FbxTime pStart){ mStart = pStart; }
530
531 /** Set stop time.
532 * \param pStop Ending of the time interval.
533 */
534 inline void SetStop(FbxTime pStop){ mStop = pStop; }
535
536 /** Get start time.
537 * \return Beginning of time interval.
538 */
539 inline FbxTime GetStart() const { return mStart; }
540
541 /** Get stop time.
542 * \return Ending of time interval.
543 */
544 inline FbxTime GetStop() const { return mStop; }
545
546 /** Get time interval in absolute value.
547 * \return Time interval.
548 */
549 inline FbxTime GetDuration() const { if( mStop > mStart ) return mStop - mStart; else return mStart - mStop; }
550
551 /** Get time interval.
552 * \return Signed time interval.
553 */
554 inline FbxTime GetSignedDuration() const { return mStop - mStart; }
555
556 /** Get direction of the time interval.
557 * \return \c FBXSDK_TIME_FORWARD if time interval is forward, \c FBXSDK_TIME_BACKWARD if backward.
558 */
559 inline int GetDirection() const { if( mStop >= mStart ) return FBXSDK_TIME_FORWARD; else return FBXSDK_TIME_BACKWARD; }
560
561 /** Return \c true if the time is inside the timespan.
562 * \param pTime Judge whether pTime is inside the timespan.
563 * \return \c True if is, \c false otherwise.
564 */
565 bool IsInside(FbxTime pTime) const;
566
567 /** Return the intersection of the two time spans.
568 * \param pTime
569 * \return The intersection of pTime and this FbxTimeSpan.
570 */
571 FbxTimeSpan Intersect(const FbxTimeSpan& pTime) const;
572
573 /** Inequality operator.
574 * \param pTime FbxTimeSpan compared with this one.
575 * \return \c True if unequal, \c false otherwise.
576 */
577 bool operator!=(const FbxTimeSpan& pTime) const;
578
579 /** Equality operator.
580 * \param pTime FbxTimeSpan compared with this one.
581 * \return \c True if equal, \c false otherwise.
582 */
583 bool operator==(const FbxTimeSpan& pTime) const;
584
585 /** Unite with another FbxTimeSpan
586 * \param pSpan The FbxTimeSpan
587 * \param pDirection FBXSDK_TIME_FORWARD or FBXSDK_TIME_BACKWARD
588 * \remarks This function assumes both of the FbxTimeSpan objects are in the same direction.
589 * Use FBXSDK_TIME_FORWARD when start < stop in both timespan
590 * Use FBXSDK_TIME_BACKWARD when start > stop in both timespan
591 */
592 void UnionAssignment(const FbxTimeSpan& pSpan, int pDirection=FBXSDK_TIME_FORWARD);
593
594/*****************************************************************************************************************************
595** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
596*****************************************************************************************************************************/
597#ifndef DOXYGEN_SHOULD_SKIP_THIS
598private:
599 FbxTime mStart;
600 FbxTime mStop;
601#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
602};
603
604class FBXSDK_DLL FbxLocalTime
605{
606public:
607 FbxLocalTime();
608
609 int mYear;
610 int mMonth;
611 int mDay;
612 int mHour;
613 int mMinute;
614 int mSecond;
615 int mMillisecond;
616};
617
618FBXSDK_DLL void FbxGetCurrentLocalTime(FbxLocalTime& pLocalTime);
619
620FBXSDK_DLL FbxTime::EMode FbxGetGlobalTimeMode();
621FBXSDK_DLL FbxTimeModeObject* FbxGetGlobalTimeModeObject();
622FBXSDK_DLL FbxTime::EProtocol FbxGetGlobalTimeFormat();
623FBXSDK_DLL void FbxSetGlobalTimeMode(FbxTime::EMode pTimeMode, double pFrameRate=0.0);
624FBXSDK_DLL void FbxSetGlobalTimeFormat(FbxTime::EProtocol pTimeFormat);
625
626// Use those functions to keep the compatibility with old time mode since we added new time mode.
627FBXSDK_DLL FbxTime::EOldMode FbxGetOldTimeModeCorrespondance(FbxTime::EMode pMode);
628FBXSDK_DLL FbxTime::EMode FbxGetTimeModeFromOldValue(FbxTime::EOldMode pOldMode);
629
630// We now store the framerate instead of the time mode.
631FBXSDK_DLL FbxTime::EMode FbxGetTimeModeFromFrameRate(char* pFrameRate);
632FBXSDK_DLL void FbxGetControlStringList(char* pControlString, FbxTime::EProtocol pTimeFormat);
633FBXSDK_DLL const char* FbxGetGlobalFrameRateString(FbxTime::EMode pTimeMode);
634FBXSDK_DLL const char* FbxGetGlobalTimeModeString(FbxTime::EMode pTimeMode);
635FBXSDK_DLL double FbxGetFrameRate(FbxTime::EMode pTimeMode);
636
637// Time format
638FBXSDK_DLL FbxTime::EProtocol FbxSelectionToTimeFormat(int pSelection);
639FBXSDK_DLL FbxTime::EMode FbxSelectionToTimeMode(int pSelection);
640FBXSDK_DLL int FbxTimeToSelection(FbxTime::EMode pTimeMode=FbxTime::eDefaultMode, int pTimeFormat=FbxTime::eDefaultProtocol);
641FBXSDK_DLL const char* FbxGetTimeModeName(FbxTime::EMode pTimeMode);
642FBXSDK_DLL int FbxGetFrameRateStringListIndex(FbxTime::EMode pTimeMode);
643FBXSDK_DLL bool FbxIsValidCustomFrameRate(double pFramerate);
644FBXSDK_DLL bool FbxGetNearestCustomFrameRate(double pFramerate, double& pNearestRate);
645
646#include <fbxsdk/fbxsdk_nsend.h>
647
648#endif /* _FBXSDK_CORE_BASE_TIME_H_ */
649