Welcome to mirror list, hosted at ThFree Co, Russian Federation.

KX_Scene.py « PyDoc « gameengine « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e357e6eefca554e4ab0851bfd5846092f617278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# $Id$
# Documentation for KX_Scene.py

class KX_Scene:
	"""
	Scene.
	
	The activity culling stuff is supposed to disable logic bricks when their owner gets too far
	from the active camera.  It was taken from some code lurking at the back of KX_Scene - who knows 
	what it does!
	
	Example::
		import GameLogic
		
		# get the scene
		scene = GameLogic.getCurrentScene()
		
		# print all the objects in the scene
		for obj in scene.getObjectList():
			print obj.getName()
		
		# get an object named 'Cube'
		obj = scene.getObjectList()["OBCube"]
		
		# get the first object in the scene.
		obj = scene.getObjectList()[0]
	
	Example::
		# Get the depth of an object in the camera view.
		import GameLogic
		
		obj = GameLogic.getCurrentController().getOwner()
		cam = GameLogic.getCurrentScene().active_camera
		
		# Depth is negative and decreasing further from the camera
		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]
	
	@bug: All attributes are read only at the moment.
		
	@ivar name: The scene's name
	@type name: string
	@type objects: A list of objects in the scene.
	@type objects: list [L{KX_GameObject}]
	@ivar active_camera: The current active camera
	@type active_camera: L{KX_Camera}
	@ivar suspended: True if the scene is suspended.
	@type suspended: boolean
	@ivar activity_culling: True if the scene is activity culling
	@type activity_culling: boolean
	@ivar activity_culling_radius: The distance outside which to do activity culling.  Measured in manhattan distance.
	@type activity_culling_radius: float
	"""
	
	def getLightList():
		"""
		Returns the list of lights in the scene.
		
		@rtype: list [L{KX_Light}]
		"""
	def getObjectList():
		"""
		Returns the list of objects in the scene.
		
		@rtype: list [L{KX_GameObject}]
		"""
	def getName():
		"""
		Returns the name of the scene.
		
		@rtype: string
		"""

	def addObject(object, other, time=0)
		"""
		Adds an object to the scene like the Add Object Actuator would, and returns the created object.
		
		@param object: The object to add
		@type object: L{KX_GameObject} or string
		@param other: The object's center to use when adding the object
		@type other: L{KX_GameObject} or string
		@param time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
		@type time: int
		
		@rtype: L{KX_GameObject}
		"""