Documentation for pp_lib

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

./

pp_getcurrentlights.pro


Routines

top source pp_getcurrentlights

result = pp_getcurrentlights( [ambient=ambient] [, directional=directional] [, all=all] [, tool=tool] [, id=id])

Retrieves one or both of the default lights made when a surface is created in iTools or Graphics. These lights are one ambient light and one directional light. By default, the directional light is returned. The current graphic (iTool or Graphics) is used by default, if id is not provided.

Keywords

ambient in optional default=0

If set, the ambient light is the one retrieved.

directional in optional default=1

If set, the directional light is the one retrieved.

all in optional default=0

If set, both lights are retrieved, in a two-element array, with the ambient light first.

tool out optional

Returns the object associated with the graphic. Most useful to do a call to tool.commitactions after a change in the light properites (see the example).

id in out optional

The tool id of the graphic to operate on. This is processed by pp_gettoolid: If not provided, the current (if any) is used, and its ID is returned in this variable. If one is provided but is not valid, the current one is obtained instead, and returned in this variable. This can also be a Graphics identifer (as from the getfullidentifier method), in which case this variable will be altered to return the corresponding tool ID.

Examples

Make a simple surface, retrieve its directional light and move it:

surf=surface(dist(100))
This should look like

Then the direction can be retireved and changed with:

dir_light=pp_getcurrentlights(tool=ot,id=surf.getfullidentifier()) dir_light.getproperty,location=location print,location ; -0.00010000000 0.00010000000 0.00010000000 dir_light.setproperty,location=-location
Update the rendering to show the changes done:
ot.commitactions
Which should look like

Author information

Author:

Paulo Penteado (pp.penteado@gmail.com), Feb/2011

Other attributes

Uses:

pp_gettoolid

Statistics

Lines:
15 lines
Cyclomatic complexity:
10
Modified cyclomatic complexity:
10

File attributes

Modification date: Wed Jun 29 22:15:28 2016
Lines: 15
Docformat: rst rst