继承者: QSGBasicGeometryNode , QSGClipNode , QSGGeometryNode , QSGOpacityNode , QSGSimpleRectNode , QSGSimpleTextureNode , QSGTransformNode
def
appendChildNode
(node)
def
childAtIndex
(i)
def
childCount
()
def
clearDirty
()
def
dirtyState
()
def
firstChild
()
def
flags
()
def
insertChildNodeAfter
(node, after)
def
insertChildNodeBefore
(node, before)
def
lastChild
()
def
markDirty
(bits)
def
nextSibling
()
def
parent
()
def
prependChildNode
(node)
def
previousSibling
()
def
removeAllChildNodes
()
def
removeChildNode
(node)
def
reparentChildNodesTo
(newParent)
def
setFlag
(arg__1[, arg__2=true])
def
setFlags
(arg__1[, arg__2=true])
def
type
()
def
isSubtreeBlocked
()
def
preprocess
()
QSGNodeclass can be used as a child container. Children are added with theappendChildNode(),prependChildNode(),insertChildNodeBefore()andinsertChildNodeAfter(). The order of nodes is important as geometry nodes are rendered according to their ordering in the scene graph.The scene graph nodes contains a mechanism to describe which parts of the scene has changed. This includes the combined matrices, accumulated opacity, changes to the node hierarchy, and so on. This information can be used for optimizations inside the scene graph renderer. For the renderer to properly render the nodes, it is important that users call
markDirty()with the correct flags when nodes are changed. Most of the functions on the node classes will implicitly callmarkDirty()。例如,appendChildNode()will callmarkDirty()passing inDirtyNodeAdded.If nodes change every frame, the
preprocess()function can be used to apply changes to a node for every frame it is rendered. The use ofpreprocess()must be explicitly enabled by setting theUsePreprocessflag on the node.虚拟
isSubtreeBlocked()function can be used to disable a subtree all together. Nodes in a blocked subtree will not be preprocessed() and not rendered.注意
All classes with QSG prefix should be used solely on the scene graph’s rendering thread. See 场景图形和渲染 了解更多信息。
QSGNode
¶
QSGNode(type)
- param type
NodeType
Constructs a new node
Constructs a new node with the given node type.
PySide2.QtQuick.QSGNode.
NodeType
¶
Can be used to figure out the type of node.
|
常量 |
描述 |
|---|---|
|
QSGNode.BasicNodeType |
The type of
|
|
QSGNode.GeometryNodeType |
The type of
|
|
QSGNode.TransformNodeType |
The type of
|
|
QSGNode.ClipNodeType |
The type of
|
|
QSGNode.OpacityNodeType |
The type of
|
|
QSGNode.RenderNodeType |
The type of
|
另请参阅
PySide2.QtQuick.QSGNode.
Flag
¶
The enum describes flags on the
QSGNode
|
常量 |
描述 |
|---|---|
|
QSGNode.OwnedByParent |
The node is owned by its parent and will be deleted when the parent is deleted. |
|
QSGNode.UsePreprocess |
The node’s virtual
|
|
QSGNode.OwnsGeometry |
Only valid for
|
|
QSGNode.OwnsMaterial |
Only valid for
|
|
QSGNode.OwnsOpaqueMaterial |
Only valid for
|
|
QSGNode.InternalReserved |
Reserved for internal use. |
PySide2.QtQuick.QSGNode.
DirtyStateBit
¶
用于
markDirty()
to indicate how the scene graph has changed.
|
常量 |
描述 |
|---|---|
|
QSGNode.DirtyMatrix |
The matrix in a
|
|
QSGNode.DirtyNodeAdded |
A node was added. |
|
QSGNode.DirtyNodeRemoved |
A node was removed. |
|
QSGNode.DirtyGeometry |
The geometry of a
|
|
QSGNode.DirtyMaterial |
The material of a
|
|
QSGNode.DirtyOpacity |
The opacity of a
|
|
QSGNode.DirtySubtreeBlocked |
The subtree has been blocked. |
另请参阅
PySide2.QtQuick.QSGNode.
appendChildNode
(
node
)
¶
node
–
QSGNode
追加
node
to this node’s list of children.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
PySide2.QtQuick.QSGNode.
childAtIndex
(
i
)
¶
i
–
int
Returns the child at index
i
.
Children are stored internally as a linked list, so iterating over the children via the index is suboptimal.
PySide2.QtQuick.QSGNode.
childCount
(
)
¶
int
Returns the number of child nodes.
PySide2.QtQuick.QSGNode.
clearDirty
(
)
¶
注意
此函数被弃用。
PySide2.QtQuick.QSGNode.
dirtyState
(
)
¶
DirtyState
注意
此函数被弃用。
PySide2.QtQuick.QSGNode.
firstChild
(
)
¶
Returns the first child of this node.
The children are stored in a linked list.
PySide2.QtQuick.QSGNode.
flags
(
)
¶
标志
Returns the set of flags for this node.
另请参阅
PySide2.QtQuick.QSGNode.
insertChildNodeAfter
(
node
,
after
)
¶
插入
node
to this node’s list of children after the node specified with
after
.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
PySide2.QtQuick.QSGNode.
insertChildNodeBefore
(
node
,
before
)
¶
插入
node
to this node’s list of children before the node specified with
before
.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
PySide2.QtQuick.QSGNode.
isSubtreeBlocked
(
)
¶
bool
Returns whether this node and its subtree is available for use.
Blocked subtrees will not get their dirty states updated and they will not be rendered.
QSGOpacityNode
will return a blocked subtree when accumulated opacity is 0, for instance.
PySide2.QtQuick.QSGNode.
lastChild
(
)
¶
Returns the last child of this node.
The children are stored as a linked list.
PySide2.QtQuick.QSGNode.
markDirty
(
bits
)
¶
bits
–
DirtyState
Notifies all connected renderers that the node has dirty
bits
.
PySide2.QtQuick.QSGNode.
nextSibling
(
)
¶
Returns the node after this in the parent’s list of children.
The children are stored as a linked list.
PySide2.QtQuick.QSGNode.
prependChildNode
(
node
)
¶
node
–
QSGNode
前置
node
to this node’s the list of children.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
PySide2.QtQuick.QSGNode.
preprocess
(
)
¶
Override this function to do processing on the node before it is rendered.
Preprocessing needs to be explicitly enabled by setting the flag
UsePreprocess
. The flag needs to be set before the node is added to the scene graph and will cause the function to be called for every frame the node is rendered.
警告
Beware of deleting nodes while they are being preprocessed. It is possible, with a small performance hit, to delete a single node during its own preprocess call. Deleting a subtree which has nodes that also use preprocessing may result in a segmentation fault. This is done for performance reasons.
PySide2.QtQuick.QSGNode.
previousSibling
(
)
¶
Returns the node before this in the parent’s list of children.
The children are stored as a linked list.
PySide2.QtQuick.QSGNode.
removeAllChildNodes
(
)
¶
Removes all child nodes from this node’s list of children.
PySide2.QtQuick.QSGNode.
removeChildNode
(
node
)
¶
node
–
QSGNode
移除
node
from this node’s list of children.
PySide2.QtQuick.QSGNode.
reparentChildNodesTo
(
newParent
)
¶
newParent
–
QSGNode
Reparents all nodes of this node to
newParent
.
PySide2.QtQuick.QSGNode.
setFlag
(
arg__1
[
,
arg__2=true
]
)
¶
arg__1
–
Flag
arg__2
–
bool
Sets the flag
f
on this node if
enabled
为 true;否则清零标志。
另请参阅
PySide2.QtQuick.QSGNode.
setFlags
(
arg__1
[
,
arg__2=true
]
)
¶
arg__1
–
标志
arg__2
–
bool
Sets the flags
f
on this node if
enabled
is true; otherwise clears the flags.
另请参阅