svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD

Notes:
* Game and sequencer RNA, and sequencer header are now out of date
  a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
  not needed anymore.
  * Fix "duplicate strip" always increase the user count for ipo.
  * IPO pinning on sequencer strips was lost during Undo.
This commit is contained in:
2009-06-08 20:08:19 +00:00
594 changed files with 28292 additions and 13753 deletions

View File

@@ -1,7 +1,7 @@
#!BPY
"""
Name: 'GameLogic Example'
Blender: 245
Blender: 249
Group: 'ScriptTemplate'
Tooltip: 'Script template with examples of how to use game logic'
"""
@@ -29,63 +29,63 @@ def main():
cont = GameLogic.getCurrentController()
# The KX_GameObject that owns this controller.
own = cont.getOwner()
own = cont.owner
# for scripts that deal with spacial logic
own_pos = own.getPosition()
own_pos = own.worldPosition
# Some example functions, remove to write your own script.
# check for a positive sensor, will run on any object without errors.
print 'Logic info for KX_GameObject', own.getName()
print 'Logic info for KX_GameObject', own.name
input = False
for sens in cont.getSensors():
for sens in cont.sensors:
# The sensor can be on another object, we may want to use it
own_sens = sens.getOwner()
print ' sensor:', sens.getName(),
if sens.isPositive():
own_sens = sens.owner
print ' sensor:', sens.name,
if sens.positive:
print '(true)'
input = True
else:
print '(false)'
for actu in cont.getActuators():
for actu in cont.actuators:
# The actuator can be on another object, we may want to use it
own_actu = actu.getOwner()
print ' actuator:', actu.getName()
own_actu = actu.owner
print ' actuator:', actu.name
# This runs the actuator or turns it off
# note that actuators will continue to run unless explicitly turned off.
if input:
GameLogic.addActiveActuator(actu, True)
cont.activate(actu)
else:
GameLogic.addActiveActuator(actu, False)
cont.deactivate(actu)
# Its also good practice to get sensors and actuators by names
# so any changes to their order wont break the script.
# Its also good practice to get sensors and actuators by name
# rather then index so any changes to their order wont break the script.
# sens_key = cont.getSensor('key_sensor')
# actu_motion = cont.getActuator('motion')
# sens_key = cont.sensors['key_sensor']
# actu_motion = cont.actuators['motion']
# Loop through all other objects in the scene
sce = GameLogic.getCurrentScene()
print 'Scene Objects:', sce.getName()
for ob in sce.getObjectList():
print ' ', ob.getName(), ob.getPosition()
print 'Scene Objects:', sce.name
for ob in sce.objects:
print ' ', ob.name, ob.worldPosition
# Example where collision objects are checked for their properties
# adding to our objects "life" property
"""
actu_collide = cont.getSensor('collision_sens')
for ob in actu_collide.getHitObjectList():
actu_collide = cont.sensors['collision_sens']
for ob in actu_collide.objectHitList:
# Check to see the object has this property
if hasattr(ob, 'life'):
own.life += ob.life
ob.life = 0
print own.life
if ob.has_key('life'):
own['life'] += ob['life']
ob['life'] = 0
print own['life']
"""
main()