Zum Hauptinhalt springen
Nicht aus der Schweiz? Besuchen Sie lehmanns.de

Python Scripting in Blender (eBook)

Extend the power of Blender using Python to create objects, animations, and effective add-ons
eBook Download: EPUB
2023
360 Seiten
Packt Publishing (Verlag)
978-1-80324-327-6 (ISBN)

Lese- und Medienproben

Python Scripting in Blender -  Paolo Acampora
Systemvoraussetzungen
29,99 inkl. MwSt
(CHF 29,30)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Blender, a powerful open source 3D software, can be extended and powered up using the Python programming language. This book teaches you how to automate laborious operations using scripts, and expand the set of available commands, graphic interfaces, tools, and event responses, which will enable you to add custom features to meet your needs and bring your creative ideas to life.
The book begins by covering essential Python concepts and showing you how to create a basic add-on. You'll then gain a solid understanding of the entities that affect the look of Blender's objects such as modifiers, constraints, and materials. As you advance, you'll get to grips with the animation system in Blender and learn how to set up its behavior using Python. The examples, tools, patterns, and best practices present throughout the book will familiarize you with the Python API and build your knowledge base, along with enabling you to produce valuable code that empowers the users and is ready for publishing or production.
By the end of this book, you'll be able to successfully design add-ons that integrate seamlessly with the software and its ecosystem.


Learn how to use Python scripts in Blender 3.3 to automate tasks, optimize your workflow, think like a 3D programmer, and start creating your tools quicklyPurchase of the print or Kindle book includes a free PDF eBookKey FeaturesDiscover ready-to-go scripts that provide a clear solution to your problemsFind out how to automate repetitive tasks in an efficient wayExtend Blender s actions and user interface with your codeBook DescriptionBlender, a powerful open source 3D software, can be extended and powered up using the Python programming language. This book teaches you how to automate laborious operations using scripts, and expand the set of available commands, graphic interfaces, tools, and event responses, which will enable you to add custom features to meet your needs and bring your creative ideas to life. The book begins by covering essential Python concepts and showing you how to create a basic add-on. You ll then gain a solid understanding of the entities that affect the look of Blender s objects such as modifiers, constraints, and materials. As you advance, you ll get to grips with the animation system in Blender and learn how to set up its behavior using Python. The examples, tools, patterns, and best practices present throughout the book will familiarize you with the Python API and build your knowledge base, along with enabling you to produce valuable code that empowers the users and is ready for publishing or production. By the end of this book, you ll be able to successfully design add-ons that integrate seamlessly with the software and its ecosystem.What you will learnUnderstand the principles of 3D and programming, and learn how they operate in BlenderBuild engaging and navigation-friendly user interfaces that integrate with the native look and feelRespect coding guidelines and deliver readable and compliant code without the loss of originalityPackage your extensions into a complete add-on, ready for installation and distributionCreate interactive tools with a direct response to the user s actionCode comfortably and safely using version controlWho this book is forThis book is for Blender users who want to expand their skills and learn scripting, technical directors looking to automate laborious tasks, and professionals and hobbyists who want to learn more about the Python architecture underlying the Blender interface. Prior experience with Blender is a prerequisite, along with a basic understanding of the Python syntax however, the book does provide quick explanations to bridge potential gaps in your background knowledge.]]>

Preface


Blender is a free, open source application for 3D modeling and animation. It has evolved over the years and, since version 3.0, is on par with state-of-the-art software in many aspects.

It provides a Python Application Programming Interface (API) for automating tasks, adding functionalities, and integrating Blender in large productions.

Python is a free, open source programming language for quick yet powerful scripting. Its syntax, akin to simplified English, automatic memory management, and ease of integration, makes it the standard in software APIs and 3D pipelines.

This book goes through the steps of the 3D process, starting with the creation and manipulation of objects, then animation and deformation follow, with rendering as the closing chapter. Though this order is a linear path, every chapter can stand on its own, with the exception perhaps of Chapter 6, and Chapter 8, which rely on examples introduced in their immediate predecessor.

Who this book is for


This book is for users of Blender who want to expand their skills and learn to script, technical directors who want to automate laborious tasks, and professionals and hobbyists who want to learn more about the Python architecture of Blender.

What this book covers


Chapter 1, Python’s Integration with Blender, teaches you how to run Python instructions in Blender, and use external editors and version control.

Chapter 2, Python Entities and APIs, teaches you how to set up options for developers, and how to use Blender modules and access the current context and objects.

Chapter 3, Creating Your Add-Ons, teaches you how to write Blender add-ons using Python, how towrite operators, and how to add entries to Blender menus.

Chapter 4, Exploring Object Transformations, teaches you how location, rotation, and scale are handled in Python, how to use object constraints and transform matrices, and how to use input properties in operators.

Chapter 5, Designing Graphical Interfaces, provides information on how the Blender user interface works, how to create and arrange your own panels, and how to load custom icons and display buttons for custom functions.

Chapter 6, Structuring Our Code and Add-Ons, teaches you how to write and distribute modular addons, how to display add-on preferences, and how to update changes in your modules.

Chapter 7, The Animation System, teaches you how to access and create animation data, how to script procedural motions, and how to extrapolate rotations.

Chapter 8, Animation Modifiers, instructs you on how to add non-destructive modifiers to animations, and how to use them for animated procedural effects.

Chapter 9, Animation Drivers, teaches you how to set up inputs for animation channels, how to drive animations with Python expressions, and how to convert the oscillation formula to animated objects.

Chapter 10, Advanced and Modal Operators, teaches you how to customize the operator execution flow and how to respond to input events in your operators.

Chapter 11, Object Modifiers, provides information on how object modifiers, armatures, and lattices work, and how to set up animation controls of deformed objects.

Chapter 12, Rendering and Shaders, teaches you how color and material information is applied to objects and how that process can be automated.

To get the most out of this book


The examples in this book were written and tested using Blender version 3.3. Version 3.3 is a long-term support release and can be found on most application platforms, besides being available for free at Blender.org.

Using a programmer text editor is advised. Microsoft Visual Studio Code 1.70, a lightweight free editor available on most operating systems, is used in this book, but any other editor can be used.

More instructions on how to install the software are provided in Chapter 1.

The scripts contained in the book were written with forward compatibility in mind. The code available online will be updated to accommodate changes in future releases.

It is assumed that you have some experience with Blender and at least a basic understanding of how Python works, but special effort was put into keeping those requirements low and providing explanations for every concept used in this book.

Software/hardware covered in the book

Operating system requirements

Blender 3.3

Windows, macOS, or Linux

Visual Studio Code 1.70 or later

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Python-Scripting-in-Blender. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/G1mMt.

Conventions used


There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “The fcurve.modifiers.new(type) method creates a new modifier according to the type provided in the argument. It returns the new modifier.”

A block of code is set as follows:

bl_info = {     "name": "Object Shaker",    "author": "Packt Man",    "version": (1, 0),    "blender": (3, 00, 0),    "description": "Add Shaky motion to active object",    "location": "Object Right Click -> Add Object Shake",    "category": "Learning", }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

sin((frame / fps) * 2 * pi / (2 * pi * sqrt(length/9.8)))

Any command-line input or output is written as follows:

['ASSETBROWSER_MT_context_menu',...['VIEW3D_MT_edit_metaball_context_menu', 'VIEW3D_MT_gpencil_edit_context_menu', 'VIEW3D_MT_object_context_menu', 'VIEW3D_MT_particle_context_menu',...

Some of the code is meant to be used as input for the interactive Python Console. In that case, the user input is preceded by the >>> prompt, unlike the console output:

>>> print("Hello") Hello

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Before we delve into how f-modifiers are scripted, we will have a look at how to create them in Graph Editor.”

Tips or important notes

Appear like this.

Get in touch


Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be...

Erscheint lt. Verlag 9.6.2023
Sprache englisch
Themenwelt Informatik Grafik / Design Digitale Bildverarbeitung
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
ISBN-10 1-80324-327-9 / 1803243279
ISBN-13 978-1-80324-327-6 / 9781803243276
Informationen gemäß Produktsicherheitsverordnung (GPSR)
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Ohne DRM)

Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopier­schutz. Eine Weiter­gabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persön­lichen Nutzung erwerben.

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Bring out the best in your images using Adobe Photoshop Elements 2024

von Robin Nichols

eBook Download (2024)
Packt Publishing Limited (Verlag)
CHF 37,10
Discover the smart way to polish your digital imagery skills by …

von Gary Bradley

eBook Download (2024)
Packt Publishing (Verlag)
CHF 49,20
Generate creative images from text prompts and seamlessly integrate …

von Margarida Barreto

eBook Download (2024)
Packt Publishing (Verlag)
CHF 26,35