Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Last active December 14, 2015 04:29
Show Gist options
  • Select an option

  • Save PierrickKoch/5028832 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/5028832 to your computer and use it in GitHub Desktop.
Scan the game controllers from all objects in a Blender file
def scan():
for obj in bpy.data.objects:
for ctrl in obj.game.controllers:
print("# bpy.data.objects['%s'].game.controllers['%s']"%\
(obj.name, ctrl.name))
if ctrl.type == 'PYTHON' and ctrl.mode == 'MODULE' and \
ctrl.module.startswith('calling.'):
# TODO remove it
print("### module: %s"%ctrl.module)
scan()
"""
# bpy.data.objects['head_armature'].game.controllers['Python']
### module: calling.actuator_action
# bpy.data.objects['l_arm_armature'].game.controllers['Python']
### module: calling.actuator_action
# bpy.data.objects['l_arm_armature'].game.controllers['Or']
# bpy.data.objects['r_arm_armature'].game.controllers['Python']
### module: calling.actuator_action
# bpy.data.objects['r_arm_armature'].game.controllers['Or']
# bpy.data.objects['torso_armature'].game.controllers['Python']
### module: calling.actuator_action
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment