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 fbxglobalsettings.h
13#ifndef _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_
14#define _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/fbxobject.h>
19#include <fbxsdk/core/base/fbxstatus.h>
20#include <fbxsdk/scene/fbxaxissystem.h>
21
22#include <fbxsdk/fbxsdk_nsbegin.h>
23
24/** \brief This class contains functions for accessing global settings.
25 * \nosubgrouping
26 */
27class FBXSDK_DLL FbxGlobalSettings : public FbxObject
28{
29 FBXSDK_OBJECT_DECLARE(FbxGlobalSettings, FbxObject);
30
31public:
32 /**
33 * \name Axis system
34 */
35 //@{
36
37 /** Sets the scene's coordinate system.
38 * \param pAxisSystem The coordinate system to set.
39 */
40 void SetAxisSystem(const FbxAxisSystem& pAxisSystem);
41
42 /** Returns the scene's current coordinate system.
43 * \return The scene's current coordinate system.
44 */
45 FbxAxisSystem GetAxisSystem();
46 //@}
47
48 /** Sets the coordinate system's original Up Axis when the scene is created.
49 * \param pAxisSystem The coordinate system whose Up Axis is copied.
50 */
51 void SetOriginalUpAxis(const FbxAxisSystem& pAxisSystem);
52
53 /** Returns the coordinate system's original Up Axis.
54 * \return The coordinate system's original Up Axis when the scene is created. 0 is X, 1 is Y, 2 is Z axis.
55 */
56 int GetOriginalUpAxis() const;
57 //@}
58
59 /**
60 * \name System Units
61 */
62 //@{
63
64 /** Sets the unit of measurement used by the system.
65 * \param pOther The system unit to set.
66 */
67 void SetSystemUnit(const FbxSystemUnit& pOther);
68
69 /** Returns the unit of measurement used by the system.
70 * \return The unit of measurement used by the system.
71 */
72 FbxSystemUnit GetSystemUnit() const;
73
74 /** Sets the original unit of measurement used by the system.
75 * \param pOther The original system unit to set.
76 */
77 void SetOriginalSystemUnit(const FbxSystemUnit& pOther);
78
79 /** Returns the original unit of measurement used by the system.
80 * \return The original unit of measurement used by the system.
81 */
82 FbxSystemUnit GetOriginalSystemUnit() const;
83 //@}
84
85
86 /**
87 * \name Light Settings
88 */
89 //@{
90
91 /** Sets the ambient color.
92 * \param pAmbientColor The ambient color to set.
93 * \remarks The ambient color only uses the RGB channels.
94 */
95 void SetAmbientColor(FbxColor pAmbientColor);
96
97 /** Returns the ambient color.
98 * \return The ambient color.
99 */
100 FbxColor GetAmbientColor() const;
101
102 //@}
103
104 /**
105 * \name Camera Settings
106 */
107 //@{
108 /** Sets the default camera.
109 * \param pCameraName Name of the default camera.
110 * \return \c true if camera name is valid, returns \c false if the camera does not have a valid name.
111 * \remarks A valid camera name can be either one of the defined tokens (FBXSDK_CAMERA_PERSPECTIVE,
112 * FBXSDK_CAMERA_TOP, FBXSDK_CAMERA_FRONT, FBXSDK_CAMERA_BACK, FBXSDK_CAMERA_RIGHT, FBXSDK_CAMERA_LEFT and FBXSDK_CAMERA_BOTTOM) or the name
113 * of a camera inserted in the node tree under the scene's root node.
114 */
115 bool SetDefaultCamera(const char* pCameraName);
116
117 /** Returns the default camera name.
118 * \return The default camera name, or an empty string if no camera name has been set.
119 */
120 FbxString GetDefaultCamera() const;
121 //@}
122
123 /**
124 * \name Time Settings
125 */
126 //@{
127 /** Sets the time mode.
128 * \param pTimeMode One of the defined modes in class FbxTime.
129 */
130 void SetTimeMode(FbxTime::EMode pTimeMode);
131
132 /** Returns the time mode.
133 * \return The currently set TimeMode.
134 */
135 FbxTime::EMode GetTimeMode() const;
136
137 /** Sets the time protocol.
138 * \param pTimeProtocol One of the defined protocols in FbxTime class.
139 */
140 void SetTimeProtocol(FbxTime::EProtocol pTimeProtocol);
141
142 /** Returns the time protocol.
143 * \return The currently set time protocol (default FbxTime::eFrameCount).
144 */
145 FbxTime::EProtocol GetTimeProtocol() const;
146
147 /** \enum ESnapOnFrameMode Snap on frame mode.
148 */
149 enum ESnapOnFrameMode
150 {
151 eNoSnap, //! No snap.
152 eSnapOnFrame, //! Snap on frame.
153 ePlayOnFrame, //! Play on frame.
154 eSnapAndPlayOnFrame //! Snap and play on frame.
155 };
156
157 /** Sets the snap on frame mode.
158 * \param pSnapOnFrameMode One of the following values: eNoSnap, eSnapOnFrame, ePlayOnFrame, or eSnapAndPlayOnFrame.
159 */
160 void SetSnapOnFrameMode(ESnapOnFrameMode pSnapOnFrameMode);
161
162 /** Returns the snap on frame mode.
163 * \return The currently set snap on frame mode (default eNoSnap).
164 */
165 ESnapOnFrameMode GetSnapOnFrameMode() const;
166
167 /** Sets the default time span of the time line.
168 * \param pTimeSpan The default time span of the time line.
169 */
170 void SetTimelineDefaultTimeSpan(const FbxTimeSpan& pTimeSpan);
171
172 /** Returns the default time span of the time line.
173 * \param pTimeSpan The default time span of the time line.
174 */
175 void GetTimelineDefaultTimeSpan(FbxTimeSpan& pTimeSpan) const;
176
177 /** Set custom frame rate.
178 * This is meaningless if the time mode is not FbxTime::eCustom.
179 */
180 void SetCustomFrameRate(double pCustomFrameRate);
181
182 /** Return frame rate if the time mode is FbxTime::eCustom.
183 * If the time mode is not FbxTime::eCustom, return -1.
184 */
185 double GetCustomFrameRate() const;
186 //@}
187
188 /**
189 * \name Time Markers
190 */
191 //@{
192 struct FBXSDK_DLL TimeMarker
193 {
194 //! Default constructor.
195 TimeMarker();
196
197 /** Copy constructor.
198 * \param pTimeMarker Another time marker copied to this time marker.
199 */
200 TimeMarker(const TimeMarker& pTimeMarker);
201
202 /** Assignment operator.
203 * \param pTimeMarker Another time marker assigned to this time marker.
204 */
205 TimeMarker& operator=(const TimeMarker& pTimeMarker);
206
207 //! Marker name.
208 FbxString mName;
209
210 //! Marker time.
211 FbxTime mTime;
212
213 //! Loop flag.
214 bool mLoop;
215 };
216
217 /** Returns the number of time markers.
218 * \return The number of time markers.
219 */
220 int GetTimeMarkerCount() const;
221
222 /** Returns the time marker at the given index.
223 * \param pIndex The time marker index.
224 * \param pStatus The FbxStatus object to hold error codes.
225 * \return A copy of the time marker at the given index, or an empty one if an error occurred.
226 */
227 TimeMarker GetTimeMarker(int pIndex, FbxStatus* pStatus=NULL) const;
228
229 /** Adds a time marker.
230 * \param pTimeMarker The new time marker to be added.
231 * \param pStatus The FbxStatus object to hold error codes.
232 */
233 void AddTimeMarker(const TimeMarker& pTimeMarker, FbxStatus* pStatus=NULL);
234
235 /** Replaces the time marker at the specified index with the new one.
236 * \param pIndex The time marker index.
237 * \param pTimeMarker The new time marker.
238 * \param pStatus The FbxStatus object to hold error codes.
239 */
240 void ReplaceTimeMarker(int pIndex, const TimeMarker& pTimeMarker, FbxStatus* pStatus=NULL);
241
242 //! Removes all time markers and sets the current time marker index to -1.
243 void RemoveAllTimeMarkers();
244
245 /** Sets the index of the current time marker.
246 * \param pIndex The current time marker index.
247 * \param pStatus The FbxStatus object to hold error codes.
248 * \return \c true if successful, or returns \c false if the index is not valid.
249 */
250 bool SetCurrentTimeMarker(int pIndex, FbxStatus* pStatus=NULL);
251
252 /** Returns the current time marker index.
253 * \return The current time marker index, or -1 if no current time marker has been set.
254 */
255 int GetCurrentTimeMarker() const;
256 //@}
257
258/*****************************************************************************************************************************
259** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
260*****************************************************************************************************************************/
261#ifndef DOXYGEN_SHOULD_SKIP_THIS
262 virtual FbxObject& Copy(const FbxObject& pObject);
263
264protected:
265 FbxPropertyT<FbxInt> UpAxis;
266 FbxPropertyT<FbxInt> UpAxisSign;
267
268 FbxPropertyT<FbxInt> FrontAxis;
269 FbxPropertyT<FbxInt> FrontAxisSign;
270
271 FbxPropertyT<FbxInt> CoordAxis;
272 FbxPropertyT<FbxInt> CoordAxisSign;
273
274 FbxPropertyT<FbxInt> OriginalUpAxis;
275 FbxPropertyT<FbxInt> OriginalUpAxisSign;
276
277 FbxPropertyT<FbxDouble> UnitScaleFactor;
278 FbxPropertyT<FbxDouble> OriginalUnitScaleFactor;
279
280 FbxPropertyT<FbxDouble3> AmbientColor;
281 FbxPropertyT<FbxString> DefaultCamera;
282 FbxPropertyT<FbxEnum> TimeMode;
283 FbxPropertyT<FbxEnum> TimeProtocol;
284 FbxPropertyT<FbxEnum> SnapOnFrameMode;
285 FbxPropertyT<FbxTime> TimeSpanStart;
286 FbxPropertyT<FbxTime> TimeSpanStop;
287 FbxPropertyT<FbxDouble> CustomFrameRate;
288
289protected:
290 virtual void Construct(const FbxObject* pFrom);
291 virtual void ConstructProperties(bool pForceSet);
292
293private:
294 void AxisSystemToProperties();
295 void PropertiesToAxisSystem();
296
297 void Init();
298
299 FbxAxisSystem mAxisSystem;
300 int mNbTimeMarkers;
301
302 friend class FbxWriterFbx6;
303
304 FbxProperty mTimeMarkers;
305 FbxPropertyT<FbxInt> mCurrentTimeMarker;
306 void AddSetTimeMarker(int pIndex, const TimeMarker& pTimeMarker, FbxStatus* pStatus, bool pAdd);
307
308#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
309};
310
311inline EFbxType FbxTypeOf(const FbxTime::EMode&){ return eFbxEnum; }
312
313#include <fbxsdk/fbxsdk_nsend.h>
314
315#endif /* _FBXSDK_FILEIO_GLOBAL_SETTINGS_H_ */
316