New answers tagged

0

Quaternion data-types need 4 float values while euler rotation data-types need only 3 values and the default size for FloatVectorProperty is 3 ; so together with subtype argument that should be set to QUATERNION we should also set the size argument to 4 and the field now holds a quaternion data-type.


0

It is because localUpdate is an instance method. localString is a class annotation adding a property to all instances but at the time is defined, instance methods are not yet registered in the class. (At least that's my guess) So you have to move localUpdate out of the class definition : This works : import bpy from bpy.types import Operator, Panel from bpy....


0

Although i am not the add-on-Pro....i think it is because you are showing the global variable field too. So it takes the value from that field. If you comment out # col.prop(context.scene, "globalString", text="Global") it works. But i am sure batfinger can explain this better ;)


1

You need to make some changes to switch to the image editor. Here is a version of the class that will work: class HelloWorldPanel(bpy.types.Panel): """Creates a Panel in the Object properties window""" bl_label = "label" bl_idname = "OBJECT_PT_hello" bl_space_type = 'IMAGE_EDITOR' ...


1

This worked for me: import bpy C = bpy.context print ("started") for i, a in enumerate(C.screen.areas): print(a.type) if a.type == "VIEW_3D": space = a.spaces.active space.region_3d.view_perspective = 'ORTHO' print("set ortho")


3

The short answer is that it would be too complicated to calculate an exact amount of RAM that a FLIP Fluids addon simulation will use. The memory needed to be allocated is dynamic and depends on many factors such as fluid movement and placement of liquid at any point in time. A very rough estimate would be to look at the voxel count displayed in the FLIP ...


0

From the error screenshot, it looks like the unofficial distributor may have packaged the FLIP Fluids addon in a way that causes it not to function correctly. The folder that contains the addon's scripts must be named flip_fluids_addon, but from the screenshot it looks like it has been renamed to ~Get Your Graphic Files. The fix is to rename that folder to ...


1

OK, since nobody gave me a better solution, I did it my way and it worked, so I decided to post it back here in case anyone wants to do it too. [My case] We have 20+ machines working with the same version of Blender on a local server. Since I'm making changes to the original Blender add-ons (like for example added features to OBJ Importer/Exporter and so on)....


4

I'm not sure if there's a way to do that. One alternative is to have your addon register some code to be run when a file is loaded that fixes up the library paths to their new location. bl_info = { "name" : "Test", "blender" : (2, 93, 0), } import bpy from bpy.app.handlers import persistent import os @persistent def ...


4

If you want this to be portable, independent of OS versions or Blender release versions, you can use code like what I have below. It's based on Python's platform data from the sys library and Blender's Directory Layout from the Blender manual. Replace your dir = ... with this code. It will only work for standard installations. There's no way to deal with ...


0

I'm not sure what made the name pop up before and now it doesn't, but the text it gives you ('<bpy_struct...'>) is a string representation of the whole object, not just the name. The definition to return that string is defined in bpy.types.Object class. As the comment said, camera_pointer.name is what you want. If the pointer currently has no object, ...


2

This error looks related to a bug in Blender which occurs when trying to enable an addon through script or command line: https://developer.blender.org/T87629 If this is the case, the full error message from the Blender System Console would look something like this: Exception in module register(): C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender\2....


2

There are two ways to go about this in Blender. The recommended portable way is to create a modal operator. Modal Operators is a good free tutorial and this answer gives a minimal implementation that I quote here. class VIEW3D_OT_process_input(bpy.types.Operator): """Process input while Control key is pressed.""" ...


0

After observing how __init__.py packages everything together this simple trick worked. Please do let me know if some other correction is needed. My folder structure: my_addon/__init__.py my_addon/somefunc.py my_addon/anotherfunc.py my_addon/somefolder/otherfunc.py The folder name (my_addon) should have pythonic name (no period, slash etc). Now in __init__....


2

Why not use bpy.ops.preferences.addon_enable(module="") ? import bpy addon = bpy.context.preferences.addons.get('rigify') if not addon: bpy.ops.preferences.addon_enable(module="rigify") else: bpy.ops.preferences.addon_disable(module="rigify")


0

Blender addon utils module can fetch the path of any given addon name if installed. #iterate through all the addon name installed #if The Addon Name exists then: #.__file__ will give away the file path where it is installed #We are printing the file path in console #If the given name does not exist it will pass import bpy import addon_utils for mod in ...


3

Here's another answer: get rid of the variable for the number of objects and the button for adding a new slot. Instead just show all the slots up the last filled one, plus one more (up to a max of 3). Simpler code, simpler UI. class ADDON_PT_main_panel(bpy.types.Panel): bl_label = "addon" bl_idname = "ADDON_PT_main_panel" ...


4

You shouldn't use global variables or reloading scripts. First, you need to put all your state somewhere Blender can keep track of it. So you should handle the number of items just like the other properties, with an IntProperty. Here's an example with three object properties. class ADDON_pointers(bpy.types.PropertyGroup): num_objects: bpy.props....


2

You can just append to the list, but since the items list is set only once, the list will be static and not respond to new or deleted objects. You can get a dynamic list by giving a callback as items but there's a known bug with that (there's a warning about it in the docs). Instead I think you should use a PointerProperty. You can use the poll argument to ...


0

As you build the lists, fill them out with the tuples: object_list = [('None', 'None', '')] camera_list = [('None', 'None', '')] light_list = [('None', 'None', '')] for obj in bpy.context.scene.objects: if obj.type == "CAMERA": camera_list.append((obj.name, obj.name, 'camera')) if obj.type == "LIGHT": ...


4

The Python API changed in 3.0 and the addon needs to be updated. You should report the problem to the addon author so they can fix it. Specifically the second arg to user_resource is now keyword-only so this line addons_path = bpy.utils.user_resource('SCRIPTS', "addons") needs to become addons_path = bpy.utils.user_resource('SCRIPTS', path="...


1

addon_utils.enable by default runs the addon code as if you pasted it in the text editor and hit run: it runs the register function and you can use the addon, but it doesn't change the check boxes in Preferences>Addons or create an entry in bpy.context.preferences.addons or anything. However, it appears that Rigify cannot be run like this. It always ...


3

your are comparing with bpy.context.object instead of object. So it does not take the loop object into account. so the correct code is: import bpy camera_list = [] light_list = [] object_list = [] for object in bpy.context.scene.objects: if object.type == "CAMERA": camera_list.append(object) if object.type == "LIGHT"...


2

You can list all of the objects in the scene with for object in context.scene.objects: print(object.name) since context.scene.objects contains all of the objects in the scene. If you only want to list each material once material_set = set() for object in context.scene.objects: for material in object.material_slots: material_set.add(material) ...


1

Go back a couple of directories to https://github.com/Radivarig/UvSquares, and from the Code menu select Download Zip That will download UvSquares-master.zip. Go to preferences -> Add-ons, select install and then select that file. Once it's installed it'll show up and you can enable it.


1

There is a fix - I just had the same problem after starting a tree. After saving and reopening the file, the add-on nodes went blank just like yours. In this discussion you can download a fix for it. I've installed it and so far the add-on appears to work just fine. However, the add-on didn't work with the tree I was working on, so you might have to start ...


1

For anyone with this problem, it appears to be an issue with Blender Python API side, and there's a fix. Link found in this discussion


0

If you are interested in the Python part of the UI, in your blender installation there is a subdirectory scripts that contains subdirectories containing the Python code for addons, the UI, and other things. (On Windows 10, in a 'standard' installation, for 2.93.x this directory is C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts.) As you say, ...


2

As stated by Chris in comment - addon can't do that, but you can get this result by ... Use Plane Subdivide Triangulate add Edges Split modifier with angle zero add Solidify modifier 2m Apply modifiers Separate by Loose Parts Set Origin to Geometry


0

This question was answered by Jan-Willem van Dronkelaar, @jwvdronkelaar on blender.chat: http://drive.google.com/file/d/1PVS2eSjI1oyF7_JsBYSs8g-nevj29nz-/view?usp=sharing The solution: Select Armature, click Rest Position Go into Edit Mode for mesh of character Highlight the vertex Press Shift+S > Cursor to Selected Switch to Object Mode Shift+A to add ...


1

The problem is in the first line of the error message: TypeError: PointerProperty(...) expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered) You have to register before you can assign it as a pointer property


Top 50 recent answers are included