ufe  4.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
camera.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.10-windows/ufe/include/camera.h"
2 #ifndef _camera
3 #define _camera
4 // ===========================================================================
5 // Copyright 2020 Autodesk, Inc. All rights reserved.
6 //
7 // Use of this software is subject to the terms of the Autodesk license
8 // agreement provided at the time of installation or download, or which
9 // otherwise accompanies this software in either electronic or hard copy form.
10 // ===========================================================================
11 
12 #include "common/ufeExport.h"
13 #include "sceneItem.h"
14 #include "observer.h"
15 #include "cameraUndoableCommands.h"
16 #include "types.h"
17 
18 #include <memory>
19 #include <array>
20 
22 {
23 
25 
50 {
51 public:
52  typedef std::shared_ptr<Camera> Ptr;
53 
55  {
57  Orthographic
58  };
59 
68  static Ptr camera(const SceneItem::Ptr &item);
69 
77  static bool addObserver(
78  const SceneItem::Ptr &item, const Observer::Ptr &obs);
79 
87  static bool removeObserver(
88  const SceneItem::Ptr &item, const Observer::Ptr &obs);
89 
90  typedef bool (*RemoveObserverItemType)(const SceneItem::Ptr &item, const Observer::Ptr& obs);
91 
99  static bool removeObserver(
100  const Path &path, const Observer::Ptr &obs);
101 
102  typedef bool (*RemoveObserverPathType)(const Path& path, const Observer::Ptr& obs);
103 
109  static std::size_t nbObservers(const SceneItem::Ptr &item);
110 
118  static bool hasObserver(
119  const SceneItem::Ptr &item, const Observer::Ptr &obs);
120 
123  static bool hasObservers(const Path &path);
124 
129  static bool hasObservers(Rtid runTimeId);
130 
134  static void notify(const Path &path);
135 
137  Camera();
139  Camera(const Camera &) = default;
141  virtual ~Camera();
142 
144  virtual const Path &path() const = 0;
145 
147  virtual SceneItem::Ptr sceneItem() const = 0;
148 
153  virtual HorizontalApertureUndoableCommand::Ptr horizontalApertureCmd(
154  float ha) = 0;
155 
159  virtual void horizontalAperture(float ha)
160  {
161  auto cmd = horizontalApertureCmd(ha);
162  if (cmd)
163  {
164  cmd->execute();
165  }
166  }
167 
170  virtual float horizontalAperture() const = 0;
171 
176  virtual VerticalApertureUndoableCommand::Ptr verticalApertureCmd(
177  float va) = 0;
178 
182  virtual void verticalAperture(float va)
183  {
184  auto cmd = verticalApertureCmd(va);
185  if (cmd)
186  {
187  cmd->execute();
188  }
189  }
190 
193  virtual float verticalAperture() const = 0;
194 
199  virtual HorizontalApertureOffsetUndoableCommand::Ptr horizontalApertureOffsetCmd(
200  float hao) = 0;
201 
205  virtual void horizontalApertureOffset(float hao)
206  {
207  auto cmd = horizontalApertureOffsetCmd(hao);
208  if (cmd)
209  {
210  cmd->execute();
211  }
212  }
213 
216  virtual float horizontalApertureOffset() const = 0;
217 
222  virtual VerticalApertureOffsetUndoableCommand::Ptr verticalApertureOffsetCmd(
223  float vao) = 0;
224 
228  virtual void verticalApertureOffset(float vao)
229  {
230  auto cmd = verticalApertureOffsetCmd(vao);
231  if (cmd)
232  {
233  cmd->execute();
234  }
235  }
236 
239  virtual float verticalApertureOffset() const = 0;
240 
245  virtual FStopUndoableCommand::Ptr fStopCmd(
246  float fs) = 0;
247 
251  virtual void fStop(float fs)
252  {
253  auto cmd = fStopCmd(fs);
254  if (cmd)
255  {
256  cmd->execute();
257  }
258  }
259 
262  virtual float fStop() const = 0;
263 
268  virtual FocalLengthUndoableCommand::Ptr focalLengthCmd(
269  float fl) = 0;
270 
274  virtual void focalLength(float fl)
275  {
276  auto cmd = focalLengthCmd(fl);
277  if (cmd)
278  {
279  cmd->execute();
280  }
281  }
282 
285  virtual float focalLength() const = 0;
286 
291  virtual FocusDistanceUndoableCommand::Ptr focusDistanceCmd(
292  float fd) = 0;
293 
297  virtual void focusDistance(float fd)
298  {
299  auto cmd = focusDistanceCmd(fd);
300  if (cmd)
301  {
302  cmd->execute();
303  }
304  }
305 
308  virtual float focusDistance() const = 0;
309 
314  virtual NearClipPlaneUndoableCommand::Ptr nearClipPlaneCmd(
315  float ncp) = 0;
316 
320  virtual void nearClipPlane(float ncp)
321  {
322  auto cmd = nearClipPlaneCmd(ncp);
323  if (cmd)
324  {
325  cmd->execute();
326  }
327  }
328 
331  virtual float nearClipPlane() const = 0;
332 
337  virtual FarClipPlaneUndoableCommand::Ptr farClipPlaneCmd(
338  float fcp) = 0;
339 
343  virtual void farClipPlane(float fcp)
344  {
345  auto cmd = farClipPlaneCmd(fcp);
346  if (cmd)
347  {
348  cmd->execute();
349  }
350  }
351 
354  virtual float farClipPlane() const = 0;
355 
360  virtual ProjectionUndoableCommand::Ptr projectionCmd(
361  Projection p) = 0;
362 
366  virtual void projection(Projection p)
367  {
368  auto cmd = projectionCmd(p);
369  if (cmd)
370  {
371  cmd->execute();
372  }
373  }
374 
377  virtual Projection projection() const = 0;
378 };
379 
380 }
381 
382 #endif /* _camera */
virtual void focalLength(float fl)
Definition: camera.h:274
std::shared_ptr< Observer > Ptr
Definition: observer.h:36
Definition of macros for symbol visibility.
std::shared_ptr< ObservableSelection > Ptr
virtual void fStop(float fs)
Definition: camera.h:251
virtual void verticalAperture(float va)
Definition: camera.h:182
virtual void farClipPlane(float fcp)
Definition: camera.h:343
std::shared_ptr< SetValueUndoableCommand > Ptr
virtual void verticalApertureOffset(float vao)
Definition: camera.h:228
Identify an object or 3D path in the scene.
Definition: path.h:37
virtual void nearClipPlane(float ncp)
Definition: camera.h:320
uint32_t Rtid
Definition: rtid.h:26
Abstract base class for camera interface.
Definition: camera.h:49
std::shared_ptr< Camera > Ptr
Definition: camera.h:52
#define UFE_NS_DEF
Definition: ufe.h:35
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
virtual void horizontalAperture(float ha)
Definition: camera.h:159
virtual void focusDistance(float fd)
Definition: camera.h:297
virtual void horizontalApertureOffset(float hao)
Definition: camera.h:205
Path path(const std::string &pathString)
virtual void projection(Projection p)
Definition: camera.h:366
#define UFE_SDK_DECL
Definition: ufeExport.h:36