vrLightService¶
-
class
vrLightService
¶
(Inherits vrBaseService
)
Interface to access lights, light sets and lens flares in VRED.
This is the basic interface to access, create or delete lights, light sets and lens flares. It also provides functionality to access the light graph by using vrLightService.getLightRoot().
Here are some examples on how to work with lights:
# add a group node
groupNode = vrLightService.createLightGroup("group node")
# create a point light below the group
pointLight = vrLightService.createLight("point light", vrLightTypes.LightType.Point, groupNode)
# find a light node in the main scene graph
pointLight = vrNodeService.findNode("point light")
# find a light node in the light graph
pointLight = vrLightService.findLight("point light")
# copy lens flares from pointLightNode1 to pointLightNode2
# this creates an actual copy of the vrdLensFlareEffect and stores it
vrLightService.copyLensFlare(pointLightNode1.getLensFlareEffect())
vrLightService.pasteLensFlare([pointLightNode2])
# delete the pointlight and the group
vrNodeService.removeNode([pointLight, groupNode])
Summary¶
- Functions:
- convertLight(lightNode, lightType)
- convertLights(nodes, lightType)
- copyLensFlare(effect)
- copyLensFlareElements(elements)
- copyLensFlareGhosts(ghosts)
- copyLights(nodes)
- createLight(name, type, parent) → vrdNode
- createLightGroup(name, parent) → vrdNode
- createLightGroup(name, nodes) → vrdNode
- createLightLinkSet(name) → vrdLightLinkSetNode
- duplicateLensFlareElements(light, elements)
- duplicateLensFlareGhosts(ghostLine, ghosts)
- duplicateLights(nodes)
- findLight(name) → vrdNode
- findLights(name) → List[vrdNode]
- getAllLights(sceneGraph) → List[vrdNode]
- getHeadlight() → vrdBaseLightNode
- getLightLinksRoot() → vrdNode
- getLightRoot() → vrdNode
- getLightsClipboard() → List[vrdNode]
- getSelectedLensFlareElements() → List[vrdLensFlareElement]
- getSelectedLensFlareGhosts() → List[vrdLensFlareGhost]
- getSelectedNodes() → List[vrdNode]
- hasCopiedGhosts() → bool
- hasCopiedLensFlareEffect() → bool
- hasCopiedLensFlareElements() → bool
- isHeadLight(light) → bool
- isLightsClipboardEmpty() → bool
- loadLights(paths) → List[vrdNode]
- pasteLensFlare(lights)
- pasteLensFlareElements(light)
- pasteLensFlareGhosts(ghostLine)
- pasteLights(targetNodes)
- removeLightLinkSets(nodes)
- removeLights(nodes)
- saveLights(nodes, path) → bool
- setSelectedLensFlareElements(elements)
- setSelectedLensFlareGhosts(ghosts)
- setSelectedNodes(nodes)
- validateLights()
- Signals:
Functions¶
-
vrLightService.
convertLight
(lightNode, lightType)¶ Converts a light node to a light of another type. Note: This will invalidate this node object.
Parameters: - lightNode (vrdNode) – The light node that will be converted.
- lightType (vrLightTypes.LightType) – The type to which the node will be converted.
-
vrLightService.
convertLights
(nodes, lightType)¶ Converts light nodes to lights of another type. Note: This will invalidate these node objects.
Parameters: - nodes (List[vrdNode]) – The light nodes that will be converted.
- lightType (vrLightTypes.LightType) – The type to which the nodes will be converted.
-
vrLightService.
copyLensFlare
(effect)¶ Adds a lens flare effect to the copy buffer.
Parameters: effect (vrdLensFlareEffect) – The lens flare effect that is added to the clipboard to be copied.
-
vrLightService.
copyLensFlareElements
(elements)¶ Add lens flares to the copy buffer.
Parameters: elements (List[vrdLensFlareElement]) – All lens flares we wish to copy
-
vrLightService.
copyLensFlareGhosts
(ghosts)¶ Copy all ghosts to copy buffer.
Parameters: ghosts (List[vrdLensFlareGhost]) – List of all ghosts to copy
-
vrLightService.
copyLights
(nodes)¶ Copy all given light nodes from light graph to the clipboard. The clipboard is cleared each time before a new copy.
Parameters: nodes (List[vrdNode]) – List of all light nodes to copy
-
vrLightService.
createLight
(name, type, parent=vrdNode())¶ Create a new light node in light graph.
Directional: Directional light typePoint: Point light typeSpot: Spot light typeRectangular: Rectangular light typeDisk: Disk light typeSpherical: Spherical light typeRay: Ray light typeParameters: - name (string) – Name of the new light node
- type (vrLightTypes.LightType) – Light type
- parent (vrdNode) – This node contains the new create light node as a child. Parent node must be a group node in light graph. So it must be the light graph root or one descendant child group. If the parameter is omitted, the light root will be used.
Returns: The newly created and added light node from the light graph.
Return type:
-
vrLightService.
createLightGroup
(name, parent=vrdNode())¶ Create a new light group.
Parameters: - name (string) – Name of the new light group node
- parent (vrdNode) – The new group node will be attached to this node. The parent node must be a node in light graph. So it must be the light graph root or one of its child groups. If this parameter is omitted, the light graph root will be used.
Returns: The newly created group node
Return type:
-
vrLightService.
createLightGroup
(name, nodes)¶ Create a new light group out of some lights.
Parameters: - name (string) – Name of the light group node
- nodes (List[vrdNode]) – The light nodes that will be part of the new group. The group will be a child of the common parent of the nodes in the light graph. If the nodes do not have a common parent, the group will be a child of the light graph root node.
Returns: The newly created and added light group node
Return type:
-
vrLightService.
createLightLinkSet
(name='')¶ Create a new light link set.
Parameters: name (string) – of the light link set. If the name is omitted, a new unique name will be automatically generated. Returns: New created light link set A vrLightService.lightLinkSetsChanged() signal will be emitted Return type: vrdLightLinkSetNode
-
vrLightService.
duplicateLensFlareElements
(light, elements)¶ Duplicates lens flare elements of a light and adds them to the same light.
Parameters: - light (vrdPointLightNode) – The light of which some lens flare elements are duplicated
- elements (List[vrdLensFlareElement]) – The elements that should be duplicated. Note that these elements need to be elements of the given light, otherwise they will be ignored.
-
vrLightService.
duplicateLensFlareGhosts
(ghostLine, ghosts)¶ Duplicates lens flare ghosts of a ghost line and adds them to the same ghost line.
Parameters: - ghostLine (vrdLensFlareGhostLine) – The ghost line of which some ghosts are duplicated
- ghosts (List[vrdLensFlareGhost]) – The ghosts that should be duplicated. Note that these ghosts need to be ghosts of the given ghost line otherwise they will be ignored.
-
vrLightService.
duplicateLights
(nodes)¶ Duplicate all given light nodes from light graph. The duplicated nodes will be added under the same parent as the original node.
Parameters: nodes (List[vrdNode]) – List of all light nodes to duplicate
-
vrLightService.
findLight
(name)¶ Find a light node with a given name in the light graph.
Parameters: name (string) – Name of the searched light node Returns: Light node. May be null, if no light node with this name can be found. Return type: vrdNode
-
vrLightService.
findLights
(name)¶ Find all light nodes with a given name.
Parameters: name (string) – Name of the searched light nodes The lights will be searched for in the light graph. Returns: List of light nodes. May be empty, if no light nodes with this name can be found. Return type: List[vrdNode]
-
vrLightService.
getAllLights
(sceneGraph)¶ Return all light nodes.
Parameters: sceneGraph (bool) – If true, collect the nodes from the scene graph if false use the light graph Returns: All light nodes Return type: List[vrdNode]
-
vrLightService.
getHeadlight
()¶ Returns the head light node.
Returns: head light node Return type: vrdBaseLightNode
-
vrLightService.
getLightLinksRoot
()¶ Returns the root node of light sets, that contains all light sets.
Returns: Root node of light sets tree Return type: vrdNode
-
vrLightService.
getLightRoot
()¶ Returns the root node of lights, that contains all lights and lens flares.
Returns: Root node of light graph Return type: vrdNode
-
vrLightService.
getLightsClipboard
()¶ Returns: The list of light nodes from the clipboard. Return type: List[vrdNode]
-
vrLightService.
getSelectedLensFlareElements
()¶ Get the selected lens flare elements.
Returns: The selected lens flare elements Return type: List[vrdLensFlareElement]
-
vrLightService.
getSelectedLensFlareGhosts
()¶ Gets currently selected ghosts.
Returns: The currently selected ghosts. Return type: List[vrdLensFlareGhost]
-
vrLightService.
getSelectedNodes
()¶ Returns all current selected light nodes from internal buffer.
Returns: List of all current selected light nodes Return type: List[vrdNode]
-
vrLightService.
hasCopiedGhosts
()¶ Check if ghost elements are available in clipboard.
Returns: True, if ghost elements are available in clipboard Return type: bool
-
vrLightService.
hasCopiedLensFlareEffect
()¶ Checks is a lens flare effect is available in the clipboard.
Returns: True, if a lens flare effect is available in the clipboard Return type: bool
-
vrLightService.
hasCopiedLensFlareElements
()¶ Check if lens flare elements are available in clipboard.
Returns: True, if lens flare elements are available in clipboard Return type: bool
-
vrLightService.
isHeadLight
(light)¶ Check if the given node is the head light node.
Parameters: light (vrdBaseLightNode) – Returns: True, if the given node is the head light node Return type: bool
-
vrLightService.
isLightsClipboardEmpty
()¶ Check if light nodes are available in clipboard.
Returns: True, if clipboard is empty Return type: bool
-
vrLightService.
loadLights
(paths)¶ load lights from OpenSG Binary Geometry or VRED Project Binary file
Parameters: paths (List[string]) – Full file paths of binary files Returns: all new added light nodes Return type: List[vrdNode]
-
vrLightService.
pasteLensFlare
(lights)¶ Pastes a lens flare effect from the copy buffer to one or more lights.
Parameters: lights (List[vrdPointLightNode]) – The lights the lens flare effect should be copied to.
-
vrLightService.
pasteLensFlareElements
(light)¶ Pastes lens flare elements from the clipboard to a light.
Parameters: light (vrdPointLightNode) – The light the lens flare elements should be copied to.
-
vrLightService.
pasteLensFlareGhosts
(ghostLine)¶ Paste all ghosts from copy buffer to a ghost line.
Parameters: ghostLine (vrdLensFlareGhostLine) – Ghost line to which the ghosts will be pasted.
-
vrLightService.
pasteLights
(targetNodes)¶ Paste all given light nodes from clipboard to the graph. The clipboard content is kept unchanged.
Parameters: targetNodes (List[vrdNode]) – The target nodes where nodes should be pasted to.
-
vrLightService.
removeLightLinkSets
(nodes)¶ Remove light link sets.
Parameters: nodes (List[vrdLightLinkSetNode]) – List of all light link sets to remove A vrLightService.lightLinkSetsChanged() signal will be emitted
-
vrLightService.
removeLights
(nodes)¶ Remove all given light nodes from light graph.
Parameters: nodes (List[vrdNode]) – List of all light nodes to remove
-
vrLightService.
saveLights
(nodes, path)¶ Collects all lights recursively in the given nodes and saves them as a OpenSG Binary Geometry file.
Parameters: - nodes (List[vrdNode]) – List of light nodes to store
- path (string) – Full file path of osg file, must containing osg suffix
Returns: True, if file was successfully stored
Return type: bool
-
vrLightService.
setSelectedLensFlareElements
(elements)¶ Set all selected lens flare elements.
Parameters: elements (List[vrdLensFlareElement]) – List of all lens flare elements that should be selected.
-
vrLightService.
setSelectedLensFlareGhosts
(ghosts)¶ Set selected ghosts. All currently selected ghosts will be reset to not select. A vrLightService.lensFlareGhostSelectionChanged(ghosts) signal will be emitted.
Parameters: ghosts (List[vrdLensFlareGhost]) – List of ghosts that will be selected.
-
vrLightService.
setSelectedNodes
(nodes)¶ Set all selected light nodes. All current selected nodes will be reset to not select. Almost all commands of light service works on selected nodes. A vrLightService.nodeSelectionChanged(nodes) signal will be emitted.
Parameters: nodes (List[vrdNode]) – List of all current selected light nodes
-
vrLightService.
validateLights
()¶ Validates if all lights in the scene graph have a corresponding light in the light graph and vice versa. Lights without a valid parent will be removed. A vrLightService.lightsValidated() signal will be emitted.
Signals¶
-
vrLightService.
lensFlareElementSelectionChanged
(elements)¶ Signal will be emitted if selection buffer of lens flare elements was changed.
Parameters: elements (List[vrdLensFlareElement]) – All current selected lens flare elements
-
vrLightService.
lensFlareGhostSelectionChanged
(ghosts)¶ Signal will be emitted if the list of selected ghost was changed.
Parameters: ghosts (List[vrdLensFlareGhost]) – The new list of all selected ghosts
-
vrLightService.
lightLinkSetsChanged
()¶ Signal will be emitted if light link set are added or removed.
-
vrLightService.
lightsConverted
(lightIds)¶ Signal that will be emitted when lights are converted to different light types.
Parameters: lightIds (List[integer]) – The object ids of the lights that have been converted.
-
vrLightService.
lightsStateChanged
()¶ Signal is emitted when then on/off state of any light changes in either the light graph or the scene graph.
-
vrLightService.
lightsValidated
()¶ Signal that is send after lights have been validated.
-
vrLightService.
nodesAdded
(nodes)¶ Signal will be emitted if light nodes was added.
Parameters: nodes (List[vrdNode]) – New created light nodes
-
vrLightService.
nodesChanged
(nodes)¶ Signal will be emitted if light nodes was changed.
Parameters: nodes (List[vrdNode]) – All changed light nodes