Python scripting in Blender extend the power of Blender using Python to create objects, animations, and effective add-ons
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 quickly Purchase of the print or Kindle book includes a free PDF eBook Key Features Discover ready-to-go scripts that provide a clear solution to your p...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing
[2023]
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009752736306719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Contributors
- Table of Contents
- Preface
- Part 1: Introduction to Python
- Chapter 1: Python's Integration with Blender
- Technical requirements
- Installing Blender
- Installing Blender on Windows
- Installing multiple versions on macOS
- The Scripting workspace - first steps with Python
- The Python console
- The Info Log
- The Text Editor
- External editor - Visual Studio Code
- Loading our scripts folder
- Keeping Blender's text blocks in sync
- Version control and backup
- Initializing the repository
- Making changes
- Summary
- Questions
- Chapter 2: Python Entities and API
- Technical requirements
- Useful features of Python
- Options for developers
- Python console's utilities
- Accessing Blender modules
- The bpy module
- API documentation
- Accessing Blender data
- Creating new objects
- Removing elements
- Understanding the user context
- Summary
- Questions
- Chapter 3: Creating Your Add-Ons
- Technical requirements
- Installing our add-ons in Blender
- Add-on requirements
- Installation
- Uninstall
- The scripts path
- Creating our first add-on - object collector
- Operators
- Writing a basic operator
- Loading operators in our add-on
- Running our add-on
- Refreshing the add-on list
- Running from the Search Toolbar
- Improving our code
- Saving our edits automatically
- Ignoring bytecode files (.pyc)
- Fixing the operator logic
- Reloading scripts
- Avoiding re-assignment errors
- Our final operator
- Extending menus
- Summary
- Questions
- Chapter 4: Exploring Object Transformations
- Technical requirements
- Moving objects in space
- Transforming objects
- Transforming objects indirectly
- Using Object Constraints
- Using object hierarchies
- Understanding the transform matrix
- Accessing matrices.
- Storing object matrices
- Copying matrices
- Restoring transformations using the world matrix
- Creating rest offsets with the parent inverse matrix
- Writing the Elevator add-on
- Setting the environment
- Writing the first draft
- Using input properties
- Setting the height in the world matrix
- Avoiding duplicate transformations
- Adding the constraints switch
- Avoiding duplicate constraints
- Summary
- Questions
- Chapter 5: Designing Graphical Interfaces
- Technical requirements
- Areas, regions, and panels
- Creating a simple panel
- Setting the environment
- Drafting our panel add-on
- Setting display attributes
- Adding a panel to the Object Properties area
- Using layouts in our panels
- Arranging in columns and rows
- Adding frames with box layouts
- Using composite layouts
- Providing color feedback
- Checking whether an object has been selected
- Checking whether an object is active
- Drawing layouts in red or gray
- Displaying buttons
- Using the operator method
- Setting the operator's text and visibility
- Overriding an operator's settings
- Setting operator properties
- Adding buttons for our functions
- Displaying the operator properties
- Using different regions
- Summary
- Questions
- Part 2: Interactive Tools and Animation
- Chapter 6: Structuring Our Code and Add-Ons
- Technical requirements
- Folders, packages, and add-ons
- Creating a package folder and the init file
- Writing the init file
- Guidelines for separating modules
- Writing the structured panel
- Packing external images
- Writing an icon library
- Loading pictures from a folder
- Unregistering icons
- Getting the collection
- Using relative imports
- Adding a user interface
- Writing the UI module
- Importing the UI
- Completing the Objects panel
- Reloading cached modules
- Reloading via importlib.
- Implementing a refresh module
- Reloading the package modules
- Using Developer Extras as a condition
- Using add-on preferences
- Creating preferences
- Populating the preferences
- Using add-on preferences in code
- Adding operators
- Writing the operators module
- Registering operator classes
- Refreshing operators on reload
- Adding operator buttons
- Packaging and installing add-ons
- Cleaning up bytecode
- Creating a .zip file using 7-Zip
- Creating a .zip file using Windows File Manager
- Creating a .zip file on Mac using Finder
- Creating a .zip file using Gnome
- Installing .zip add-ons
- Summary
- Questions
- Chapter 7: The Animation System
- Technical requirements
- Understanding the animation system
- Timeline and Current Frame
- Duration and Frame Rate
- Current frame and preview range
- Animation keyframes
- Writing the Action to Range add-on
- Setting the environment
- Writing the Action to Range information
- Writing the Action to Range operator
- Writing the operator methods
- Writing the menu function
- Finishing the add-on
- Enabling and running
- Fixing context for other operators
- Editing keyframes
- Animation curves and the Graph Editor
- Accessing animation data in Python
- Adding keyframes in Python
- Retrieving keyframes in Python
- Writing the Vert Runner add-on
- Setting the environment
- Writing the Vert Runner information
- Writing the Vert Runner operator
- Writing the operator methods
- Writing the menu and register functions
- Creating cyclic animations
- Adding rotations
- Using Vert Runner
- Summary
- Questions
- Chapter 8: Animation Modifiers
- Technical requirements
- Using F-Curve Modifiers
- Adding F-Curve Modifiers in the Graph Editor
- Adding F-Curve Modifiers in Python
- Writing the Shaker add-on
- Setting up the environment.
- Writing the Shaker add-on info
- Writing the Add Object Shake operator class
- Writing the operator methods
- Adding menu items
- Finding the class names of context menus
- Registering the Shaker add-on
- Using the Shaker add-on
- Summary
- Questions
- Chapter 9: Animation Drivers
- Technical requirements
- Creating drivers
- Creating quick drivers via the right-click menu
- Setting up a wheel with the Drivers Editor
- Creating driver expressions in properties
- Driving a cyclic motion
- Changing the rotation pivot via constraints
- Controlling the period of the sin function
- Implementing the pendulum equation
- Controlling the amplitude
- Writing the pendulum add-on
- Setting the environment
- Writing the information
- Writing the Operator class
- Writing the menu and registering the class
- Summary
- Questions
- Chapter 10: Advanced and Modal Operators
- Technical requirements
- Understanding the operator flow
- Steps of execution
- Writing the "PunchClock" add-on
- Creating the add-on script
- Using invoke to initialize properties
- Ensuring default invoke in pop-up menus
- Adding modal behavior
- Adding the operator to the modal handlers
- Writing the modal method
- Styling the operator panel
- Writing the draw method
- Summary
- Questions
- Part 3: Delivering Output
- Chapter 11: Object Modifiers
- Technical requirements
- Understanding object modifiers
- Adding modifiers
- Subdividing an object
- Changing the object's shape using Cast
- Adding modifiers in Python
- Finding collection-type items
- Using modifiers.new
- Deformation objects
- Using the Lattice modifier
- Writing the Latte Express add-on
- Setting the environment
- Writing the Latte Express information
- Writing the Latte Express operator
- Finding the center of a model
- Adding a Create Lattice menu item.
- Using the Latte Express add-on
- Improving Latte Express options
- Adding object subdivisions
- Changing lattice resolution
- Using armature deformers
- Adding armature objects to the scene
- Adding armature bones
- Binding objects to armatures
- Scripting a lattice armature
- Adding an armature condition
- Adding an armature to the scene
- Creating edit bones
- Assigning vertices to bones
- Creating the armature modifier
- Adding custom bone shapes
- Creating mesh objects in Python
- Finalizing the setup
- Summary
- Questions
- Chapter 12: Rendering and Shaders
- Technical requirements
- Render and materials
- Setting the Render Engine
- The Shading workspace
- Understanding object materials
- Setting Material Properties
- The Shader Editor
- Understanding the Node Tree
- Writing the Textament add-on
- Using texture images
- Setting up the environment
- Writing an import operator
- Connecting nodes
- Adding a header button
- Using Load Textures
- Improving Load Textures
- Arranging shader nodes
- Mixing the Base Color
- Summary
- Questions
- Appendix
- Part 1: An Introduction to Python
- Chapter 1, Python's Integration with Blender
- Chapter 2, Python Entities and API
- Chapter 3, Creating Your Add-Ons
- Chapter 4, Exploring Object Transformations
- Chapter 5, Designing Graphical Interfaces
- Part 2: Interactive Tools and Animation
- Chapter 6, Structuring Our Code and Add-Ons
- Chapter 7, The Animation System
- Chapter 8, Animation Modifiers
- Chapter 9, Animation Drivers
- Chapter 10, Advanced and Modal Operators
- Part 3: Delivering Output
- Chapter 11, Object Modifiers
- Chapter 12, Rendering and Shaders
- Index
- Other Books You May Enjoy.