Python Scripting in Blender: Extend the power of Blender using Python to create objects, animations, and effective add-ons / Написание сценариев на Python в Blender: Расширьте возможности Blender с помощью Python для создания объектов, анимации и эффективных дополнений Год издания: 2023 Автор: Acampora Paolo / Акампора Паоло Издательство: Packt Publishing ISBN: 978-1-80323-422-9 Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 360 Описание: 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 Key Features Discover ready-to-go scripts that provide a clear solution to your problems Find out how to automate repetitive tasks in an efficient way Extend Blender’s actions and user interface with your code Book Description 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. What you will learn Understand the principles of 3D and programming, and learn how they operate in Blender Build engaging and navigation-friendly user interfaces that integrate with the native look and feel Respect coding guidelines and deliver readable and compliant code without the loss of originality Package your extensions into a complete add-on, ready for installation and distribution Create interactive tools with a direct response to the user’s action Code comfortably and safely using version control Who this book is for This 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. Узнайте, как использовать скрипты Python в Blender 3.3 для автоматизации задач, оптимизации рабочего процесса, мыслить как 3D-программист и быстро приступить к созданию своих инструментов Ключевые функции Откройте для себя готовые к использованию сценарии, которые обеспечивают четкое решение ваших проблем Узнайте, как эффективно автоматизировать повторяющиеся задачи Расширьте действия Blender и пользовательский интерфейс с помощью вашего кода Описание книги Blender, мощное 3D-программное обеспечение с открытым исходным кодом, может быть расширено и активировано с помощью языка программирования Python. Эта книга научит вас автоматизировать трудоемкие операции с помощью сценариев и расширит набор доступных команд, графических интерфейсов, инструментов и реакций на события, что позволит вам добавлять пользовательские функции в соответствии с вашими потребностями и воплощать в жизнь ваши творческие идеи. Книга начинается с описания основных концепций Python и демонстрации того, как создать базовое дополнение. Затем вы получите четкое представление о сущностях, влияющих на внешний вид объектов Blender, таких как модификаторы, ограничения и материалы. По мере продвижения вы познакомитесь с системой анимации в Blender и узнаете, как настроить ее поведение с помощью Python. Примеры, инструменты, шаблоны и лучшие практики, представленные в книге, познакомят вас с API Python и создадут вашу базу знаний, а также позволят вам создавать ценный код, расширяющий возможности пользователей и готовый к публикации или производству. К концу этой книги вы сможете успешно разрабатывать дополнения, которые легко интегрируются с программным обеспечением и его экосистемой. Чему вы научитесь Разберетесь в принципах 3D и программирования и узнайте, как они работают в Blender Создавать привлекательные и удобные для навигации пользовательские интерфейсы, которые интегрируются с родным внешним видом Соблюдать рекомендации по кодированию и создавать читаемый и совместимый код без потери оригинальности Упаковывать ваши расширения в полноценное дополнение, готовое к установке и распространению Создавать интерактивные инструменты с прямым откликом на действия пользователя Кодировать удобно и безопасно, используя систему управления версиями Для кого предназначена эта книга Эта книга предназначена для пользователей Blender, которые хотят расширить свои навыки и изучить написание сценариев, технических директоров, стремящихся автоматизировать трудоемкие задачи, а также профессионалов и любителей, желающих узнать больше об архитектуре Python, лежащей в основе интерфейса Blender. Предварительным условием является предыдущий опыт работы с Blender, а также базовое понимание синтаксиса Python — однако в книге содержатся краткие объяснения, позволяющие устранить потенциальные пробелы в ваших базовых знаниях.
Примеры страниц
Оглавление
Preface xv Part 1: Introduction to Python 1 Python’s Integration with Blender 3 Technical requirements 4 Installing Blender 4 Installing Blender on Windows 4 Installing multiple versions on macOS 6 The Scripting workspace – first steps with Python 8 The Python console 8 The Info Log 12 The Text Editor 14 External editor – Visual Studio Code 17 Loading our scripts folder 18 Keeping Blender’s text blocks in sync 19 Version control and backup 19 Initializing the repository 19 Making changes 20 Summary 21 Questions 22 2 Python Entities and API 23 Technical requirements 23 Useful features of Python 24 Options for developers 24 Python console’s utilities 26 Accessing Blender modules 30 The bpy module 30 API documentation 32 Accessing Blender data 33 Creating new objects 37 Removing elements 40 Understanding the user context 40 Summary 46 Questions 46 Table of Contents 3 Creating Your Add-Ons 47 Technical requirements 47 Installing our add-ons in Blender 48 Add-on requirements 49 Installation 50 Uninstall 51 The scripts path 51 Creating our first add-on – object collector 53 Operators 54 Writing a basic operator 54 Loading operators in our add-on 56 Running our add-on 57 Refreshing the add-on list 57 Running from the Search Toolbar 57 Improving our code 59 Saving our edits automatically 59 Ignoring bytecode files (.pyc) 59 Fixing the operator logic 62 Reloading scripts 64 Avoiding re-assignment errors 64 Our final operator 65 Extending menus 66 Summary 67 Questions 68 4 Exploring Object Transformations 69 Technical requirements 69 Moving objects in space 70 Transforming objects 70 Transforming objects indirectly 76 Using Object Constraints 77 Using object hierarchies 79 Understanding the transform matrix 80 Accessing matrices 81 Storing object matrices 82 Copying matrices 82 Restoring transformations using the world matrix 83 Creating rest offsets with the parent inverse matrix 83 Writing the Elevator add-on 84 Setting the environment 84 Writing the first draft 85 Using input properties 87 Setting the height in the world matrix 89 Avoiding duplicate transformations 90 Adding the constraints switch 91 Avoiding duplicate constraints 92 Summary 93 Questions 94 5 Designing Graphical Interfaces 95 Technical requirements 95 Areas, regions, and panels 96 Creating a simple panel 97 Setting the environment 97 Drafting our panel add-on 97 Setting display attributes 99 Adding a panel to the Object Properties area 102 Using layouts in our panels 109 Arranging in columns and rows 109 Adding frames with box layouts 110 Using composite layouts 111 Providing color feedback 117 Checking whether an object has been selected 118 Checking whether an object is active 118 Drawing layouts in red or gray 118 Displaying buttons 120 Using the operator method 120 Setting the operator’s text and visibility 121 Overriding an operator’s settings 123 Setting operator properties 124 Adding buttons for our functions 125 Displaying the operator properties 127 Using different regions 129 Summary 130 Questions 131 Part 2: Interactive Tools and Animation 6 Structuring Our Code and Add-Ons 135 Technical requirements 135 Folders, packages, and add-ons 136 Creating a package folder and the init file 136 Writing the init file 137 Guidelines for separating modules 138 Writing the structured panel 139 Packing external images 140 Writing an icon library 141 Loading pictures from a folder 141 Unregistering icons 143 Getting the collection 143 Using relative imports 144 Adding a user interface 145 Writing the UI module 145 Importing the UI 146 Completing the Objects panel 147 Reloading cached modules 148 Reloading via importlib 148 Implementing a refresh module 148 Reloading the package modules 149 Using Developer Extras as a condition 150 Using add-on preferences 151 Creating preferences 151 Populating the preferences 153 Using add-on preferences in code 154 Adding operators 155 Writing the operators module 156 Registering operator classes 157 Refreshing operators on reload 157 Adding operator buttons 158 Packaging and installing add-ons 159 Cleaning up bytecode 159 Creating a .zip file using 7-Zip 159 Creating a .zip file using Windows File Manager 160 Creating a .zip file on Mac using Finder 161 Creating a .zip file using Gnome 161 Installing .zip add-ons 161 Summary 162 Questions 162 7 The Animation System 163 Technical requirements 163 Understanding the animation system 163 Timeline and Current Frame 164 Duration and Frame Rate 165 Current frame and preview range 166 Animation keyframes 167 Writing the Action to Range add-on 168 Setting the environment 168 Writing the Action to Range information 168 Writing the Action to Range operator 169 Writing the operator methods 169 Writing the menu function 171 Finishing the add-on 172 Enabling and running 174 Fixing context for other operators 177 Editing keyframes 179 Animation curves and the Graph Editor 179 Accessing animation data in Python 181 Adding keyframes in Python 181 Retrieving keyframes in Python 182 Writing the Vert Runner add-on 185 Setting the environment 185 Writing the Vert Runner information 186 Writing the Vert Runner operator 186 Writing the operator methods 187 Writing the menu and register functions 188 Creating cyclic animations 189 Adding rotations 190 Using Vert Runner 195 Summary 195 Questions 196 8 Animation Modifiers 197 Technical requirements 197 Using F-Curve Modifiers 198 Adding F-Curve Modifiers in the Graph Editor 198 Adding F-Curve Modifiers in Python 200 Writing the Shaker add-on 201 Setting up the environment 201 Writing the Shaker add-on info 201 Writing the Add Object Shake operator class 202 Writing the operator methods 203 Adding menu items 206 Finding the class names of context menus 206 Registering the Shaker add-on 207 Using the Shaker add-on 208 Summary 208 Questions 209 9 Animation Drivers 211 Technical requirements 211 Creating drivers 212 Creating quick drivers via the right-click menu 212 Setting up a wheel with the Drivers Editor 214 Creating driver expressions in properties 216 Driving a cyclic motion 216 Changing the rotation pivot via constraints 217 Controlling the period of the sin function 219 Implementing the pendulum equation 220 Controlling the amplitude 226 Writing the pendulum add-on 228 Setting the environment 229 Writing the information 229 Writing the Operator class 230 Writing the menu and registering the class 233 Summary 234 Questions 234 10 Advanced and Modal Operators 237 Technical requirements 237 Understanding the operator flow 237 Steps of execution 238 Writing the “PunchClock” add-on 240 Creating the add-on script 240 Using invoke to initialize properties 243 Ensuring default invoke in pop-up menus 244 Adding modal behavior 245 Adding the operator to the modal handlers 246 Writing the modal method 247 Styling the operator panel 250 Writing the draw method 250 Summary 252 Questions 252 Part 3: Delivering Output 11 Object Modifiers 255 Technical requirements 255 Understanding object modifiers 255 Adding modifiers 256 Subdividing an object 257 Changing the object’s shape using Cast 259 Adding modifiers in Python 259 Finding collection-type items 259 Using modifiers.new 260 Deformation objects 262 Using the Lattice modifier 262 Writing the Latte Express add-on 263 Setting the environment 264 Writing the Latte Express information 264 Writing the Latte Express operator 264 Finding the center of a model 265 Adding a Create Lattice menu item 267 Using the Latte Express add-on 268 Improving Latte Express options 268 Adding object subdivisions 269 Changing lattice resolution 269 Using armature deformers 271 Adding armature objects to the scene 271 Adding armature bones 272 Binding objects to armatures 274 Scripting a lattice armature 275 Adding an armature condition 275 Adding an armature to the scene 275 Creating edit bones 276 Assigning vertices to bones 278 Creating the Armature modifier 279 Adding custom bone shapes 279 Creating mesh objects in Python 279 Finalizing the setup 281 Summary 283 Questions 283 12 Rendering and Shaders 285 Technical requirements 285 Render and materials 286 Setting the Render Engine 286 The Shading workspace 286 Understanding object materials 287 Setting Material Properties 287 The Shader Editor 289 Understanding the Node Tree 289 Writing the Textament add-on 291 Using texture images 291 Setting up the environment 292 Writing an import operator 292 Connecting nodes 298 Adding a header button 299 Using Load Textures 300 Improving Load Textures 302 Arranging shader nodes 303 Mixing the Base Color 306 Summary 308 Questions 309 Appendix 311 Part 1: An Introduction to Python 311 Chapter 1, Python’s Integration with Blender 311 Chapter 2, Python Entities and API 312 Chapter 3, Creating Your Add-Ons 314 Chapter 4, Exploring Object Transformations 315 Chapter 5, Designing Graphical Interfaces 316 Part 2: Interactive Tools and Animation 316 Chapter 6, Structuring Our Code and Add-Ons 316 Chapter 7, The Animation System 317 Chapter 8, Animation Modifiers 318 Chapter 9, Animation Drivers 318 Chapter 10, Advanced and Modal Operators 319 Part 3: Delivering Output 320 Chapter 11, Object Modifiers 320 Chapter 12, Rendering and Shaders 321 Index 323 Other Books You May Enjoy 336
[only-soft.org].t186347.torrent
Торрент:
Зарегистрирован
[ 2023-10-10 15:20 ]
12 KB
Статус:
√проверено
Скачан:
3 раз
Размер:
38 MB
Оценка:
(Голосов: 0)
Поблагодарили:
0
Acampora Paolo / Акампора Паоло - Python Scripting in Blender: Extend the power of Blender using Python to create objects, animations, and effective add-ons / Написание сценариев на Python в Blender [2023, PDF, ENG] скачать торрент бесплатно и без регистрации
Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы