blender

How to survive revert_mainfile() in memory?

How to survive revert_mainfile() in memory? Question: I’m trying to reload the blend file inside the loop in my script. Modal operator doesn’t work, because after scene reload the operator’s instance dies. So, I create my own class, which has my loop in generator, which yields after calling revert_mainfile(), and returning control to it from …

Total answers: 1

(Solved) Blender 3.4 Crashing When Attempting to Run Python Script

Blender 3.4 Crashing When Attempting to Run Python Script Question: I’m attempting to run a script that’s meant to take an initial input for the amount of vertices I want on an object for it to make and a secondary string for the coordinates that I want it to set to each vertex. The problem …

Total answers: 1

get direction of two points and draw circle at first point

get direction of two points and draw circle at first point Question: Vector s and e are two given points. The goal is to find the direction between this two points and draw a circle at the position of the first point. My current approach looks like this: import bpy import mathutils obj = bpy.data.objects["Plane"] …

Total answers: 1

Blender Python – Force reload of module while importing all its classes

Blender Python – Force reload of module while importing all its classes Question: I am developing in Python/Blender, and have two needs here: Import all the individual classes from my module (because they must each be registered with blender) Reload the module itself each time the script is executed (to prevent caching while I’m developing …

Total answers: 2

delete unused materials on a single object using python

delete unused materials on a single object using python Question: After merging and separating objects, I have 69 materials on a single objects but only 50% of them are used by this object. How can I create a list of unused material per object? I have tried the solution on the page (https://blender.stackexchange.com/questions/4817/how-to-know-which-object-is-using-a-material) but my …

Total answers: 2

Blender Python add operator to menu with invoke_default

Blender Python add operator to menu with invoke_default Question: I have created a simple menu in python where i can add operators to it like that layout.operator("wm.center_object") layout.operator("wm.move_camera") the problem is that I need an operator to be called with INVOKE_DEFAULT. The following is the line to call it immediately: bpy.ops.object.custom_draw(‘INVOKE_DEFAULT’) and that works, but …

Total answers: 1

Blender, convert .stl to .obj with prompt commande

Blender, convert .stl to .obj with prompt commande Question: I want to convert an .stl file to .obj, without using blender interface. To do that, i want to do it in two step : 1 STL to BLEND 2 BLEND to OBJ Actually BLEND to OBJ work ok with this python code : import bpy …

Total answers: 2

Unable to build blender

Unable to build blender Question: I am trying to build blender so that I can use it directly from python and was going through this tutorial and I got stuck on the very first make command giving me CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find PythonLibsUnix (missing: PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR) I am using …

Total answers: 6

How to access objects from specific layer in blender game engine

How to access objects from specific layer in blender game engine Question: I want to make a game with progressive level generation. I have some diferent parts of the level on another layer and I spawn them in the first layer using add object in python controller. The problem is when there are multiple objects …

Total answers: 1