You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Blender 2.8 PYTHON for Beginners (Automate)

6

Danny Mac writes:

In this video I create a basic python script for Blender and show how you can use Blender to help write your scripts

6 Comments

  1. Merlin's Tails on

    You can just use the new shortcut for context (C) and just use bone:

    for bone in C.object.pose.bones:
    bone.custom_shape = bpy.data.objects["Empty"]

  2. Oops, forgot you could also use D for bpy.data ... please note this is only available from the console. I don't think this imports from a script.

    So to one-liner this you can just do it from the console as:

    for bone in C.object.pose.bones: bone.custom_shape = D.objects["Empty"]

    • Aha! In Blender 2.8 'bpy' is implicitly imported for you, so it's no longer necessary to 'import bpy' at the top of every script. That's debatably a nice little change... but I don't think it makes things things clearer where things come in from, for new scripters.
      That being said, all you need to do if you want to use 'D' for bpy.data in your own scripts, is:

      from bpy import data as D

      you can alias any import in Python to whatever you want just using 'as'.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.