Creating an ‘Add Mesh Primitives’ Panel in the Tool Shelf

Hey guys, lets welcome Patrick Boelens as a new guest instructor here on Blender Cookie. We are super jazzed to have him and what he has to bring to the community. Give me a hello, hug or head nod in the comments below.

In this Blender 2.5 video tutorial we will be going over the basics of how to script in Blender 2.5x using the Python programming language.

We will create a Panel in the Tool Shelf with buttons in it that will add Mesh Primitives (Plane, Cube, etc.) to the Scene. We will also take a quick look at adding a name field in the same Panel.

Leave Comment

Discussion

81 Responses to “Creating an ‘Add Mesh Primitives’ Panel in the Tool Shelf”
  1. Posts: 262

    I had to add this line to the end of mine to get the panel to show up:

    bpy.utils.register_class(myTools)

    I update through svn so I am using 2.56.2 r35205. That may have been something that changed in the API after the tutorial was made. I was scratching my head trying to figure out why it wasn’t working, so hopefully that helps people out that are trying to follow the tutorial.

    You have to put the name of the class as the argument. It is myTools because I am modifying the tutorial to make a panel of my most used tools.

    As a quick aside: I noticed their are script templates you can load in the text menu for others that are playing around with python from this tutorial trying to learn.

    Thanks again! It would have taken me ages just to get a panel to show up in the first place!

    • Posts: 225

      Sorry I missed your comment there; wish I’d seen it sooner (I too spend quite a bit of time to figure out what changed). The tip video covering this should go live later today I think. =)

  2. Posts: 1
    247wkman says:

    had an example file with a script called CGLholiday- it was for 2d sprites following the camera, but of course it is glitchy now. its says modual GameLogic does not exist. if the convention refering to moduals has change also let us know if you know.

  3. Posts: 90
    Ben Amend says:

    .

    Young man, it was past your bedtime when you recorded this! ;)

    Nice tutorial!

  4. Posts: 1
    rok cancer says:

    if you’re using blender 2.6 you must add
    bpy.utils.register_class(addObjectPrimitives) after the class body in order for it to work.

Leave a Comment

You must be logged in to post a comment.