Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Python is an interactive, object-oriented programming language. In Blender, it is used as a general-purpose scripting language and to create add-ons to extend Blender's functionality.
1
vote
1
answer
165
views
Error: Object 'Sphere.022' has no mesh data to be used for ray casting
I am getting above error when trying to obj.ray_cast() from a copy of an object:
obj = bpy.data.scenes[0].objects["Sphere"].copy()
is_hit, hit_loc, hit_normal, index = obj.ray_cast(localA, localB)
…
1
vote
1
answer
175
views
Python: Object custom property glitch
I have the following custom prop:
class Settings(bpy.types.PropertyGroup):
enabled = False
state = {
"some_data": None, # edit: this points to numpy array
"some_other_data": …
0
votes
2
answers
431
views
How to use mathutils.noise.hetero_terrain?
I am not sure what I am missing, but all I get is a value of 1 on every return..
value_texture = numpy.zeros((100 * 100), dtype=numpy.float32)
for y in range(100):
for x in range(100):
lo …
0
votes
How to use mathutils.noise.hetero_terrain?
This works:
value_texture[loc] = mathutils.noise.hetero_terrain((x*.01, y*.01, 0), 1.0, 2.0, 1.0, 1.0, 1)
6
votes
Accepted
Using overlap() to check if two meshes are intersecting?
Turns out I had to apply location to the BMesh I generated, I have edited code above to work:
bm1.transform(scene.objects[obj_now].matrix_world)
bm2.transform(scene.objects[obj_next]. …
0
votes
1
answer
136
views
Python - How to detect when user opens another file inside Blender?
Edit: I think I have found what I was looking for bpy.app.handlers.load_post, but will leave it open for maybe better suggestions.
I have a class variable that is stored in bpy.types.Scene.my_class, w …
0
votes
Python - How to detect when user opens another file inside Blender?
Using a handler to remove my_class:
from bpy.app.handlers import persistent
@persistent
def handler_new_scene(scene):
del bpy.types.Scene.my_class
I think del scene.my_class will work also, or s …
0
votes
0
answers
16
views
Custom Nodes as Assets
Does anyone know how to extend custom nodes to support asset drops from the asset browser? If you go to the script templates > Custom Nodes sample and run it. You can add this custom node tree as an a …
11
votes
4
answers
7k
views
Using overlap() to check if two meshes are intersecting?
This is a follow up to How to check if two meshes intersect in python with BVH Tree?
It appears that just calling overlap() on the BVH tree of two objects is not enough. …
1
vote
1
answer
156
views
Python - Assigning vertex weights is extremely slow
Current very slow method (code reduced):
obj = bpy.context.active_object
vgroups = obj.vertex_groups.new(name="test_layer")
for loop in obj.data.loops:
vindex = obj.data.loops[loo …
0
votes
0
answers
319
views
Python: How to link custom node tree to object (like shader nodes)?
If not explicitly defined, the python class name is used. … If not explicitly defined, the python class name is used. …
1
vote
0
answers
419
views
Python - get RGB value from face with generated texture
I just began learning Blender Python API, not sure if what I am asking is possible. I want to write a script to distribute objects on the surface of a mesh based on RGB value of a generated texture. …
1
vote
1
answer
120
views
Is it possible to update image texture by using image buffer pointer?
I also tried calling image.update() and image.pixels.update() on the Python side hoping for a miracle lol.
void EXPORT set_all_pixels_to_white(ImBuf *buf) {
float *pixels = buf->float_buffer.data; … >x * buf->y * buf->channels;
for (int i = 0; i < num_pixels; i += buf->channels) {
pixels[i] = 1;
pixels[i + 1] = 0;
pixels[i + 2] = 0;
pixels[i + 3] = 1;
}
}
Python …
1
vote
1
answer
377
views
Generated image data disappears
The issue I am having is that at some point, randomly, the pixel data I generate and assign to an image disappears. This usually happens after several large images and pixel data have been created. Th …
4
votes
1
answer
21k
views
How to completely delete an object through python?
How to completely delete an object without using:
bpy.ops.object.delete()
bpy.ops methods are too slow for my script, so far I am able to delete an object with a simple:
del obj
But Blender does …