Reader small image

You're reading from  Python Scripting in Blender

Product typeBook
Published inJun 2023
PublisherPackt
ISBN-139781803234229
Edition1st Edition
Right arrow
Author (1)
Paolo Acampora
Paolo Acampora
author image
Paolo Acampora

Paolo Acampora is a 3D artist and programmer, with experience in Animation, Visual Effects, and Real Time computer graphics. He provides tools that streamline the production workflow and let artists focus on the creative aspects of their craft. He has worked with several studios for more than a decade. He contributes to the blender development and releases his tools for the community.
Read more about Paolo Acampora

Right arrow

Creating a simple panel

We will start with a simple panel that contains some text and icons, and we will see how to expand this initial idea into a tool that can help manage the objects in the scene.

Our panel is a new class that derives from bpy.types.Panel. Like operators, panels require some static members to be set; otherwise, they will not work. Similar to operators, panels can have a poll() class method that states under which conditions the panel can be displayed.

Instead of using the execute function, panels set up and draw their content via the draw(self, context) function.

Since we are adding a new piece to the Blender interface, we will do that inside a new add-on. It’s not mandatory, but it makes it easier to enable and disable our panel.

To keep our code orderly and clean, we will create a new folder for the scripts written for this chapter.

Setting the environment

Let’s create a folder for Chapter 5 in our Visual Studio Code project. Then...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Python Scripting in Blender
Published in: Jun 2023Publisher: PacktISBN-13: 9781803234229

Author (1)

author image
Paolo Acampora

Paolo Acampora is a 3D artist and programmer, with experience in Animation, Visual Effects, and Real Time computer graphics. He provides tools that streamline the production workflow and let artists focus on the creative aspects of their craft. He has worked with several studios for more than a decade. He contributes to the blender development and releases his tools for the community.
Read more about Paolo Acampora