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 fbxglobalcamerasettings.h
13#ifndef _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_
14#define _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxstring.h>
19
20#include <fbxsdk/fbxsdk_nsbegin.h>
21
22class FbxStatus;
23class FbxManager;
24class FbxScene;
25class FbxCamera;
26class FbxCameraSwitcher;
27
28#define FBXSDK_CAMERA_PERSPECTIVE "Producer Perspective"
29#define FBXSDK_CAMERA_TOP "Producer Top"
30#define FBXSDK_CAMERA_FRONT "Producer Front"
31#define FBXSDK_CAMERA_BACK "Producer Back"
32#define FBXSDK_CAMERA_RIGHT "Producer Right"
33#define FBXSDK_CAMERA_LEFT "Producer Left"
34#define FBXSDK_CAMERA_BOTTOM "Producer Bottom"
35#define FBXSDK_CAMERA_SWITCHER "Camera Switcher"
36
37/** This class contains the global camera settings.
38 * \nosubgrouping
39 * \remarks This class exists for FBX version 6.x and earlier. The new FBX v7.x file format
40 * that is now the default no longer uses it. The relevant data (a subset of this class) has
41 * been moved to the FbxGlobalSettings object and should be used instead.
42 */
43class FBXSDK_DLL FbxGlobalCameraSettings
44{
45 FBXSDK_FRIEND_NEW();
46
47public:
48 /** \name Default Camera Settings */
49 //@{
50 /** \enum EViewingMode Viewing modes. */
51 enum EViewingMode
52 {
53 eStandard, //<! Standard view mode.
54 eXRay, //<! X ray view mode.
55 eModelsOnly //<! Model only view mode.
56 };
57
58 /** Sets the default camera.
59 * \param pCameraName Name of the default camera.
60 * \param pStatus The FbxStatus object to hold error codes.
61 * \return \c True if camera name is valid, returns \c false if it is not valid.
62 * \remark A valid camera name must be either one of the defined tokens (FBXSDK_CAMERA_PERSPECTIVE, FBXSDK_CAMERA_TOP, FBXSDK_CAMERA_BOTTOM, FBXSDK_CAMERA_FRONT, FBXSDK_CAMERA_BACK,
63 * FBXSDK_CAMERA_RIGHT, FBXSDK_CAMERA_LEFT and FBXSDK_CAMERA_SWITCHER) or the name of a camera that is inserted in the node tree under the scene's root node. */
64 bool SetDefaultCamera(const char* pCameraName, FbxStatus* pStatus=NULL);
65
66 /** Returns the default camera name.
67 * \return The default camera name, or returns an empty string if no camera name has been specified. */
68 const char* GetDefaultCamera() const;
69
70 //! Restores the default settings.
71 void RestoreDefaultSettings();
72
73 /** Sets the default viewing mode.
74 * \param pViewingMode Viewing mode to set(eStandard, eXRay or eModelsOnly). */
75 void SetDefaultViewingMode(EViewingMode pViewingMode);
76
77 /** Returns the default viewing mode.
78 * \return The currently set Viewing mode. */
79 EViewingMode GetDefaultViewingMode() const;
80 //@}
81
82 /** \name Producer Cameras
83 * Producer cameras are global cameras in MotionBuilder you use to view the scene.
84 * You cannot animate Producer cameras but you can specify their default positions. */
85 //@{
86 /** Creates the default Producer cameras. */
87 void CreateProducerCameras();
88
89 /** Destroys the default Producer cameras. */
90 void DestroyProducerCameras();
91
92 /** Checks if the camera is a Producer camera.
93 * \param pCamera The camera to check.
94 * \return \c True if it is a producer camera, returns \c false if it is not a producer camera. */
95 bool IsProducerCamera(FbxCamera* pCamera) const;
96
97 /** Returns a reference to the Producer perspective camera.
98 * \return The reference to the internal Perspective camera. */
99 FbxCamera* GetCameraProducerPerspective() const;
100
101 /** Returns a reference to the Producer front camera.
102 * \return The reference to the internal Front camera. */
103 FbxCamera* GetCameraProducerFront() const;
104
105 /** Returns a reference to the Producer back camera.
106 * \return The reference to the internal Back camera. */
107 FbxCamera* GetCameraProducerBack() const;
108
109 /** Returns a reference to the Producer left camera.
110 * \return The reference to the internal Left camera. */
111 FbxCamera* GetCameraProducerLeft() const;
112
113 /** Returns a reference to the Producer right camera.
114 * \return The reference to the internal Right camera. */
115 FbxCamera* GetCameraProducerRight() const;
116
117 /** Returns a reference to the Producer top camera.
118 * \return The reference to the internal Top camera. */
119 FbxCamera* GetCameraProducerTop() const;
120
121 /** Returns a reference to the Producer bottom camera.
122 * \return The reference to the internal Bottom camera. */
123 FbxCamera* GetCameraProducerBottom() const;
124
125 /** Returns the Camera Switcher.
126 * \return A pointer to the Camera Switcher.
127 * \remark This node has a \c FbxNodeAttribute::eCameraSwitcher node attribute type. This node is not saved when there is no camera in the scene. Nodes inserted below are never saved.
128 * Camera indices start at 1. Out of range indices are clamped between 1 and the number of cameras in the scene. The index of a camera refers to its order of appearance when searching
129 * the node tree depth first. If a camera is added or removed after camera indices have been set, the camera indices must be updated. It is easier to set camera indices once every camera
130 * have been set. Camera index keys must be set using constant interpolation to ensure that camera switches occur exactly at key time. */
131 FbxCameraSwitcher* GetCameraSwitcher() const;
132
133 /** Sets the Camera Switcher.
134 * \param pSwitcher The Camera Switcher to be set. */
135 void SetCameraSwitcher(FbxCameraSwitcher* pSwitcher);
136 //@}
137
138 /** Assignment operator.
139 * \param pGlobalCameraSettings FbxGlobalCameraSettings object assigned to this one. */
140 const FbxGlobalCameraSettings& operator=(const FbxGlobalCameraSettings& pGlobalCameraSettings);
141
142/*****************************************************************************************************************************
143** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
144*****************************************************************************************************************************/
145#ifndef DOXYGEN_SHOULD_SKIP_THIS
146 bool CopyProducerCamera(const char* pCameraName, const FbxCamera* pCamera) const;
147
148private:
149 FbxGlobalCameraSettings(FbxManager& pManager, FbxScene& pScene);
150 ~FbxGlobalCameraSettings();
151
152 FbxScene* mScene;
153 FbxString mDefaultCamera;
154 EViewingMode mDefaultViewingMode;
155 FbxCamera* mCameraPerspective;
156 FbxCamera* mCameraFront;
157 FbxCamera* mCameraBack;
158 FbxCamera* mCameraLeft;
159 FbxCamera* mCameraRight;
160 FbxCamera* mCameraTop;
161 FbxCamera* mCameraBottom;
162 FbxCameraSwitcher* mCameraSwitcher;
163#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
164};
165
166#include <fbxsdk/fbxsdk_nsend.h>
167
168#endif /* _FBXSDK_FILEIO_GLOBAL_CAMERA_SETTINGS_H_ */
169