New answers tagged

1

I think it's not possible. It looks like the hard caps are not respected for inputs and outputs in shader node sockets. Also, it seems it's not possible to change the caps through the Python API, since those attributes are read-only. The value validation is obscure, as explained there for instance : https://devtalk.blender.org/t/node-properties-seem-to-miss-...


2

Loosely following the example of the "Math" node in the C code (rna_nodetree.c, line 177— Warning: File is huge.), it turns out that the items in an EnumProperty are sorted into columns by the 1th index (name) of the most recently preceding item that has neither a name nor a description: bpy.types.Scene.TestProp = bpy.props.EnumProperty( items =...


0

Well, I got a friend to look at it and this solved my issue. I think a more practical version requires matrices, but I was able to solve it with the following #assign rotations to be Euler XYZ ob.rotation_mode = 'XYZ' ob2.rotation_mode = 'XYZ' ob.rotation_euler = ob2.rotation_euler ...


0

Apparently, my problem was that my triangular plane didn't have any thickness. So, the solution to my triangular plane being messed up when I apply the intersection is to apply a solidify modifier before. It's very important to apply the solidify before the boolean modifier otherwise, it won't work. If you replace this code with the one where I apply the ...


0

there is an Addon to do that: https://github.com/nangtani/blender-import-lwo/releases


1

This is a workaround and I hope there is (or will eventually be) an easier way to access point cloud data in the API. Instead of instancing points, create a new object, eg. a cube, go into edit mode, select everything and right click > Merge Vertices > At Center. That way you have an object with a single vertex at world origin. In your GN tree add a ...


0

Well, I figured out how to work around this. Instead of using the armature modifier, I set my armature as a constrain. Then when I perform the boolean everything works as intended. I'm pretty sure it has to do with the hierarchy in the modifiers panel. Anyway, I'm happy it's working now and that was the solution in case someone else is having trouble with it....


2

No, .link_edges and .link_faces don't seem to have any particular order guarantee. A counterexample is readily produced by extruding the top face of a default cube and merging the new face into a single triangle fan: >>> [i.index for i in bmesh.from_edit_mesh(C.object.data).verts[1].link_edges] [12, 13, 14, 15] >>> [i.index for i in bmesh....


0

I don't think this is possible in standard Blender or any add-on I know of. Writing such a script could certainly be done. A useful workaround might be to put the faces in top and bottom areas into a Face Map. Select the edge loop, then click Deselect for the Face Map. You can select the top and bottom areas easily by selecting one face from both, pressing ...


0

You probably don't want to use the system python with blender. The version of python that comes packaged with Blender has the python bindings for that version of blender (bpy) already installed. If you suddenly use the system python, blender is probably going to break if you want to install a different version, and definitely won't work if you want to use it ...


-1

In the case of Python API you can try 1 or 2 .for general case try only 1 Downgrade blender to blender==2.79 it would work https://blenderartists.org/t/solved-run-blender-without-the-in-ubuntu/458966 You can update your script according to blender version >2.79 https://blenderartists.org/t/2-80-cheat-sheet-for-updating-add-ons/1148974


2

Quick and dirty workaround : Navigate to your blender installation folder. Open "2.**/scripts/addons/io_scene_obj" folder and open import_obj.py in your favorite text editor. Press CTRLSHIFTF to bring in the Search & Replace tool. Replace print( by if False: print( for all occurences in file. This will neutralize all outputs to the console. ...


0

this works for me: if modifier.type == 'FLUID': if modifier.fluid_type == 'DOMAIN': print("baking fluid %s %s"%(modifier.type, object.name)) override = {'scene': scene, 'active_object': object, 'point_cache': modifier.domain_settings.point_cache} bpy.ops.ptcache.free_bake_all() ...


1

Starting with 2.93, non-annotation properties are no longer supported. In previous version it would output a (cryptic) warning in the console : See the related commit The solution is to replace = by : in the property definition. L.58 : spline : bpy.props.BoolProperty(name="spline", default=False)


1

I got to know the answer from one of the Chief Software Architect at Blender If anybody, like me, is stuck trying to figure this out, and find this thread. The answer is NO, you cannot do it using python API. Instead, you need to go for either node groups or OSL... https://devtalk.blender.org/t/how-to-access-the-data-from-a-node-socket-for-processing-it/...


4

there might be more elegant solutions, but looks like mine works now ;) the driver (i just put in on x-location for testing) looks like this: The driver is responsible for the viewport render changes. and this: bpy.app.handlers.frame_change_post.append(my_handler) is responsible for the render frame changes (F12). Here is my python script: import bpy from ...


0

The UI for a custom property is described by a dict object, stored in a special/hidden _RNA_UI property. The internal blender addons tend not to access _RNA_UI directly, but use the rna_prop_ui.rna_idprop_ui_prop_get function to get or create the relevent "ui" object. import bpy context = bpy.context obj = context.object from rna_prop_ui import ...


1

try this: import bpy import math scene = bpy.data.scenes["Scene"] mycube = bpy.data.objects['Cube'] mycube.rotation_mode = 'XYZ' scene.frame_start = 1 scene.frame_end = 100 mycube.rotation_euler = (0, 0, 0) mycube.keyframe_insert('rotation_euler', index=2 ,frame=1) mycube.location = (0,0,0) mycube.keyframe_insert('location', index=1, frame = 1) ...


4

From the documentation : Some properties are converted to Python objects when you retrieve them. This needs to be avoided in order to create the subscription, by using datablock.path_resolve("property_name", False): subscribe_to = bpy.context.object.path_resolve("name", False) The callback doesn't work because in subscribe_to = bpy....


2

Look at the value of the driven property. In the example given in question, the bevel modifier width of one cube is being driven by that of another. Have set up similar, the driver value being displayed via UI is 0.2 Given the object of interest has context, retrieve this value by simply >>> bm = C.object.modifiers['Bevel'] >>> bm.width 0....


0

Step 1: Redirect the output to the python console. You can use the following codes written by @batFINGER (https://blender.stackexchange.com/a/93746/101378): import bpy from bpy import context import builtins as __builtin__ def console_print(*args, **kwargs): for a in context.screen.areas: if a.type == 'CONSOLE': c = {} c[...


2

Try this, it affects all selected objects. import bpy for ob in bpy.context.selected_objects: for ms in ob.material_slots: if ms.material and ms.material.users > 1: ms.material = ms.material.copy() Note that it may not do what you expect if an object has two slots with the same material.


2

The case in your picture can be done like in_soc = your_principled_node.inputs['Base Color'] # example if in_soc.links: from_node = in_soc.links[0].from_node your_material.node_tree.nodes.remove(from_node)


6

Bounding box coords of all meshes in scene. Pretty sure this has been answered before, but finding it is another matter. Here is some numpy code I use to create a bounding box for all mesh objects in a scene Basically, list coordinates of all bounding box coordinates of all mesh objects in the scene. Use the minima / maxima of each axis produce an axis ...


1

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements. Here's a small template for 'Shader Editor' to mess around: import bpy class SuperSimplePanel(bpy.types.Panel): bl_label = "The label of this panel" bl_idname = "NODE_PT_ThisSimplePanel" # This is new bl_space_type = '...


1

Using the 3x3 matrix rotation part. Does a child object inherit the matrix from the parent? Can decompose a matrix via Matrix.decompose() loc, rot, scale = M.decompose() the rotation is given as a quaternion. There is no guarantee that that the same rotation matrix will be returned when converting that quaternion back to a matrix. https://en.wikipedia.org/...


0

If not defined via UI. The answer from https://blender.stackexchange.com/a/24004/123064 used in other answer will work for properties defined by the UI, or with the "_RNA_UI" key set. It is used for adding extra details to the property like min, max description, etc It will not pick up on properties defined using ob["foo"] = 3 Using ob....


1

a = bpy.context.object.animation_data.action frame_start, frame_end = map(int, a.frame_range) Test on my own data:


1

bpy_collections. Blender uses a collection that can be accessed like a dictionary (string key) or like a list (integer index) The name of the object in the collection is also its keys. For a collection the names of all objects in the collections can be gained quickly via the collections keys. D.collections.keys() (D.collections.values() is the values, and ....


0

I could get it to work like I need it. I had to select the above parent-collection and found some example code to implement and now it works. I use the STEP-importer Plugin STEPper from ambi to import CAD-data and I need the correct hierarchy in the exported GLB-File and collections are exported without hierarchy. I try to animate and show assembly groups ...


1

I think you would be better off leaving the model in blender. Blender has its own API, which I have considered using for just such a purpose (but I haven’t felt motivated to do the phoenome research neccesary). You could save mouth positions as poses, and then apply them with Python and set keyframes at the desired places.


6

Define a plane by a point on the plane and its normal. For example sake using 4 coordinates of plane as 4 points that make up the plane. >>> ob = C.object >>> ob bpy.data.objects['Plane'] >>> mw = ob.matrix_world >>> points = [mw @ v.co for v in ob.data.vertices] Only need 3 points, $(a, b, c)$ to define a plane. All of ...


2

I had a similar problem as your second point. Solved it like this: threeD_viewport = None for area in bpy.context.screen.areas: if area.type == 'VIEW_3D': for space in area.spaces: if space.type == 'VIEW_3D': threeD_viewport = space threeD_viewport.shading.type = 'MATERIAL'


0

There is already a solution to copy custom-properties to and fro objects? https://blender.stackexchange.com/a/24004/123064 import bpy ob_sel = bpy.context.selected_editable_objects ob_act = bpy.context.object try: props = ob_act["_RNA_UI"] except KeyError: pass else: for ob in ob_sel: if ob == ob_act: continue ...


3

All available via blenders rna. The type property of the modifier is an enum, can look up its definition via blenders "rna" system on the class, in this case bpy.types.Modifier.bl_rna import bpy from bpy.types import Modifier for item in Modifier.bl_rna.properties['type'].enum_items: print(item.identifier, item.name, item.description, item....


0

i recommend you watching some python basic tutorials. Indentation is an essential part of the python language. And if you don't understand what it does, you will never understand python code. try this: import bpy text_file = open("C:\\Users\\nabuc\\Desktop\\1700txt - copia.txt", "r") lines = [] #Read in contents to a list for line in ...


5

I'd suggest read the values and create a dictionary out of point positions per frame, which allows to structure as well as access the values in a reasonable way: dict = { frame_number : [ (LOC_X, LOC_Y), (LOC_X, LOC_Y), (LOC_X, LOC_Y), ... ] frame_number : [ (LOC_X, LOC_Y), (LOC_X, LOC_Y), ...


2

I think this works (after running, a new text block should appear with a script restoring the curves): import bpy, json save_name = "load_blur_curve.py" D = bpy.data curves = {} for name, scene in D.scenes.items(): curve = scene.render.motion_blur_shutter_curve.curves[0] curves[name] = [(p.location.x, p.location.y, p.handle_type) for p in ...


Top 50 recent answers are included