Python updates:
[blender.git] / source / gameengine / PyDoc / KX_Scene.py
1 # $Id$
2 # Documentation for KX_Scene.py
3
4 class KX_Scene:
5         """
6         Scene.
7         
8         The activity culling stuff is supposed to disable logic bricks when their owner gets too far
9         from the active camera.  It was taken from some code lurking at the back of KX_Scene - who knows 
10         what it does!
11         
12         Example::
13                 import GameLogic
14                 
15                 # get the scene
16                 scene = GameLogic.getCurrentScene()
17                 
18                 # print all the objects in the scene
19                 for obj in scene.getObjectList():
20                         print obj.getName()
21                 
22                 # get an object named 'Cube'
23                 obj = scene.getObjectList()["OBCube"]
24                 
25                 # get the first object in the scene.
26                 obj = scene.getObjectList()[0]
27         
28         Example::
29                 # Get the depth of an object in the camera view.
30                 import GameLogic
31                 
32                 obj = GameLogic.getCurrentController().getOwner()
33                 cam = GameLogic.getCurrentScene().active_camera
34                 
35                 # Depth is negative and decreasing further from the camera
36                 depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
37                 
38         @ivar name: The scene's name
39         @type name: string
40         @ivar active_camera: The current active camera
41         @type active_camera: L{KX_Camera}
42         @ivar suspended: True if the scene is suspended.
43         @type suspended: boolean
44         @ivar activity_culling: True if the scene is activity culling
45         @type activity_culling: boolean
46         @ivar activity_culling_radius: The distance outside which to do activity culling.  Measured in manhattan distance.
47         @type activity_culling_radius: float
48         """
49         
50         def getLightList():
51                 """
52                 Returns the list of lights in the scene.
53                 
54                 @rtype: list [L{KX_Light}]
55                 """
56         def getObjectList():
57                 """
58                 Returns the list of objects in the scene.
59                 
60                 @rtype: list [L{KX_GameObject}]
61                 """
62         def getName():
63                 """
64                 Returns the name of the scene.
65                 
66                 @rtype: string
67                 """
68