ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
transform3d.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/include/transform3d.h"
2#ifndef UFE_TRANSFORM3D_H
3#define UFE_TRANSFORM3D_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14#include "sceneItem.h"
15#include "observer.h"
17#include "types.h"
18
19#include <memory>
20#include <array>
21
23
25
32{
33public:
34
35 // The None enumerant is deprecated, and may be removed in a future
36 // major version of UFE.
37 enum Type {NoHint, None = NoHint, Translate, Rotate, Scale, RotatePivot, ScalePivot};
43
44 inline Type type() const { return fType; }
45
46private:
47
48 const Type fType{None};
49};
50
52
54{
55public:
56 typedef std::shared_ptr<Transform3dRead> Ptr;
57
65 static Ptr transform3dRead(const SceneItem::Ptr& item);
66
69
72
75
77 virtual const Path& path() const = 0;
78
80 virtual SceneItem::Ptr sceneItem() const = 0;
81
84 virtual Matrix4d matrix() const = 0;
85
90
95
103 virtual Matrix4d segmentInclusiveMatrix() const = 0;
104
112 virtual Matrix4d segmentExclusiveMatrix() const = 0;
113};
114
116
155{
156public:
157 typedef std::shared_ptr<Transform3d> Ptr;
158
166 static Ptr transform3d(const SceneItem::Ptr& item);
167
178 const SceneItem::Ptr& item,
180 );
181
189 static bool addObserver(
190 const SceneItem::Ptr& item, const Observer::Ptr& obs);
191
199 static bool removeObserver(
200 const SceneItem::Ptr& item, const Observer::Ptr& obs);
201
202 typedef bool (*RemoveObserverItemType)(const SceneItem::Ptr& item, const Observer::Ptr& obs);
203
213 static bool removeObserver(
214 const Path& path, const Observer::Ptr& obs);
215
216 typedef bool (*RemoveObserverPathType)(const Path& path, const Observer::Ptr& obs);
217
223 static std::size_t nbObservers(const SceneItem::Ptr& item);
224
232 static bool hasObserver(
233 const SceneItem::Ptr& item, const Observer::Ptr& obs);
234
237 static bool hasObservers(const Path& path);
238
243 static bool hasObservers(Rtid runTimeId);
244
248 static void notify(const Path& path);
249
253 Transform3d(const Transform3d&) = default;
255 virtual ~Transform3d() override;
256
263 double x, double y, double z) = 0;
264
266 return translateCmd(0, 0, 0); }
267
273 virtual void translate(double x, double y, double z) {
274 auto cmd = translateCmd(x, y, z);
275 if (cmd) {
276 cmd->execute();
277 }
278 }
279
282 virtual Vector3d translation() const = 0;
283
291 double x, double y, double z) = 0;
292
294 return rotateCmd(0, 0, 0); }
295
301 virtual void rotate(double x, double y, double z) {
302 auto cmd = rotateCmd(x, y, z);
303 if (cmd) {
304 cmd->execute();
305 }
306 }
307
311 virtual Vector3d rotation() const = 0;
312
319 double x, double y, double z) = 0;
320
322 return scaleCmd(1, 1, 1); }
323
329 virtual void scale(double x, double y, double z) {
330 auto cmd = scaleCmd(x, y, z);
331 if (cmd) {
332 cmd->execute();
333 }
334 }
335
338 virtual Vector3d scale() const = 0;
339
347 double x, double y, double z) = 0;
348
350 return rotatePivotCmd(0, 0, 0); }
351
357 virtual void rotatePivot(double x, double y, double z) {
358 auto cmd = rotatePivotCmd(x, y, z);
359 if (cmd) {
360 cmd->execute();
361 }
362 }
363
366 virtual Vector3d rotatePivot() const = 0;
367
375 double x, double y, double z) = 0;
376
378 return scalePivotCmd(0, 0, 0); }
379
385 virtual void scalePivot(double x, double y, double z) {
386 auto cmd = scalePivotCmd(x, y, z);
387 if (cmd) {
388 cmd->execute();
389 }
390 }
391
394 virtual Vector3d scalePivot() const = 0;
395
406 double x, double y, double z) {
407 (void) x; (void) y; (void) z;
408 return nullptr;
409 }
410
412 return translateRotatePivotCmd(0, 0, 0); }
413
420 virtual void translateRotatePivot(double x, double y, double z) {
421 auto cmd = translateRotatePivotCmd(x, y, z);
422 if (cmd) {
423 cmd->execute();
424 }
425 }
426
431 return Vector3d(0, 0, 0);
432 }
433
444 double x, double y, double z) {
445 (void) x; (void) y; (void) z;
446 return nullptr;
447 }
448
450 return translateScalePivotCmd(0, 0, 0); }
451
457 virtual void translateScalePivot(double x, double y, double z) {
458 auto cmd = translateScalePivotCmd(x, y, z);
459 if (cmd) {
460 cmd->execute();
461 }
462 }
463
468 return Vector3d(0, 0, 0);
469 }
470
480 double x, double y, double z) {
481 (void) x; (void) y; (void) z;
482 return nullptr;
483 }
484
486 return rotateAxisCmd(0, 0, 0); }
487
493 virtual void rotateAxis(double x, double y, double z) {
494 auto cmd = rotateAxisCmd(x, y, z);
495 if (cmd) {
496 cmd->execute();
497 }
498 }
499
502 virtual Vector3d rotateAxis() const {
503 return Vector3d(0, 0, 0);
504 }
505
514 double xy, double xz, double yz) {
515 (void) xy; (void) xz; (void) yz;
516 return nullptr;
517 }
518
520 return shearCmd(0, 0, 0); }
521
527 virtual void shear(double xy, double xz, double yz) {
528 auto cmd = shearCmd(xy, xz, yz);
529 if (cmd) {
530 cmd->execute();
531 }
532 }
533
537 virtual Vector3d shear() const {
538 return Vector3d(0, 0, 0);
539 }
540
546
551 virtual void setMatrix(const Matrix4d& m) {
552 auto cmd = setMatrixCmd(m);
553 if (cmd) {
554 cmd->execute();
555 }
556 }
557};
558
559}
560
561#endif /* UFE_TRANSFORM3D_H */
Hint class for Transform3d editTransform3d.
Definition: transform3d.h:32
EditTransform3dHint & operator=(const EditTransform3dHint &)=delete
EditTransform3dHint(const EditTransform3dHint &)=delete
std::shared_ptr< Observer > Ptr
Definition: observer.h:37
Identify an object or 3D path in the scene.
Definition: path.h:40
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:45
std::shared_ptr< SetValue3UndoableCommand > Ptr
std::shared_ptr< SetValueUndoableCommand > Ptr
Abstract base class for 3D transform interface.
Definition: transform3d.h:155
static bool hasObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
TranslateUndoableCommand::Ptr translateCmd()
Definition: transform3d.h:265
virtual Vector3d shear() const
Definition: transform3d.h:537
virtual Vector3d rotatePivotTranslation() const
Definition: transform3d.h:430
virtual ScaleUndoableCommand::Ptr scaleCmd(double x, double y, double z)=0
RotateUndoableCommand::Ptr rotateCmd()
Definition: transform3d.h:293
virtual TranslateUndoableCommand::Ptr rotatePivotCmd(double x, double y, double z)=0
virtual Vector3d rotatePivot() const =0
virtual Vector3d scalePivot() const =0
TranslateUndoableCommand::Ptr translateScalePivotCmd()
Definition: transform3d.h:449
virtual void shear(double xy, double xz, double yz)
Definition: transform3d.h:527
std::shared_ptr< Transform3d > Ptr
Definition: transform3d.h:157
static bool hasObservers(const Path &path)
virtual RotateUndoableCommand::Ptr rotateAxisCmd(double x, double y, double z)
Definition: transform3d.h:479
TranslateUndoableCommand::Ptr translateRotatePivotCmd()
Definition: transform3d.h:411
Transform3d(const Transform3d &)=default
Default copy constructor.
static std::size_t nbObservers(const SceneItem::Ptr &item)
virtual void rotate(double x, double y, double z)
Definition: transform3d.h:301
virtual void translateScalePivot(double x, double y, double z)
Definition: transform3d.h:457
virtual RotateUndoableCommand::Ptr rotateCmd(double x, double y, double z)=0
virtual ShearUndoableCommand::Ptr shearCmd(double xy, double xz, double yz)
Definition: transform3d.h:513
Transform3d()
Constructor.
virtual void scalePivot(double x, double y, double z)
Definition: transform3d.h:385
virtual void setMatrix(const Matrix4d &m)
Definition: transform3d.h:551
static bool hasObservers(Rtid runTimeId)
virtual void translate(double x, double y, double z)
Definition: transform3d.h:273
virtual TranslateUndoableCommand::Ptr translateRotatePivotCmd(double x, double y, double z)
Definition: transform3d.h:405
virtual Vector3d scale() const =0
static Ptr transform3d(const SceneItem::Ptr &item)
static Ptr editTransform3d(const SceneItem::Ptr &item, const EditTransform3dHint &hint=EditTransform3dHint())
ShearUndoableCommand::Ptr shearCmd()
Definition: transform3d.h:519
virtual Vector3d scalePivotTranslation() const
Definition: transform3d.h:467
TranslateUndoableCommand::Ptr rotatePivotCmd()
Definition: transform3d.h:349
virtual SetMatrix4dUndoableCommand::Ptr setMatrixCmd(const Matrix4d &m)=0
virtual void rotateAxis(double x, double y, double z)
Definition: transform3d.h:493
static bool removeObserver(const Path &path, const Observer::Ptr &obs)
virtual void rotatePivot(double x, double y, double z)
Definition: transform3d.h:357
virtual ~Transform3d() override
Destructor.
virtual Vector3d rotation() const =0
virtual Vector3d translation() const =0
RotateUndoableCommand::Ptr rotateAxisCmd()
Definition: transform3d.h:485
TranslateUndoableCommand::Ptr scalePivotCmd()
Definition: transform3d.h:377
virtual TranslateUndoableCommand::Ptr translateScalePivotCmd(double x, double y, double z)
Definition: transform3d.h:443
virtual TranslateUndoableCommand::Ptr scalePivotCmd(double x, double y, double z)=0
virtual void scale(double x, double y, double z)
Definition: transform3d.h:329
virtual TranslateUndoableCommand::Ptr translateCmd(double x, double y, double z)=0
virtual Vector3d rotateAxis() const
Definition: transform3d.h:502
static bool addObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
static void notify(const Path &path)
ScaleUndoableCommand::Ptr scaleCmd()
Definition: transform3d.h:321
virtual void translateRotatePivot(double x, double y, double z)
Definition: transform3d.h:420
static bool removeObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
Read-only abstract base class for 3D transform interface.
Definition: transform3d.h:54
virtual SceneItem::Ptr sceneItem() const =0
virtual ~Transform3dRead()
Destructor.
virtual Matrix4d segmentExclusiveMatrix() const =0
Matrix4d exclusiveMatrix() const
virtual Matrix4d matrix() const =0
Transform3dRead()
Constructor.
Transform3dRead(const Transform3dRead &)=default
Default copy constructor.
virtual Matrix4d segmentInclusiveMatrix() const =0
std::shared_ptr< Transform3dRead > Ptr
Definition: transform3d.h:56
static Ptr transform3dRead(const SceneItem::Ptr &item)
virtual const Path & path() const =0
Matrix4d inclusiveMatrix() const
Path path(const std::string &pathString)
TypedVectorN< double, 3 > Vector3d
Definition: types.h:146
uint32_t Rtid
Definition: rtid.h:27
Typed square matrix template.
Definition: types.h:268
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35