Added Python functions for saving snapshots of UV layouts, scaling, rotating, and translating, and removing UVs, cutting uv edges, setting depth only passes, and exposing bounding boxes.
Added the setTexCoords method to vrdGeometryNode
to remove UV sets.
Added triplanarProjectionFitSize(), planarProjectionFitSize(), and cylyndricalProjectionFitSize() to vrUVService
to fit a specific (planar/tri-planar/cylindrical) projection onto an arbitrary object and enable simple batch processing of arbitrary nodes.
Added the setDepthOnlyPass
function for the Advanced OpenGL Settings Depth Only Pass feature. It enables the toggling of Depth Only Pass. setDepthOnlyPass
takes parameters similar to setBackfaceCulling
, such as SWITCH_TOGGLE
, SWITCH_ON
, or SWITCH_OFF
and True
or False
. There are no query functions of the current state.
Added vrUVService.cutAlongSeams() to cut UV Edges along a selected seam, using values from Automatic Seam Selection.
vrUVService.
cutAlongSeams
(nodes, settings, uvSet)Performs a cut with the given seam settings on the given nodes.
Example of an organic cut:
geometryNodes = [vrNodeService.findNode("Box")]
settings = vrdUVSeamSettings()
settings.setMode(vrUVTypes.SeamMode.Organic)
settings.setOrganicUsePipesCutter(True)
settings.setOrganicSegmentationAmount(0)
vrUVService.cutAlongSeams(geometryNodes, settings, vrUVTypes.UVSet.MaterialUVSet)
Example of a manufactured cut:
geometryNodes = [vrNodeService.findNode("Box")]
settings = vrdUVSeamSettings()
settings.setMode(vrUVTypes.SeamMode.Manufactured)
settings.setManufacturedAngle(45)
settings.setManufacturedAreaRatio(0.5)
vrUVService.cutAlongSeams(geometryNodes, settings, vrUVTypes.UVSet.MaterialUVSet)
Example of a baking cut:
geometryNodes = [vrNodeService.findNode("Box")]
settings = vrdUVSeamSettings()
settings.setMode(vrUVTypes.SeamMode.Baking)
settings.setBakingAngle(45)
settings.setBakingSizeOfMinPatch(0)
vrUVService.cutAlongSeams(geometryNodes, settings, vrUVTypes.UVSet.MaterialUVSet)
Parameters: |
|
---|
Added vrUVService.rotateUV to rotate UVs around a given center.
To rotate UVs around a given center, try this:
center = QVector2D(0,0)
angle = 25
vrUVService.rotateUV(nodes, center, angle, vrUVTypes.UVSet.MaterialUVSet)
vrUVService.
rotateUV
(nodes, center, angleDegree, uvSet)Rotate the UVs of the given nodes around the given center.
Example of rotating all material UVs 90 degrees:
geometryNodes = [vrNodeService.findNode("Box")]
center = QVector2D(0.5,0.5)
angle = 90
vrUVService.rotateUV(geometryNodes, center, angle, vrUVTypes.UVSet.MaterialUVSet)
Parameters: |
|
---|
Added vrUVService.scaleUV and vrUVService.translateUV for scaling/flipping and translating UVs.
To flip UVs at a given center, try this:
center = QVector2D(0,0)
scaleU = 1
scaleV = -1
vrUVService.scaleUV(nodes, center, scaleU, scaleV, vrUVTypes.UVSet.MaterialUVSet)
To translate UVs at a given center, try this:
translateU = 0.2
translateV = 0.1
vrUVService.translateUV(nodes, translateU, translateV, vrUVTypes.UVSet.MaterialUVSet)
vrUVService.
scaleUV
(nodes, center, uScale, vScale, uvSet)Scale the UVs of the given nodes using the given center.
Example of flipping all material UVs:
geometryNodes = [vrNodeService.findNode("Box")]
center = QVector2D(0.5,0.5)
uScale = -1
vScale = 1
vrUVService.scaleUV(geometryNodes, center, uScale, vScale, vrUVTypes.UVSet.MaterialUVSet)
Parameters: |
|
---|
vrUVService.
translateUV
(nodes, du, dv, uvSet)Translates the UVs of the given nodes.
Example of translating all material UVs:
geometryNodes = [vrNodeService.findNode("Box")]
du = 0.2
dv = 0.2
vrUVService.translateUV(geometryNodes, du, dv, vrUVTypes.UVSet.MaterialUVSet)
Parameters: |
|
---|
Added saveUVSnapshot (as in Extend UV Editor) to vrUVService. It saves a snapshot of the UV layout as an image file.
If width and height are different, then the output image will be distorted.
vrUVService.
saveUVSnapshot
(nodes, path, width=1024, height=1024, uvSet=vrUVTypes.MaterialUVSet, style=vrUVTypes.ShowWireframe, mode=vrUVTypes.SnapshotMode.ZeroToOneSpace, customSpace=QVector4D())Saves a snapshot of the UV layout as image file.
Example:
geometryNodes = [vrNodeService.findNode("Box")]
vrUVService.saveUVSnapshot(geometryNodes,
"c:/vred-snapshots/uv.png",
512, 512,
vrUVTypes.UVSet.MaterialUVSet,
vrUVTypes.ShowBorders | vrUVTypes.ShowWireframe)
Parameters: |
|
---|
Added getBoundingBox and getWorldBoundingBox to expose the bounding volume (box) of an object in the scene.
To get the combined bounding box of multiple objects, try this:
def getWorldCenter(geometryNodes):
bb = vrdBoundingBox()
for geometryNode in geometryNodes:
bb.extendBy(geometryNode.getWorldBoundingBox())
return bb.getCenter()
vrdNode.
getWorldBoundingBox
()Returns the world bounding box of the node including its children.
Example of combining multiple bounding boxes:
def getWorldCenter(nodes):
bb = vrdBoundingBox()
for node in nodes:
bb.extendBy(node.getWorldBoundingBox())
return bb.getCenter()
# Find all nodes whose name starts with "Box".
nodes = vrNodeService.findNodes("Box*", True)
# Calculate the bounding box center of these nodes
center = getWorldCenter(nodes)
# Print the result
print(center)
Returns: | World bounding box of node |
---|---|
Return type: | vrdBoundingBox |