- class QTransform#
Used to perform transforms on meshes. More…
Synopsis#
Properties#
Methods#
def
__init__()
def
matrix()
def
rotation()
def
rotationX()
def
rotationY()
def
rotationZ()
def
scale()
def
scale3D()
def
translation()
def
worldMatrix()
Slots#
def
setMatrix()
def
setRotation()
def
setRotationX()
def
setRotationY()
def
setRotationZ()
def
setScale()
def
setScale3D()
def
setTranslation()
Signals#
def
matrixChanged()
def
scale3DChanged()
def
scaleChanged()
Static functions#
def
fromAxes()
def
rotateAround()
def
rotateFromAxes()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
The
QTransform
component is not shareable between multipleQEntity
‘s. The transformation is held as QVector3D scale, QQuaternion rotation and QVector3D translation components. The transformations are applied to the mesh in that order. Whenmatrix
property is set, it is decomposed to these transform components and corresponding signals are emitted.Several helper functions are provided to set up the
QTransform
;fromAxisAndAngle
andfromAxesAndAngles
can be used to set the rotation around specific axes,fromEulerAngles
can be used to set the rotation based on euler angles androtateAround
can be used to rotate the object around specific point relative to local origin.Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property matrixᅟ: QMatrix4x4#
Holds the QMatrix4x4 of the transform.
Note
When the matrix property is set, it is decomposed to translation, rotation and scale components.
- Access functions:
Signal
matrixChanged()
- property rotationᅟ: QQuaternion#
Holds the rotation of the transform as QQuaternion.
- Access functions:
- property rotationXᅟ: float#
Holds the x rotation of the transform as Euler angle.
- Access functions:
- property rotationYᅟ: float#
Holds the y rotation of the transform as Euler angle.
- Access functions:
- property rotationZᅟ: float#
Holds the z rotation of the transform as Euler angle.
- Access functions:
- property scaleᅟ: float#
Holds the uniform scale of the transform. If the scale has been set with
setScale3D
, holds the x value only.- Access functions:
Signal
scaleChanged()
Holds the scale of the transform as QVector3D.
- Access functions:
Holds the translation of the transform as QVector3D.
- Access functions:
- property worldMatrixᅟ: QMatrix4x4#
Holds the world transformation matrix for the transform. This assumes the
QTransform
component is being referenced by aQEntity
. This makes it more convenient to identify when aQEntity
part of a subtree has been transformed in the world even though its local transformation might not have changed.- Access functions:
- __init__([parent=None])#
- Parameters:
parent –
QNode
Constructs a new
QTransform
withparent
.- static fromAxes(xAxis, yAxis, zAxis)#
- Parameters:
- Return type:
Creates a QQuaterniom definining a rotation from the axes
xAxis
,yAxis
andzAxis
.- static fromAxesAndAngles(axis1, angle1, axis2, angle2, axis3, angle3)#
- Parameters:
- Return type:
Creates a QQuaternion from
axis1
,angle1
,axis2
,angle2
,axis3
, andangle3
. Returns the resulting QQuaternion.- static fromAxesAndAngles(axis1, angle1, axis2, angle2)
- Parameters:
- Return type:
Creates a QQuaternion from
axis1
,angle1
,axis2
, andangle2
. Returns the resulting QQuaternion.Creates a QQuaternion from
axis
andangle
. Returns the resulting QQuaternion.- static fromAxisAndAngle(x, y, z, angle)
- Parameters:
x – float
y – float
z – float
angle – float
- Return type:
Creates a QQuaternion from
x
,y
,z
, andangle
. Returns the resulting QQuaternion.Creates a QQuaternion from
eulerAngles
. Returns the resulting QQuaternion.- static fromEulerAngles(pitch, yaw, roll)
- Parameters:
pitch – float
yaw – float
roll – float
- Return type:
Creates a QQuaternion from
pitch
,yaw
, androll
. Returns the resulting QQuaternion.- matrix()#
- Return type:
See also
Getter of property
matrixᅟ
.- matrixChanged()#
Notification signal of property
matrixᅟ
.- static rotateAround(point, angle, axis)#
- Parameters:
- Return type:
Creates a rotation matrix from
axis
andangle
aroundpoint
. Returns the resulting QMatrix4x4.- static rotateFromAxes(xAxis, yAxis, zAxis)#
- Parameters:
- Return type:
Returns a rotation matrix defined from the axes
xAxis
,yAxis
,zAxis
.- rotation()#
- Return type:
See also
setRotation()
Getter of property
rotationᅟ
.- rotationChanged(rotation)#
- Parameters:
rotation –
QQuaternion
Notification signal of property
rotationᅟ
.- rotationX()#
- Return type:
float
See also
setRotationX()
Getter of property
rotationXᅟ
.- rotationXChanged(rotationX)#
- Parameters:
rotationX – float
Notification signal of property
rotationXᅟ
.- rotationY()#
- Return type:
float
See also
setRotationY()
Getter of property
rotationYᅟ
.- rotationYChanged(rotationY)#
- Parameters:
rotationY – float
Notification signal of property
rotationYᅟ
.- rotationZ()#
- Return type:
float
See also
setRotationZ()
Getter of property
rotationZᅟ
.- rotationZChanged(rotationZ)#
- Parameters:
rotationZ – float
Notification signal of property
rotationZᅟ
.- scale()#
- Return type:
float
See also
setScale()
Getter of property
scaleᅟ
.Getter of property
scale3Dᅟ
.Notification signal of property
scale3Dᅟ
.- scaleChanged(scale)#
- Parameters:
scale – float
Notification signal of property
scaleᅟ
.- setMatrix(matrix)#
- Parameters:
matrix –
QMatrix4x4
See also
matrix()
Setter of property
matrixᅟ
.- setRotation(rotation)#
- Parameters:
rotation –
QQuaternion
See also
rotation()
Setter of property
rotationᅟ
.- setRotationX(rotationX)#
- Parameters:
rotationX – float
See also
rotationX()
Setter of property
rotationXᅟ
.- setRotationY(rotationY)#
- Parameters:
rotationY – float
See also
rotationY()
Setter of property
rotationYᅟ
.- setRotationZ(rotationZ)#
- Parameters:
rotationZ – float
See also
rotationZ()
Setter of property
rotationZᅟ
.Setter of property
scaleᅟ
.Setter of property
scale3Dᅟ
.Setter of property
translationᅟ
.Getter of property
translationᅟ
.Notification signal of property
translationᅟ
.- worldMatrix()#
- Return type:
Returns the world transformation matrix associated to the
QTransform
when referenced by aQEntity
which may be part of aQEntity
hierarchy.Getter of property
worldMatrixᅟ
.- worldMatrixChanged(worldMatrix)#
- Parameters:
worldMatrix –
QMatrix4x4
Notification signal of property
worldMatrixᅟ
.