text:
Render Material Ruined by Blender 3.4 upgrade to 4.2
A large project I have been working on is near completed. I am on my final rendering of my last model and for some reason every single blender file on my computer is now a 4.2 file, even tho I have been working with them in 3.4 for over a month now.
As a result, my render material is now broken, my renders have lines going through them and the lighting is absolutely off.
Is there any way to revert my files back to 3.4?

Have you saved from 4.2 and overwritten the old ones with the new version?

An older version doesn't just magically save in future format. In any case, there should be autosaves that you can access from File menu -> Recover -> Auto Save... . By default Blender also saves .blend1 file when you save. That is the previous save, so you can rename the extension or just open those files in Blender. If you saved multiple times from a newer version without making sure the files are fully compatible... well... that's a very unpleasant mistake... that YOU made.

No it is unfortunately not a mistake I made. I just reviewed files from over a year ago, and sure enough they all say 4.2 and all of their rendering materials and lighting is broken. The only files that were safe were files that were compressed into zips, when I extract them and open with 3.4 they are fine. Everything that was NOT in a zip is now a 4.2 file type and borked. NOT and mistake I made in fact.
We are talking about HUNDREDS of blender files on my computer all updated to 4.2 and even when opening in 3.4 they are already compromised.

They all "say" 4.2, meaning ? if you go in the outliner,  "data API" mode, unroll "version", it says 4.2 ?

I was able to extract an 3.4 file from an old zip and append the materials and lighting into one of the 3.4 files that was damaged and marked 4.2 (even tho ver is 3.4 when opening in text doc) and salvage my work for this project.
Something strange certainly happened and I believe it has to do with windows default program and my %temp% files I cleared out yesterday.

By "they say 4.2" I mean file type in windows, however when opening them with text editor they say 3.4 still.

The version of a blend file is indicated where I said just above. Windows explorer just shows you the default program associated with those files. It doesn't mean they have been saved with this version.

Correct, I have also launched my previous files manually to 3.4 and yet they are still borked.
Yesterday they said 3.4, today 4.2 next to the file type
Im sure its just windows default application like you mentioned, however I can no longer open them in 3.4 without them being bugged.
for over a month I have been working with 3.4 and 4.2 respectively.
I believe it was clearing out my %Temp% files yesterday that caused this issue to occur.
ALl of my files are now acting as if they are 4.2 which is where I discovered my material and lighting doesnt currently work in.

When I discovered this issues early last month, I simply continued working in 3.4
But not ALL of my files have this issue now, even when opening in 3.4 This is when I noticed file type was updated. Even on files from years ago.

It is still a bit unclear what you are doing there. What do you mean you "can no longer open them in 3.4 without them being bugged"? Have you opened them in 4.2 and saved them in this new version? A 3.4 file will not automatically become a 4.2 file if you do not save it with 4.2, so if you did that unfortunately @MartynasŽiemys is right, that's a mistake you made. We also do not know what you have in those files in detail - some things have changed, some have not. If a file contains only things that work in both versions it may not seem broken, while others simply get messed up.

.blend files are not marked with any version information in any way recognizable by Windows OS.
As you can see I have .blend files in various Blender versions I happen to have saved in one folder:

You can clearly see that they are all recognized as "Type Blender 4.3". This is because Blender 4.3 is the version I registered as software to open .blend files in my Windows. That's all. That does not mean anything else at all.
You can find out the version of file format by opening the file, going to the Outliner and setting it to Data API display mode. You will be able to view Version there:

Note that this is not Blender's version, but the version of the file format. X and Y numbers usually are a good indication of what Blender version was used to save the file. As you can see, my file's version is 4.3.32 even though the Blender version I use is 4.3.0 - that's normal, because file data version and Blender version are different things apparently.
You can just open Blender version that you want and then open the files from that Blender using File -> Open and they should open fine if you use the correct Blender version matching the file's version. Unless of course you made the unfortunate mistake and did save the files when opened in the newer version. In newer Blender versions there is also a choice to quickly register the currently open Blender version as Default in the OS:

You can of course use the OS features to set default software to open .blend file type or you could look into this Blender Launcher program that people seem to recommend for working with multiple versions, but I haven't tried it myself so I have no idea what it really does or if it's worth it - decide for yourself.

I'm using Blender Launcher, cool little piece of software - though it weighs 50 MB + another 46 MB for the updater, perhaps they use Electron, ugh.


text:
Exporting X & Y coordinates to file
Im trying to export X & Y coordinates of certain object to file with this script I found years ago somewhere:
import bpy

def write_some_data(context, filepath, use_some_setting):
    print("running write_some_data...")
    camera = context.active_object
    mw = camera.matrix_world
    scene = context.scene
    frame = scene.frame_start

    f = open(filepath, 'w', encoding='utf-8')
    while frame <= scene.frame_end:
        scene.frame_set(frame)
        x, y, z = mw.to_translation()
        rx, ry, rz = mw.to_euler('XYZ')
        f.write("%d" % frame)
        f.write(", ")
        f.write("%5.3f, %5.3f" % (x, y))
        f.write("\n")
        frame += 1
    f.close()

    return {'FINISHED'}

It almost works, but output looks like this:
0, 0.510, -0.370
1, 0.518, -0.190
2, 0.524, -0.010
3, 0.536, 0.177
4, 0.544, 0.365
5, 0.553, 0.548
6, 0.559, 0.730
7, 0.568, 0.912
8, 0.575, 1.094
9, 0.575, 1.283
10, 0.574, 1.471

My purpose is to save X & Y positions inside area of 512,512px (rendered 2D size) and output should have coordinates between 0 - 512px. I dont know python or scripting well, been looking for answer for couple of days now.

Don't edit in "SOLVED" into your question, instead "accept" the answer by clicking the button near the up arrow for voting up (you may vote up the answer as well).

You can get the location coordinates of an object called 'Cube' with the following code:
import bpy

scene = bpy.context.scene
cube = bpy.data.objects['Cube']

f = open(filepath, 'w', encoding='utf-8')

for frame in range(1,scene.frame_end):
    scene.frame_set(frame)
    x, y, z = cube.location

    f.write("%d" % frame)
    f.write(", ")
    f.write("%5.3f, %5.3f" % (x, y))
    f.write("\n")

    print(frame, x, y, z)

f.close()

Thanks for reply. I get error "filepath is not defined" from that script.

You need to define a filepath elsewhere in your script. This you can for example do by, on the line before f = etc., write
filepath = "C:/tmp/output.txt"

Almost works, but output is "1, 0.000, 0.000" all lines. Im using object called "Tracker1" that is "empty cube" and it has Object Constraint: Child of vertex im tracking.

Got it working! Had to "object -> bake action -> visual keying:on" I still must calculate the real x and y values from meters but the aspect ratio seems right.

Would be better to use a context manager to write to a file.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Seeing through high-res wireframes
Sometimes when working with high density meshes (like sculpting in multires, which is my case) in wireframe mode, there are so many edges that I can barely see through the model, making it very hard to check background images and objects behind it.

Is there a way to work with a simplified wireframe or is there some other see-through mode I'm not aware of?

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Problems with Windows Aero Theme
So I have this strange bug where the Windows' Aero Desktop Theme gets switched on and off everytime I open and close Blender. It's not that much of a deal, except that some animations I'm used to get somehow laggy and the overall color is much brighter (I pick dark colors/transparency on Aero for eye health).
I never really had this kind of problem before, but this has been happening since I formatted my pc and reinstalled Windows 7 and Blender again.
All drivers and software versions are up to date. I'm using a GTX 750 ti with Windows 7 Ultimate 64bit and Blender 2.77a.

Turns out it was a Nvidia Driver issue (I was using v.372.54) even though their online support denied so.
Downgraded to v.368.81 and everything is back to normal :D

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Using variables in Logic Editor
I'm quite new to Blender's game engine, but I'm trying to give it a go now.
My first try was to create a simple WASD keys character movement using the logic editor.
For that, I needed to set the Loc (location offset) in the motion actuator for each keypress, but since they would be all the same value, and I could want to change them at a later time, I wanted to use some kind of variable to control it, like "character_speed". I know this seems like an overkill, but I'm thinking ahead for keeping things organized for bigger projects.
Is there support for something like that? Maybe using python scripting or drivers?
Thank you!

There's nothing wrong with thinking ahead!


text:
Unselectable Object in Outliner in 2.8
I've been fiddling with Blender 2.8, collections and parenting and I can't remember exactly how I was able to make this happen, but I have this empty object that has an animation that keeps affecting objects (which use it as a constraint) but can't be found anywhere in the "Scene" outliner, nor in the 3d view and isn't hidden and can't be selected or edited in any way!
The only place where I can see a reference to it is in the "Blender file" tab in the outliner as shown in the screenshot and the constraints dropdowns of other objects its affecting. Mouse clicks on this object in the outliner yields no effect... is this a bug or am I missing something?

You should upload the blend file so that people can take a closer look.

Seems like the empty object lives outside of any Scene. You can use the command line (python window) to link it to any scene or delete it.

As @JaroslavJerrynoNovotny said, you can check if the data is unlink in the properties panel with selecting view type from View Layer to orphan data in the header bar.

@Syler If you're going to suggest they upload a file, it's important you mention where they should upload it, e.g. https://blend-exchange.giantcowfilms.com/

I wasnt able to upload the file. How can I do it through command line? Couldn't find docs ._.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
LoopTools Circle Bug
I don't know how old is this bug, but it seems that the circle tool on LoopTools addon is giving weird results:

All vertices are coplanar and no transforms exist on the object. How is it possible that some selections turn into the same plane and others don't? (selecting one by one and applying the tool gives the same result)

More information about your object, or a gif of this occurring might help to determine why this is happening. The operator works fine on my system. Sometimes setting pivot point to individual origins (Ctrl+.)seems to be useful, although not necessarily needed I guess.

it's not model-related. I tried the simplest thing: creating a plane on an empty scene and giving it a try. surprisingly, it only works if the plane is facing the Z axis. after rotating it and applying rotation in any axis, it stops working properly. I'm using blender 2.79 (2017-09-11 10:43 release)

So far as I understand, there are 5 possible reasons:
1.) LoopTool's Circle menu settings may be the culprit:

The settings used restrict it's alignment. Try other combinations.
2.) Duplicate vertexes and/or lines. LoopTool's tools depend on nearest-neighbor objects. This may indicate that the mesh needs cleaning.
3.) Multiple plugins may cause undesirable operation. Try removing other enabled plugins and try again.
4.) Possible driver conflict. Verify that the drivers your system is using is compatible and up-to-date. You might also need to use an older version of a compatible driver for stable operation.
5.) Faulty Blender - A fresh installation of Blender may be needed. Also verify the storage device you load it from is in good condition, and is properly connected.


text:
Workflow between Blender and Max
I've recently started to work for a company that uses 3ds max and Vray as their main softwares. I know 3ds max, but it has an incredibly slow workflow and things need to be done quickly, so I run to Blender to model, than export to FBX, import into 3ds max and apply the vray materials.
It works well, unless they require modifications in the models, then I have to do the whole dance again: change, export, apply mats, etc, multiple times until it gets approved. I can't use linked files because they use custom scripts that won't work with them.
So, my question is: is there a better way to achieve what I need? Maybe a faster workflow? Is there a way to set vray mats in Blender and then export to max?
Thanks!

Do you use 3DS Max only for rendering? I believe there is a VRay plugin for Blender, maybe that way you could skip whole export process. Would that speed things up? As it stands this question sounds too vague and broad.

No, actually I send over to them via a custom 3ds max script and later it gets rendered by someone else. I wish I could do everything in Blender, but I need to export to max with vray so they can do their thing hehe

My advice would be to get good with Max, so you can be as productive there as in Blender. Chances are you will find you can be even more productive and faster in Max.. My other advice if you need to stick with both Blender and Max is to automate the pipeline with python. I don't think there is much else you can do..

@Jerryno I guess I'll have to find a way through python. There's no way I'm modeling in that prehistoric software.

There is nothing prehistoric about it, 99.9% of it's code is newer than Blender's. It is Blender who is relying on prehistoric code and non-optimized open-source libraries. I think you have serious prejudice, have a look how fast modelling in 3Dmax is: https://www.youtube.com/watch?v=cx64lj5aboo and maybe you can be faster than with Blender, since Max's tools are more advanced and better optimized.

I may have expressed myself wrongly, my problem with max is not tool quality, but the software itself is terribly slow. I often open a max file and go to the bathroom to try to optimize my life a bit for instance hehe. No prejudice here, I work with it everyday. (btw, it's been a while since I modeled anything on it... it has definitely improved wonders on that matter, judging by the video)


text:
Coloring volumes based on original point attributes
I have a grid point field as a result of cfd simulation. Each point has its own col attribute. I am trying to convert this field into a volume and color the volume based on the original attributes in geometry nodes so that I can nicely visualise the results. Converting the points into a volume is not a problem, however I can't seem to be able to keep the attribute. (I get it. The volume does not have the same amount of points than the original but I think it could be solved by distances from the original points)

When I color the points by attribute it works fine but only when coloring surfaces, not volumes.

The same goes when I try to convert the points into volume and then color it (which is ultimately my goal)

Can anyone tell me a way how to handle this? (or if it is currently even possible?)
UPDATE:
Ok so I am still looking for a solution. The closest I got was by splitting the data into separate instances of volumes with specific color that are overlapping its neighbours. Thanks to that the emission blends together creating an illusion of a gradient which works for me. It looks like this:

Now the problem is the overlapping volumes create glitches on voxel contact. Anyone has any ideas how to get around it? Increasing voxel amount in each volume kinda helps (the voxels are smaller) but it is still not ideal. (it's getting close tho). For example, is there a way to set alternating 'zero' point from which the voxels are created? there would be no face overlap and the glitches should disappear
Glitch illustration:

How about using a Point Density texture? The 'points' would need to be converted into a mesh with the colour of each vertex set to be the colour of that point in your simulation. You can then feed the colours from the point density into the volume. Do you have some sample data available in order more easily create an answer that's specific to your situation?

One potential solution (not using Geometry Nodes) could be to use a Point Density texture to colour the volume. This would require the simulation data to be converted into a mesh with the colour information encoded as Vertex Color.

I don't know if this is ultimately applicable to your situation but if you can provide more information (and preferably some example data) then I can update this answer to be more specific.
Here's an example after tweaking the Point Density and increasing Light Paths/Max Bounces/Volume to get a better representation of the colours (the lack of volume bounces will significantly dull the colours otherwise).

Oh yeah!! I'll look into it, but it seems like this is exactly what I need. I don't really need to use GN, it just seemed like the best approach. Never heard of point density node before:))

Now the question is. My simulation data are spearate mesh planes filling test geometry along z axis (when I get to it, I'll upload a sample). it is one mesh but it does not have any volume just planes. Do I have to convert them into voxels before in order to make it work?

Basically it is spatial data, not surface data

Separate planes are fine, provided they're part of the same mesh; only the vertices themselves are actually required (so don't even need edges or faces, although the faces would be useful to be able to visualise the vertex colours when in mesh vertex paint mode).

I tried your approach and I am more and more convinced it is what I am looking for. Unfortunately for some reason the point density node wont load the attribute of selected object. I tried both to store it using GN and use that and also tried baking it first. I am sure the attribute is there, I can see it in object data properties but whatever what I do the list in point density node is empty

Are you using Eevee or Cycles? I know Eevee didn't used to support Point Density.... not sure if that's still the case or not.

Cycles but it doesn't work for me in neither. I am using blender 4.0, also tried 3.5 with the same result

Interestingly enough, when I create a new vertex group and use that as a color source instead of vertex color it appears in the list:) you think it could be a bug?

I have seen it where it doesn't automatically refresh unless you switch out of 'Rendered' mode and back again... could it be something like that going on? It's difficult to say.

Yes - I've had a bit of a play around and I think you have spotted a bug. I also can't see anything in the list but if I vertex paint without first adding a Color Attributes slot then Blender creates one automatically named 'Attribute' and it works fine in the Point Density texture with source attribute left blank (and I can't change it to anything other than blank - unless I pick Vertex Weight, for example). I'm using 4.0.0 Alpha so the problem might already have been fixed in the 'latest'. However, if it does exist in the daily build you should report it as a bug.

Ok, so I think I've figured out why the Vertex Attribute list is blank; there are actually now different 'types' of color attributes - it can be either by vertex or face corner and stored as either 32-bit RGB or byte RGBs. The old Vertex Colors used to be stored as bytes against each face corner and the list only permits those same types. The Color Attribute shows the type to the right of the name and the menu arrow at the right of the panel lets you convert from one type to another. Changing it to Face Corner>Byte makes it selectable in the Point Density node.

You are right Rich:) and it works so big thumb up! Anyway there are 2 more questions that came up. For some reason I cannot use the color that comes out of point density as a base color for principled volume (it's just white). It works only as emission color for some reason. The second is whether I can manage to keep the same colors (they get a bit changed) or whether it's the result of averiging the colors around and there is no way. I can always adjust it by hue/sat/val or sth like that so it's ok, just curious

Not sure why it's not working with Principled Volume 'Base' - I have it working using Blender 4.0.2. Perhaps it was broken at an earlier release...? Don't forget to attach the Density and include a Multiply to scale by, say, 100. You should set the Interpolation mode to 'Closest' in the Point Density so that it just uses one of the colors rather than mixing. Also, the default Light Paths doesn't include extra bounced in a volume and that can dull the colors a bit - increase Light Paths/Max Bounces/Volume to something like 10. With all of those I'm getting a very similar color in my volume.

Right I'll give it a try:) I thought the colors are due to emission rather than diffusion but I do not really care. Now I can completely deconstruct the domain of the color gradient that originally was in the simulation results and construct a new one so there is no problem there for me. No idea why the diffusion doesn't work with the colors tho, I have the exact same setup as you do (and same blender version)


text:
How to get the Intersection Surface and Vertices between Ellipsoid and Frustum and colour them?
I want to get the intersection between an ellipsoid and a conical frustum. The frustum axis always lies along the line-of-sight between its small-radius basis and the ellipsoid centre.
To do so I have first some utility functions
def get_r_dist(r1, div, dist):
    return (r1 + dist * div)

def point_in_conical_frustum(point, cf, direction, r1, div, h):
    v = point - cf
    proj_length = v.dot(direction)

    if proj_length < 0 or proj_length > h:
        return False

    r_dist = get_r_dist(r1, div, proj_length)
    perp_dist = (v - proj_length * direction).length
    return perp_dist <= r_dist

Then the construction of the ellipsoid and frustum
# ELLIPSOID
# =========
ce = mathutils.Vector((2.5, 2.5, 2.5))
l = mathutils.Vector((1.5, 1.0, 0.75))
nhor: int = 60
nver: int = 60
bpy.ops.mesh.primitive_uv_sphere_add(segments = nhor, ring_count = nver, radius = 1.0, location = ce)
ell = bpy.context.object
bpy.context.object.scale = (l.x, l.y, l.z)

# CONICAL FRUSTUM
# ================
cf = mathutils.Vector((0.0, 0.0, 0.0))
fru_direction = ce - cf
fru_direction.normalize()
r1: float = 0.15
h: float = (ce - cf).length
div: float = np.pi / 60.0
r2: float = r1 + h * div
bpy.ops.mesh.primitive_cone_add(vertices = 32, radius1 = r1, radius2 = r2, depth = h)
fru = bpy.context.object
up = mathutils.Vector((0.0, 0.0, 1.0))
rotation_quat = up.rotation_difference(fru_direction)
fru.rotation_mode = 'QUATERNION'
fru.rotation_quaternion = rotation_quat
fru.location = cf + fru_direction * (0.5 * fru.dimensions.z)
bpy.context.view_layer.objects.active = fru
bpy.context.scene.cursor.location = cf
bpy.ops.object.origin_set(type = 'ORIGIN_CURSOR', center = 'BOUNDS')
bpy.context.scene.cursor.location = cursor_origin

The intersection points are computed as
#INTERSECTION
#============
intersection_mat = bpy.data.materials.new(name = "IntersecMat")
intersection_mat.diffuse_color = (0, 0, 1.0, 1.0)
spheres_collection = bpy.data.collections.new("IntersecSphere")
bpy.context.scene.collection.children.link(spheres_collection)

i: int = 0
for vertex in ell.data.vertices:
    world_coords = ell.matrix_world @ vertex.co

    if point_in_conical_frustum(world_coords, cf, fru_direction, r1, div, h):
        bpy.ops.mesh.primitive_uv_sphere_add(radius = 0.015, location = world_coords)
        sphere_obj = bpy.context.object
        sphere_obj.name = f"IntersecSphere_{i}"
        spheres_collection.objects.link(sphere_obj)
        sphere_obj.data.materials.append(intersection_mat)
        i += 1

This works fine, but I am pretty sure Blender has some built-in capability to make the same thing as this script. Can you indicate me how?
Moreover, I would also like to have the whole surface intersection coloured. How can I achieve this?
EDIT
I was able to get the mesh of the intersection by using this code
# Select both objects
bpy.ops.object.select_all(action = 'DESELECT')
fru.select_set(True)
ell.select_set(True)
bpy.context.view_layer.objects.active = fru

# Join the objects
bpy.ops.object.join()

# Go in 'edit' mode
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_mode(use_extend = False, use_expand = False, type = 'VERT')

# Select vertices based on coordinates
bpy.ops.mesh.select_all(action = 'DESELECT')
joined_obj = bpy.context.object
mesh_joined = joined_obj.data
bm_mesh_joined = bmesh.from_edit_mesh(mesh_joined)

tol = 1.0e-3
for vert_joined_mesh in bm_mesh_joined.verts:
    if np.abs(vert_joined_mesh.co.length - r1) <= tol:
        vert_joined_mesh.select = True

# Link vertices
bpy.ops.mesh.select_linked(delimit = set())

# Enter knife mode
bpy.ops.mesh.intersect()

# Re-select vertices based on coordinates
bpy.ops.mesh.select_all(action = 'DESELECT')
for vert_joined_mesh in bm_mesh_joined.verts:
    if np.abs(vert_joined_mesh.co.length - r1) <= tol:
        vert_joined_mesh.select = True

# Link vertices
bpy.ops.mesh.select_linked(delimit = set())

# Delete the selected vertices
bpy.ops.mesh.delete(type = 'VERT')
bmesh.from_edit_mesh(mesh_joined)
bm_mesh_joined.free()

How can I automatically (i.e. programmatically) colour the complete intersection area in, say, yellow, and get the coordinates of all the nodes inside that surface?

https://blender.stackexchange.com/a/23434/53513

@aheuchamps  You can use the Boolean modifier to intersect two objects and then manually delete the unused faces.

@XY thank you for your answer! However, manually doing things is not an option as a second stage is to make the ellipsoid move in the scene, with the frustum oriented according to the (varying) line-of-sight. This means that the intersection surface will change at each frame.

@aheuchamps Maybe geometry nodes can do this animation.

@XY thank you for your answer. Is there no way to make it purely through a python script?

@aheuchamps Almost every behavior on the UI can be implemented in Python code, but it can be a difficult job.

@XY I was able to get the intersection, I updated the problem. Any clue on how to do the question after "EDIT"?

I think coloring objects and getting vertex positions are common questions and you can find answers in other posts.

As suggested in the comments, a possible solution is to use Boolean modifiers, and the delete the right parts.
To avoid any issue, first make a copy of each object
fru_copy = fru.copy()
fru_copy.data = fru_copy.data.copy()

ell_copy = ell.copy()
ell_copy.data = ell_copy.data.copy()

bpy.context.collection.objects.link(ell_copy)
bpy.context.collection.objects.link(fru_copy)

Then add the Boolean modifier and apply it
bpy.ops.object.select_all(action = 'DESELECT')
ell_copy.select_set(True)
fru_copy.select_set(True)

bpy.context.view_layer.objects.active = ell_copy
bpy.ops.object.modifier_add(type = 'BOOLEAN')
boolean_modifier = ell_copy.modifiers[-1]
boolean_modifier.operation = 'INTERSECT'
boolean_modifier.object = fru_copy

Enter in edit mode, select the vertices to delete, and delete them
bpy.context.view_layer.objects.active = ell_copy
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.mesh.select_mode(type = 'VERT')

bm = bmesh.from_edit_mesh(ell_copy.data)

tol = 1.0e-3
normal = (obj2_copy.location - obj1_copy.location).normalized()
for vert in bm.verts:
    world_co = ell_copy.matrix_world @ vert.co
    if np.abs((world_co - ce).length - r2) <= tol:
            if np.abs(normal.dot(world_co - ce)) <= tol:
                vert.select = True

bpy.ops.mesh.delete(type = 'VERT')

Create a new material for the intersection
intersect_mat = bpy.data.materials.new(name = "IntersectMat")
intersect_mat.diffuse_color = (1.0, 1.0, 0, 1.0)
if ell_copy.data.materials:
    ell_copy.data.materials[0] = intersect_mat
else:
    ell_copy.data.materials.append(intersect_mat)

Finally, set the intersection origin, update the mesh, and come back in object mode
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.context.view_layer.objects.active = obj2_copy
bpy.ops.object.origin_set(type = 'ORIGIN_GEOMETRY', center = 'MEDIAN')
bpy.ops.object.mode_set(mode = 'EDIT')
bmesh.update_edit_mesh(ell_copy.data)
bpy.context.view_layer.update()
bpy.data.objects.remove(fru_copy, do_unlink=True)
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.mesh.select_all(action = 'DESELECT')

These steps should give the desired outcome.


text:
What Blender type should be used for custom list of objects?
Lets say I have defined a new class
class MyNewObject(bpy.types.PropertyGroup):
    name: bpy.props.StringProperty(name = "name", default = "")
    minimum: bpy.props.FloatProperty(name = "min", default = 0.0)

    # Additional code not shown here
    # ...
    # ...
    # ...

Now, if I want to add an attribute storing a list of different objects (which could be a Blender Camera, or anything else, like another custom-defined object), what should be the bpy.props to use?

I would use either bpy.props.EnumProperty for general lists of "anything", or bpy.props.EnumProperty for objects, especially if they need to be defined by the user.

@L0Lock Good to know, thank you

I noticed in my previous comment I wrongly inserted the second link, it was supposed to be CollectionProperty x) but @Mr A's answer explains better anyway.

You would use a bpy.props.CollectionProperty(type=MyNewObject, name="Insert Name Here"). The type parameter should match your class name. You can check the docs for more information.

Edit: As mentioned in the comments, bpy.props.PointerProperty is also an option. This is its entry in the docs. There is also this example and this example which show how to use them. As you can see, the first is used when you just want one instance of your custom property, and the second is used when you have more than one.

What would the advantage(s)/disadvantage(s) of a bpy.props.CollectionProperty be with respect to the comment of @L0Lock here above?

enum props store strings when pointer property / collection property stores the adresse to actual objects

@aheuchamps As @Gorgious said, bpy.props.EnumProperty is incompatible with your custom bpy.types.PropertyGroup. Your options are bpy.props.PointerProperty and bpy.props.CollectionProperty. I will update my answer to include it.


text:
Python script to assign particle properties in function
I am trying to simulate a projectile leaving a barrel.
To do so, I have a cylinder (representing the barrel), an icosphere (representing the projectile), and a plane (which will serve as emitter).
A python script to realise those components reads
import bpy

# Create barrel
r_barrel = .5
h_barrel = 1.5
offset_barrel = 0.5 * h_barrel
bpy.ops.mesh.primitive_cylinder_add(radius=r_barrel, depth=h_barrel, location=(0,0,offset_barrel))
cannon_barrel = bpy.context.object
cannon_barrel.name = "Cannon_Barrel"

# Create sphere for projectile
bpy.ops.object.empty_add(type="SPHERE", location=1.5*cannon_barrel.location, radius=r_barrel)
emitter_constraint = bpy.context.object
emitter_constraint.name = "Emitter_Constraint"
emitter_constraint.parent = cannon_barrel
emitter_constraint.matrix_parent_inverse = cannon_barrel.matrix_world.inverted()

# Create particle emitter
bpy.ops.mesh.primitive_plane_add(size=2*r_barrel, location=emitter_constraint.location)
cannon_emitter = bpy.context.object
cannon_emitter.name = "Cannon_Emitter"
bpy.ops.object.constraint_add(type = "COPY_LOCATION")
cannon_emitter.constraints["Copy Location"].target = bpy.data.objects[emitter_constraint.name]
bpy.ops.object.constraint_add(type = "COPY_ROTATION")
cannon_emitter.constraints["Copy Rotation"].target = bpy.data.objects[emitter_constraint.name]

# Create an icosphere
bpy.ops.mesh.primitive_ico_sphere_add(radius=r_barrel, location=(2,2,0))
cannon_ball = bpy.context.object
cannon_ball.name = "Cannon_Ball"

I would like to create a function taking a given object as input (in this case, cannon_emitter), adds a particle system to it, and substitute the icosphere for the cannonball, i.e. something reading like (the following, of course, DOES NOT WORK)
def assign_particle_system(in_obj, assign_obj):
    in_obj.space_data.context = "PARTICLES"
    in_obj.particle_system_add()
    in_obj.particles["Cannon_Ball_Emitter"].name = "Cannon_Ball_Emitter"
    in_obj.particles["Cannon_Ball_Emitter"].emit_from = "FACE"
    in_obj.particles["Cannon_Ball_Emitter"].userjit = 1
    in_obj.particles["Cannon_Ball_Emitter"].normal_factor = 15
    in_obj.particles["Cannon_Ball_Emitter"].physics_type = "NEWTON"
    in_obj.particles["Cannon_Ball_Emitter"].mass = 1
    in_obj.particles["Cannon_Ball_Emitter"].integrator = "MIDPOINT"
    in_obj.particles["Cannon_Ball_Emitter"].timestep = 1/24
    in_obj.show_instancer_for_render = False
    in_obj.particles["Cannon_Ball_Emitter"].instance_object = bpy.data.objects[assign_obj.name] # substitute the icosphere for the cannonball
    in_obj.particles["Cannon_Ball_Emitter"].particle_size = 1

How can I implement the method taking an object to which a particle system is added, and another object for the substitution?

I managed to create such a function in the end.
It reads something like this (other parameters can, of course, be passed for more flexibility)
def create_particle_system(emitter, substitute_projectile) -> None:
    bpy.context.view_layer.objects.active = bpy.data.objects[emitter.name]
    bpy.ops.object.particle_system_add()
    bpy.data.objects[emitter.name].particle_systems["ParticleSystem"].settings.name = "Cannon_Ball_Emitter"
    bpy.data.objects[emitter.name].particle_systems["ParticleSystem"].parent = bpy.data.objects[emitter.name]
    bpy.data.particles["Cannon_Ball_Emitter"].type = "EMITTER"
    bpy.data.particles["Cannon_Ball_Emitter"].count = 4
    bpy.data.particles["Cannon_Ball_Emitter"].lifetime = 200
    bpy.data.particles["Cannon_Ball_Emitter"].emit_from = "FACE"
    bpy.data.particles["Cannon_Ball_Emitter"].userjit = 1
    bpy.data.particles["Cannon_Ball_Emitter"].normal_factor = 7.5
    bpy.data.particles["Cannon_Ball_Emitter"].physics_type = "NEWTON"
    bpy.data.particles["Cannon_Ball_Emitter"].integrator = "MIDPOINT"
    bpy.data.particles["Cannon_Ball_Emitter"].timestep = 1/bpy.data.scenes["Scene"].render.fps
    bpy.context.object.show_instancer_for_render = False
    bpy.data.particles["Cannon_Ball_Emitter"].render_type = "OBJECT"
    bpy.data.particles["Cannon_Ball_Emitter"].instance_object = bpy.data.objects[substitute_projectile.name]
    bpy.data.particles["Cannon_Ball_Emitter"].particle_size = 1


text:
Raycast - Why are the ray intersections not at the right location?
I have an ellipsoid and a conical frustum.
The ellipsoid is centred at cellipsoid, and the small-radius frustum base at cfrustum.
The frustum is such that its main axis is directed in the line-of-sight vector between cellipsoid and cfrustum.
The length of the frustum is that of the line-of-sight vector.
I want to get the intersection coordinates between the frustum and the ellipsoid.
To do so, I have two functions identifying the vertices belonging to the small-radius and big-radius frustum bases
import numpy as np
import mathutils
import bpy

def get_vertices_coords_base(frustum,cfrustum,r1):
    """
    Function returning the position vector of the vertices belonging to the small-radius conical frustum base

    Parameters
    ----------
    frustum : bpy.types.Object
        Blender object representing the conical frustum mesh
    cfrustum : mathutils.Vector
        Small-radius conical base centre position vector
    r1 : float
        Small-base radius

    Returns
    -------
    base_vertices : list[mathutils.Vector]
        List of position vectors of vertices belonging to the small-radius conical frustum base
    """
    # Get the vertices in world space
    base_vertices = []
    tol = 1.0e-3
    for vert in frustum.data.vertices:
        world_co = frustum.matrix_world @ vert.co
        if np.abs((world_co - cfrustum).length - r1) <= tol:
            base_vertices.append(world_co)

    bpy.ops.object.mode_set(mode = 'OBJECT')
    return base_vertices

def get_vertices_coords_top(frustum,cfrustum,r2):
    """
    Function returning the position vector of the vertices belonging to the big-radius conical frustum base

    Parameters
    ----------
    frustum : bpy.types.Object
        Blender object representing the conical frustum mesh
    cfrustum : mathutils.Vector
        Big-radius conical base centre position vector
    r2 : float
        Big-base radius

    Returns
    -------
    top_vertices : list[mathutils.Vector]
        List of position vectors of vertices belonging to the big-radius conical frustum base
    """
    top_vertices = []
    tol = 1.0e-3
    for vert in frustum.data.vertices:
        world_co = frustum.matrix_world @ vert.co
        if np.abs((world_co - cfrustum).length - r2) <= tol:
            top_vertices.append(world_co)

    bpy.ops.object.mode_set(mode = 'OBJECT')
    return top_vertices

These functions allow me to get the top and bottom vertices
base_points = get_vertices_coords_hel_base(frustum = frustum, cfrustum = cfrustum, r1 = r1)
top_points = get_vertices_coords_hel_top(frustum = frustum, cfrustum = cellipsoid, r2 = r2)

I then have methods to compute a ray orientation and to draw it
def calculate_ray_direction(start,end):
    relative_vec = end - start
    length = relative_vec.length
    direction = relative_vec.normalized()
    angle = np.arctan2(base_radius, length)
    rotation_axis = direction.cross(mathutils.Vector((0, 0, 1))).normalized()
    rotation_quat = mathutils.Quaternion(rotation_axis, angle)
    return rotation_quat @ direction

def draw_ray(start,end,collection):
    mesh = bpy.data.meshes.new(name = "Ray")
    obj = bpy.data.objects.new(name = "Ray", object_data = mesh)
    collection.objects.link(obj)

    bm = bmesh.new()
    bm.verts.new(start)
    bm.verts.new(end)
    bm.edges.new(bm.verts)
    bm.to_mesh(mesh)
    bm.free()

I then create the rays linking the top and bottom vertices of the frustum mesh and store the locations of the corresponding intersection coordinates
intersec_vertices = []
for start, end in zip(base_points, top_points):
    ray_direction = calculate_ray_direction(start = start, end = end)
    hit, loc, norm, idx = ell.ray_cast(origin = start,direction = ray_direction)
    draw_ray(start, end, ray_collection)
    intersec_vertices.append(loc)

The coordinates stored in intersec_vertices are not correct, and I do not get why?

Dawg just use descriptive variable names for pete's sake, All the "typing" you saved by cutting each variable name to some cryptic code sure went out the window the moment you had to explain your code to literally anyone else. Lmao. :D

@Jakemoyo I changed the variable names. Hopefully it is clearer now


text:
Addon - Trouble using external packages
I am developing a python code that uses Blender for geometric manipulation and scene visualisation.
To do so, I am trying to create an add-on, named V01, that has the following structure
V01
  * __init__.py
  |- DATA
    |- DR
      * DR.xlsx
  |-src
    * __init__.py
    * definition.py
    |- DR
        * __init__.py
        * dr.py
    |- PARSER
      * __init__.py
      |- EXCEL
        * __init__.py
        * ExcelParser.py
        * ExcelParserDr.py

The top __init__.py file contains (I did not include the bl_info to avoid unnecessary clutter)
import sys
import pathlib
import importlib
import subprocess

# install necessary packages
packages = [
    {'name': 'numpy', 'importName': 'numpy', 'version': ''},
    {'name': 'scipy', 'importName': 'scipy', 'version': ''},
    {'name': 'pandas', 'importName': 'pandas', 'version': ''},
]

for package in packages:
    try:
        importlib.import_module(package['importName'])
    except ModuleNotFoundError:
        if package['version']:
            subprocess.check_call([sys.executable, '-m', 'pip', 'install', f"{package['name']} == {package['version']}", '--ignore-installed'])
        else:
            subprocess.check_call([sys.executable, '-m', 'pip', 'install', package['name'], '--ignore-installed'])

# Get the path to the addon directory
addon_dir = pathlib.Path(__file__).resolve().parent
src_dir = addon_dir / 'src'

def register() -> None:
    print(f"Hi! (registering from {__file__})\n")

    if str(src_dir) not in sys.path:
        sys.path.insert(0, str(src_dir))

    if str(addon_dir) not in sys.path:
        sys.path.insert(1, str(addon_dir))

def unregister() -> None:
    print(f"See you! (unregistering from {__file__})")

    new_sys_path = [p for p in sys.path if ((p != str(src_dir)) and (p != str(addon_dir)))]
    sys.path = new_sys_path

if __name__ == "__main__":
    register()
    unregister()

The modules ExcelParser.py and ExcelParserDr.py include, amongst other things, the following
# ExcelParser.py module
import pathlib
import functools
import pandas

class ExcelParser:
    def __init__(self, FilePath):
        self._fpath = functools.reduce(lambda a, b: pathlib.Path(a)/b, FilePath)
        self._fdata: pandas.DataFrame = pandas.read_excel(self._fpath, sheet_name = None)

    @property
    def fpath(self):
        return self._fpath

    @fpath.setter
    def fpath(self, fpath):
        self._fpath = fpath

    @property
    def fdata(self) -> pandas.DataFrame:
        return self._fdata

    @fdata.setter
    def fdata(self, fdata: pandas.DataFrame) -> None:
        self._fdata: pandas.DataFrame = fdata

    def get_sheet_names(self):
        return list(self.fdata.keys())

    def get_column_data(self, sheet_name, col_name):
        return self.fdata[sheet_name][col_name].tolist()

and
# ExcelParserDr.py module
from src.PARSER.EXCEL.ExcelParser import ExcelParser
from src.definition import DATA_DR_DIR

class ExcelParserDr(ExcelParser):
    def __init__(self, FilePath):
        super().__init__(FilePath = FilePath)

    def get_m(self):
        return super().get_column_data(sheet_name = "MASS", col_name = "Mass [kg]")

When I try to run the file dr.py as a script in Blender, I get the following error
AttributeError: module 'pandas' has no attribute 'DataFrame'

If I remove the type annotations in ExcelParser.py, I then get the error
AttributeError: module 'pandas' has no attribute 'read_excel'

I added the pandas package directly to the Blender lib folder, located at
C:\......\DESKTOP\SOFTWARE\BLENDER\4_1\4.1\python\lib

but my add-on is still not running. How can I make my code work?
EDIT
definition.py reads
import pathlib

current_file = pathlib.Path(__file__).resolve()
ROOT_DIR = current_file.parent.parent
DATA_DR_DIR = ROOT_DIR / 'DATA' / 'DR'

and dr.py reads
import numpy as np
import bpy
from src.definition import DATA_DR_DIR
from src.PARSER.EXCEL.ExcelParserDr import ExcelParserDr

class Dr:
    def __init__(self, drDataFilepath = None):
        _data = ExcelParserDr(FilePath = drDataFilepath)
        self._m: float = _data.get_m()[0]

    @property
    def mass(self):
        return self._m

    @mass.setter
    def mass(self, m):
        self._m: float = m

d: Dr = Dr(drDataFilepath = [DATA_DR_DIR, "DR.xlsx"])

The file DR.xlsx is like this

You want to put required external libraries into a folder in your Configuration folder for whatever version you're using. Which can be found in C:\Users\{user}\AppData\Roaming\Blender Foundation\Blender\{version_number}. Then inside that folder you go to scripts\addons and if there isn't a modules folder in there then create one and put your installed external libraries there. More info about the path structure here

@Jakemoyo I did as you said, added a folder modules in scripts\addons, both in the installation folder C:\Users\{user}\DESKTOP\SOFTWARE\BLENDER\4_1\4.1 and in C:\Users\{user}\AppData\Roaming\Blender Foundation\Blender\4.1, but I still get the same error message, even after restarting my machine.

Have you pasted a full script here that could be testable on people's personal machines? This kind of stuff is easier to test if we can debug on our end.

@Jakemoyo I edited my post to include the definition.py and dr.py modules.


text:
Displacement through Geometry Nodes and vertex paint as masking
I'm new to geometry nodes.
Trying to set position with attribute color data as a mask (mask is the same on the other side), but there's an offset in the mesh, I need it to be symmetrical. Hoping to make the set position work along normals, could anyone help me fix this?
Example File

if you provide a blend file...i will try

Thank you so much , this is just the beginning of a more complex setup. Hope this is enough to understand. PLEASE SEE ORIGINAL POST [ added a drive link ]

ok, problem 1 is that your model isn't perfectly in the middle...

with this node tree:

i simplified it a bit, but i hope you understand the principle.
you get this:

The trick is:
you have to give the voronoi the same positions to both x-sides.
By this you will get the same pattern.
Unfortunately you didn't tell me that the midpoint wasn't 0 but -1. So i needed some more time to figure that out.
further explanation: The voronoi texture use the position input to generate a random value. This value is always the same for the same input values. If you plugin nothing in the position, it takes the position by itself as default. Therefore i changed the position on the side less then -1 to the same value on the positive side. So i got on both side of the x-axis (which in your case is -1 unfortunately) the same values.

I've looked at your setup and I thank you for your time. I will try it out. I did however manage to get it to not offset but it's not symmetrical, not sure how, I just played around, but by adding the normal and vector math nodes worked like a charm tbh.
Check screenshot of my fix
https://drive.google.com/file/d/1o-sGK0ppPeY2GMjdPe-vev6gB-jSldaL/view?usp=share_link
I originally thought is was symmetrical but I checked again and noticed, thank you for your help.


text:
Export list of all material textures from all meshes as txt/csv
I have a project with multiple mesh objects and each mesh has multiple materials with textures. Some have 1 and other have 10 used textures and more.
How can I please export a TXT/CSV list containing information about all meshes materials?
All mesh with all material names and all texture names?
I have seen a lot of python APIs for everything possible, but can't find one for this.
Thank you for any help.
Best regards Miro

filepath = r"E:/output.csv"

import bpy
from bpy import data as D

with open(filepath, 'w') as f:
    for ob in D.objects:
#        if ob.type != 'MESH': continue
        names = [s.material.name for s in ob.material_slots if s.material]
        print(ob.name, *names, sep=",", file=f)

If you really want to save meshes (which is not the same as objects) materials:
filepath = r"E:/output.csv"

import bpy
from bpy import data as D

with open(filepath, 'w') as f:
    for me in D.meshes:
        names = [m.name for m in me.materials if m]
        print(me.name, *names, sep=",", file=f)

Edit: output also names of the textures:
filepath = r"E:/output.csv"

import bpy
from bpy import data as D

with open(filepath, 'w') as f:
    for ob in D.objects:
#        if ob.type != 'MESH': continue
        materials = [s.material for s in ob.material_slots if s.material]
        names = [
            (m.name, m.node_tree.nodes['Image Texture'].image.name)
            for m in materials if m.node_tree
        ]
        names = sum(names, ())  # flatten [(1, 2), (3, 4)] -> (1, 2, 3, 4)
        print(ob.name, *names, sep=",", file=f)

wau, this is great.
I like the second script, as this is giving me also mesh without any material.
I would need one more thing in this script please.
It is exporting the mesh with all its materials as expected.
Can you please expand the script so it will export also the texture name used in the material?
Thank you very much!

@Miro currently the structure is, first column: object/mesh name, next columns, material names. With texture names it's not obvious what the structure should be...

Hi Markus, can the struct be for example: first column - Object/mesh, 2nd column - 1st material name, 3rd column - texture name of 1st material, 4th column next material then its texture, etc?
Or can you maybe change the material names in your second script for the texture names in those materials pelase?
I could then easily combine the 2 csv files into one. So first column: object/mesh, next columns texture names.

@Miro what if a material has multiple image textures, or none?

no, in my project all materials have only one texture.

@Miro see edit.

I got some error:
File "D:\Test2.blend\Text", Line10, in
File "D:\Test2.blend\Text", Line11, in
KeyError: 'bpy_prop_collection[key]: key "Image Texture" not found'
Do you know please what could this be please?
My project has more than 2000 objects, meshes & some armatures. In the output file were first 92 lines perfect.

@Miro you said every material has an Image Texture, so the script assumes that.

so I thought, looks like I'm missing there something. Also armature do not have images, but they do not have materials as well. Let me check that and I'll come back.

@ Markus. It works perfectly! I have used the script as debugging tool too, to find materials without texture. The script did stop always before badly mapped mesh.
Thank you Markus very much!!!


text:
Folding out shield for games and animations
First of all, I'm new to 3d modeling.
I'm thinking of making a shield that can expand its size by folding out metallic plates around it like an umbrella, similar to the "loaded umbrella" from Sekiro.
Here's a quick sample animation I made that shows what I need to do sample animation

I used an array modifier to make this but the problem is, when exporting it, I need to apply modifiers but then the animation no longer works because I used an object offset on an empty to animate this.
At first, I thought about using a bunch of bones with constraints but I can't find a way to do that.
So is there a way to make a shield like this, and make it so I can export this as an fbx or dae (I'm uploading this for others to buy) so anyone can download this and use it on games and animation?

In Blender, you can do such an animation with an Armature object and Bone Constraints (Copy Transformation, e.g. X-move => X-Rot) or an Action bone constraint. But I don't know if this works for exports and games.

Well, you probably have to bake an action (animation). This should be exportable.

@Blunder As long as I can export with animations (bake it) then it should be fine. I tried to use constraints. What I tried to do was make a main center bone and a bunch of other bones to the left. Then use constraints to restrict them from moving after a certain distance. But when I parent them to the main bone at the center, I couldn't get any location and rotation values for them because even though the bones do move, all the values are set to 0.

@Blunder when I try to bake the animation for the sample video above, since the animation is actually on an empty object, it just bake it's animation. And the array gets applied so I was left with just a bunch of objects jammed in one place with no animation.

I mean use an armature and then bake the animation to get rid of the bone constraints. Let me check where I put the example that I made ...

Creating the Animation
The animation can be created by a rig. The Armature object in this example has 14 bones in total. A Root bone, a dozen of deformation bones, and a control bone for the rotation.
The green bones are the deformation bones with a Transformation bone constraint. When the control bone is rotated the deformation bones will do their rotation.
For the animation, only the root bones and the control bone have a few keyframes.
The "zoom in" effect at the beginning was done by scaling the root bone from 0.1 to 1.0.

The shield parts are parented directly to the deformation bones in this example. For exporting the animation into a game engine it might be better to use vertex groups and "weight paint" because parenting the mesh to a bone directly might not work. Make sure the root bone and the control bone have not ticked the [_] Deform option in the Bone Properties panel, and there are no vertex groups for them.
Bone Constraints
The Map To > Max value of the Tranformation bone constraints increases for each deformation bone (0° for the 1st, 30° for the 2nd, 60° for the 3rd, ..., 270° for the 10th, ..., and 330° for the 12th bone).
It's recommended to keyframe the rotation of the control bone first, so you can scrub the timeline and check the animation.

In the example, the control bone is rotated only from 0° to 179° because there is a limitation. But the deformation bones will do a rotation up to 360° because of the mapping. If you try to rotate the control bone more than 180° there will be a "flip" and the deformation bones will rotate the other way around (shortest rotation path). See Why does copy rotation constraint invert after 180 degrees for the details.
Baking the Animation
When you're happy with the animation you can make a backup and then bake the animation. The baking will remove the bone constraints and create keyframes for the deformation bones.
In Pose mode, select the menu entry Pose > Animation > Bake Action... and check [X] Visual Keying to bake the final transformations with the constraints applied, and check [X] Clear Constraints to remove them.

Finally, you have the deformation bones with a lot of baked keyframes and without the bone constraints. You can delete the control bone. The baked action can be exported for game engines.

Man thank you. I was trying to parent them and use limit rotation. And then I tried using drivers, which actually works but a lot of work. This is way way better and exactly what I needed. Just a quick clarification, I need to parent ALL the bones to the root bone right?

You're welcome! Yes, the root bone is there to easily move, rotate and scale the shield. It is the parent for all other bones.


text:
What means ''ValueError: could not convert string to float: b'33.4904
When i import a obj file this error pops up and idk how to fix it somebody know how?
ValueError: could not convert string to float: b'33.4904\xb1'

Please post error messages as text, not images. Ideally by using (3 backticks), then on the next line(s) the error message, then add another empty line and put another triple backtick there. And then I think you need another empty line to make it work.

Looks like it's a ± character causing the issue: Unicode Character 'PLUS-MINUS SIGN' (U+00B1)


text:
Relighting Workflow
I always use following setup for relighting an object in compositing:

In most cases this works, but sometimes it's hard to adjust the direction of the light. Especially in terms accuracy it would be useful to adjust real values instead of rotating the light direction ball:

Is there more accurate way to adjust the values of the normal pass?

One way would be to enable the Amaranth plugin by Pablo Vazquez (not included with blender by default). This addon adds many features to blender including the ability to edit the individual values of the normal node:

While the changes aren't visible in the node itself, when the node is selected extra options appear in the properties panel (N) in the node editor.


text:
Dark streaks appearing only when rendering image/animation (solved)

The light source is directly above the table with no objects casting a shadow. Alpha is at 1. The table is one object with no breaks. The streaks appear above the table legs. Rendered in Cycles. The closer to the light source the stronger the streaks appear.

hard to say... dark seams seem to be evenly spaced in the picture... but could you share the blend file for a closer look?

I'm so new but after a bit more exploring I found out it was objects I had hidden from the viewport but were showing up in the render.


text:
Replicating a modified object to linked objects?
My workflow uses Duplicate Linked objects. Modifying the mesh automatically updates linked meshes as expected. For clarity, this means creating an object, say a cube, then choosing "Duplicate Linked" so all objects are using the same underlying mesh; modify any of the object's mesh and all other meshes update.
The problem: I now add a bevel modifier to one of the cubes, and also a sphere above it and parent it to the cube. I want to now replicate this changed object to all other objects linked to the cube's mesh.
I can do this manually with this workflow:

Select Hierarchy on the modified object
Duplicate Linked
Copy the position and rotation of the old object to the new one
Delete the old one

This is very tedious. I'd like to write a script that does this. My script isn't working though. It duplicates the cube and positions it, but doesn't have a child sphere and doesn't delete the object being replaced. Any thoughts what's wrong?
# blender script which deeply replicates linked objects
import bpy

# if no selection, bail
source_obj = bpy.context.active_object
if not source_obj:
    print("No active object selected")
    quit()

# set the selection to be objects linked to the active object
bpy.ops.object.select_linked()

# copy the selection to a list (this only copies the parent object references)
selected_objects = list(bpy.context.selected_objects)

# for each object in the selection
for obj in selected_objects:
    # if the object is the active object skip it
    if obj == source_obj:
        continue

    # clear all selections
    bpy.ops.object.select_all(action="DESELECT")
    # set active object to our source object parent
    source_obj.select_set(True)
    bpy.context.view_layer.objects.active = source_obj
    # select the hierarchy of the linked object
    bpy.ops.object.select_hierarchy(extend=True)
    # bpy.ops.outliner.object_operation(type="SELECT_HIERARCHY")
    # duplicate linked active object
    bpy.ops.object.duplicate(linked=True)
    # get the new object
    new_obj = bpy.context.active_object
    # copy the position and rotation of the old parent object to the new parent object
    new_obj.location = obj.location
    new_obj.rotation_euler = obj.rotation_euler
    # copy the parent of the old object to the new object
    new_obj.parent = obj.parent
    # add the new object to the same collection as the linked object
    obj_collection = obj.users_collection[0]
    # delete the old object
    bpy.ops.object.select_all(action="DESELECT")
    bpy.context.view_layer.objects.active = obj
    bpy.ops.object.delete()
```

Hi. The steps you list are unclear. What's the modified object? What's replaced object? How is it replaced? Could you edit the question and state what you want to do clearly? Why are you doing this? What's the context? Can you add some sketches/screenshots illustrating your desired results and the problem?

So you have some objects selected and you want to duplicate the active object with its hierarchy to the positions of the selected objects or something like that?

Yeah, something like that. The only difference is that since "Select Linked" correctly selects all the other meshes, I only select a single object I want replicated. Basically while editing an object in a scene, once I'm done and go back to Object mode, I want to run a script to replicate the active object to all the others.

Wouldn't using collection instances get rid of the problem altogether ? Do you need to be able to modify every instance independently ?

I can use Collection Instances and it was my first thought. My problem with them is that they either create empty nodes on export (if Empty types enabled) or they get removed entirely and the whole thing gets flattened with no hierarchy. Because this is for a game, and we need the hierarchy for culling efficiently, don't want the extra empty transform, and don't want to write a custom exporter, we are currently looking at the workflow mentioned in the question.


text:
When I press U the "UV Mapping" menu does not show up
When I press U on my keyboard to project it from view the "UV Mappings" menu just doesn't show up at all.
Any answers on how to fix this?

Screenshot? Are you in Edit mode?

You are in edit mode on a Metaball object. The only objects which you can edit the UVs are mesh object. But you can convert that metaball into a mesh:

Switch to object mode with ↹ Tab
 RMB > Convert To > Mesh


text:
Change mesh but keep dimensions
In the scene, I have 2000 such objects

Because they have so many faces, I want to replace each with a plane
But their sizes differ, so I traverse their dimensions and give them to the plane, However, the size is still the default size
I searched for questions and added ‘bpy.context.view_layer.update()’，but it didn't solve the problem
The following is my code. Please have a look. Thank you！

import bpy

col = bpy.data.collections['Collection 2'].objects

mesh = bpy.data.objects['plane'].data

dim = []

for obj in col:

    dim.append(obj.dimensions)

    obj.data = mesh

bpy.context.view_layer.update()

for d  in dim:

    for obj in col:

        obj.dimensions = d

Your logic is wrong. For each dim vector, you traverse all objects in your collection and set its dimensions to that dim vector. This effectively means, that you set all dimensions to the last vector in the list of dimensions:
for obj in col:
    obj.dimensions = dim[-1]

You can reason about that by representing a loop as repeated lines of code:
for i in range(4):
    print(i)

is an equivalent to
i=0; print(i)
i=1; print(i)
i=2; print(i)
i=3; print(i)

So your loop
for d in dim:
    for obj in col:
        obj.dimensions = d

is an equivalent to
d=dim[0]
for obj in col:
    obj.dimension = d

d=dim[1]
for obj in col:
    obj.dimension = d

d=dim[2]
for obj in col:
    obj.dimension = d

# ...

d=dim[-1]  # last
for obj in col:
    obj.dimension = d

On each step of the outer loop, the inner loop overrides values set in previous steps of the outer loop.
Solution
Apply scale of the objects, then in the script copy its dimensions, change the mesh and set the dimensions as scale divided by the replacement mesh dimensions (in case of a cube you could just do o.scale = d/2 since the cube has dimensions 2;2;2)
import bpy

cube = bpy.data.objects['Cube']
cd = cube.dimensions

for o in bpy.data.collections['col'].objects:
    d = o.dimensions
    o.data = cube.data
    o.scale = d.x/cd.x, d.y/cd.y, d.z/cd.z

I understand that it's a problem with nested loops. I always copy the same value to the object
Thank you.


text:
Python: convert collections to empty-parents with hierarchy (problem with location of instanced collection)
I need some help with a script to convert big CAD-files with 80+ collections.
The collections need to be changed to a empties with sub-empties and objects. And they need to maintain the hierarchy. I'm not good in programming and I have no expierience in Blender-coding.
I spend 2 days for searching and stitching example codes together and I already can convert the collections with my script.
I'd like to:

make an instance from a collection
make the instance real
delete the collection

(all this from the last collection up to the fist, to maintain hierarchy)
The problem is that the instances are placed in the main-collection and not in the corresponding collection, and so the hierarchy is broken.
Can someone tell me how to tell blender to place the instance in the corresponding collection?
import bpy

print()
print()
print("---------START------------")

def traverse_tree(t):
    yield t
    for child in t.children:
        yield from traverse_tree(child)

# Recursivly transverse layer_collection for a particular name
def recurLayerCollection(layerColl, collName):
    found = None
    if (layerColl.name == collName):
        return layerColl

    for layer in layerColl.children:
        found = recurLayerCollection(layer, collName)
        if found:
           return found

coll = bpy.context.scene.collection # start @ top-collection

list =[]

for c in traverse_tree(coll):
    list.append(c.name)

# remove unwanted collections
list.remove('Collection') # Camera & Light
list.remove('Master Collection') # Master Collection
list.pop(0) # root collection from imported scene

# start from bottom to top
list.reverse()

for entity in list:
    print("Verarbeite: " + entity)

    source_collection = bpy.data.collections[entity]
    instance_obj = bpy.data.objects.new(name=entity, object_data=None)
    instance_obj.instance_collection = source_collection
    instance_obj.instance_type = 'COLLECTION'

    layer_collection = bpy.context.view_layer.layer_collection # start on top
    parent_collection = recurLayerCollection(layer_collection, entity)
    parent_collection = bpy.context.view_layer.layer_collection
    parent_collection.collection.objects.link(instance_obj)

    bpy.data.objects[entity].select_set(True) # select instance
    bpy.ops.object.duplicates_make_real(use_base_parent=True, use_hierarchy=True) # convert to object(meshes & emptys)

    bpy.data.collections.remove(source_collection) # delete original collection

    print()

 before the script
 what my script does
 what I like to have
The extensions on the names (.001) are not important, I filter them later.

First of all, this is a very nice question and could serve as an ideal example on how to ask on Stack Exchange. What I'm missing here, maybe due to my inexperience with importing CAD, is why you're making instances instead of manipulating objects directly?

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 with babylon.js.
Here is the working code:
import bpy

print()
print()
print("---------START------------")
bpy.ops.object.select_all(action='DESELECT')

def traverse_tree(t):
    yield t
    for child in t.children:
        yield from traverse_tree(child)

def parent_lookup(coll):
    parent_lookup = {}
    for coll in traverse_tree(coll):
        for c in coll.children.keys():
            parent_lookup.setdefault(c, coll.name)
    return parent_lookup

#Recursivly transverse layer_collection for a particular name
def recurLayerCollection(layerColl, collName):
    found = None
    if (layerColl.name == collName):
        return layerColl

    for layer in layerColl.children:
        found = recurLayerCollection(layer, collName)
        if found:
           return found

C = bpy.context
coll_all = bpy.context.scene.collection
liste =[]
counter = 0

for c in traverse_tree(coll_all):
    liste.append(c.name)

liste.remove('Collection')
liste.remove('Master Collection')
#liste.pop(0)
#iste.pop(0)
liste.reverse()

for entity in liste:
    counter = counter +1
    print("Verarbeite: " + entity)

    source_collection = bpy.data.collections[entity]
    instance_obj = bpy.data.objects.new(name=entity, object_data=None)
    instance_obj.instance_collection = source_collection
    instance_obj.instance_type = 'COLLECTION'
#   print(instance_obj)

    # Get all collections of the scene and their parents in a dict
    coll_scene = C.scene.collection
    coll_parents = parent_lookup(coll_scene)

    # Get active collection reference
    active_coll = source_collection
#    print (coll_parents.get(active_coll.name))

    # Set parent collection as active
    layer_collection = bpy.context.view_layer.layer_collection
    layerColl = recurLayerCollection(layer_collection, coll_parents.get(active_coll.name))
    bpy.context.view_layer.active_layer_collection = layerColl
#    print(layerColl)

    # create / link instances
    parent_collection = bpy.context.view_layer.active_layer_collection
    parent_collection.collection.objects.link(instance_obj)

    # convert instances to real objects (with hierarchy)
    bpy.data.objects[entity].select_set(True)
    bpy.ops.object.duplicates_make_real(use_base_parent=True, use_hierarchy=True)

    # delete original collection
    bpy.data.collections.remove(source_collection) #delete collection

print(counter,  " Collections verarbeitet")
print("------ ENDE--------")

You might want to use the Contact Us form to merge your accounts, so that you can edit your question and accept this answer.

ok i merged the accounts.. how can i close this thread / or accept?

You can accept your answer in a day or so, with the checkmark underneath the score. See https://blender.stackexchange.com/help/accepted-answer


text:
Weight painting seems to be ignored on my rig
I'm trying to animate my character model using Rigify, but moving one foot will always bring the other foot with it.  I was following this tutorial.
My Blender project file can be found here.  As you can see in the project, the feet are weight painted, and I set the FK/IK to 1.0, as shown in the video.  What am I missing here?

Found 2 issues here :

First, you forgot to apply the mirror modifier.
Second, you can see that it is not the "foot" weight that influences the other side, but the "toe" weight (and this is a side-effect of the mirror modifier I guess) :

So make sure to apply the mirror modifier before parenting the armature, then try again. You'll be able to tweak the weight painting more efficiently.
And a side note, you'd better to pull up the Armature modifier before the Subsurf modifier (you'll get better performance while moving the rig, so the animation will be less painful;)

Sorry, but what do you mean by parenting the armature?  I'm still very much a Blender noob.  Does it have something to do with the way the skeleton is built?  I just used the default one provided by Rigify.

It's when you select the armature and the character mesh, then type Ctrl+P and select "with automatic weight". (on the tutorial you linked in your question, it's @ 3:25)


text:
Animating my character's leg brings part of the other foot with it
Once again, I'm running into problems following basic tutorials.  I tried to animate my model that I rigged with rigify, and when I move one foot, part of the other foot comes with it in some strange ways.

What's the best way to fix this?  My Blender project can be found here.

possible duplicate of Some vertices don't move along with the rig

The problem is caused by the fact that your foot is not correctly weight painted:

The red bits will follow the bone, and the blue bits won't. to fix your problem, it should look like this:

To perform the fix, select the foots vertex group, enter wait paint mode, then paint the parts of the foot you want to follow the bone red.

Weight painting did not appear to solve my problem.


text:
Can't bake second material to one face of object
Blender version 4.0:
I have a simple hangar structure and I've used an environment map. All the faces use the "Hangar Interior" material except for the sandy floor which should use the "Hangar Floor" Material which is nothing but the duplicate of the interior material with some wavy 'sand' texture added to it.
Everything shows perfectly in the render view, but when I am baking both the materials (yes, I've ensured the same image texture is 'selected' for both material and the floor material is 'assigned' only to the floor face) the generated texture in UV Editor screen applies the Interior texture (which has smooth sand surface) to the floor face. Why is it happening?

How exactly are you baking 2 materials at the same time?

@MartynasŽiemys thanks for your reply. I am ensuring that both materials are 'selected' by going in each slot and clicking on the Image Texture. And then I also select the target object/hangar in object mode. Then I bake it. Isn't that how it's done? This approach is working on a simple cube with the same image texture distorted "only" on one face, so I guess the environment map texture is treated differently?

I got it. It was silly of me to expect the bumps in the diffuse bake. Turns out you have to bake diffuse, normal and roughness textures first and then apply them all in the final material.


text:
Boolean Not working with Guideway
Link to file
A I had a cube that cuts through the shape (track), but I want the track to through a cube which is not happening. Can someone please explain why the inverse is not happening. I deleted the cube in the file.

You'll have to explain exactly what you're expecting to happen. I don't see a cube in your scene and there isn't a boolean modifier on any of the objects in your Blend file. To add to that the Scale and Rotation haven't been applied to any of the objects in Object mode and the face orientation is fllipped on all of them.

Hi, Stanley R, welcome.. I'm sorry, but the phrasing of this post, and the attached file, leave us absolutely clueless as to what you want to achieve. Without an edit, the question is vulnerable to getting wiped for lack of clarity.

The track normals are inverted...

Thank you, So how do I invert the normals?


text:
Creating a 3 d face from 2d
I would like to ask for something maybe simple. What would be the best (and easiest :) )way to make the drawing below 3d?
Thank you

Hi, i think you shoul better define "3D" in this context. You can surely convert the gp trace into curves and give that some thickness.. is that the kind of 3D you are looking for? Can you show an example of whar kind of result you are expecting from this input?

Hey thanks for the reply. I was thinking maybe this can be put to a uv sphere and somehow gain some curves and form. for example the head would like a ball and the nose will stick out of it. I was thinking a ball and the drawing will be ana anaglyph upon the ball with different heights for each part (nose for example will have bigger height. but as i said i am not an expert on modelling so i was asking maybe you can give some advice of how this can be made as a 3d in a more appealing way


text:
Why should triangle meshes be avoided for character animation?
I've read many times that triangles should be avoided in meshes; to give one reference: "Introducing Character Animation with Blender by Tony Mullen" says that equilateral triangles work fine as long as you don't deform them. It seems to be common in game development that the models are triangulated.

What issues are introduced by using triangles?
Does the same apply for n-gons?

for N-gons read this post: when-should-n-gons-be-used-and-when-shouldnt-they

Related https://blender.stackexchange.com/questions/99369/i-thought-you-should-never-use-triangles https://blender.stackexchange.com/questions/2931/why-should-triangle-meshes-be-avoided-for-character-animation https://blender.stackexchange.com/questions/89/when-should-n-gons-be-used-and-when-shouldnt-they https://blender.stackexchange.com/questions/36270/how-can-tris-be-used-to-an-advantage/

Rather than thinking of limitations with using triangles (I think this is an over simplification of the topic), learn common workflows that take advantage of quad-dominant meshes.

adding and removing edge loops (to increase or remove detail)
using loops to better define features of the mesh (such as facial features, around eyes etc).
operations on faceloops and edge-loops that speed up selection loop selecting, loop sliding for example.
operations on grids. ripping & grid-fill for example.
better deformation with shape keys (a lot could be written on this, read up on mesh topology, facial shapes, deformation).
better subdivision-surface results (edge loops along important features of the form allow your to use creases too).

However in a specific situation you may find it's not a problem to have a 100% triangle mesh so don't be single minded about this.
Instead of defining triangle meshes as bad, try to learn to use these tools and you'll better understand why in most cases, triangle heavy meshes are not ideal for character animation.

  When people refer to character animation, they often don't include robots with rigid surfaces where, apart from the modelling process, tris for flat surfaces aren't that bad. They refer to human faces or otherwise flexible surfaces.
  To simplify controlling the mesh for facial expressions or lipsync, faces of characters are modeled more or less low poly to control their features and then a Subsurf Modifier is used to create a high degree of smoothness. That's the point where tris cause all the mentioned problems.
Look at this simple example. The tris to the left give some nasty bumps when subsurfed, the quads to the right are wonderfully smooth. Imagine the difference in a character's face.

Since Ideasman has a point, here's another example of topology. To the right you have a very clean structure and the desired smooth result. The left shape is not so lucky. Achieving the same amount of smoothness would require a high amount of tris if it's possible at all.

  Regarding modelling: Add a UV Sphere and put an edge ring somewhere at the equator with the Loop Cut. That's fast and easy. Then try to put an edge ring around the single vertex at the top. It's harder to add detail if your topology doesn't follow the form.

This example is a bit misleading, if you have a mesh with evenly spaced quads, then triangulating will give noticeably uneven shading (as with your example). But if the mesh was created with evenly distributed triangles the shading can be fine.

You're right. An example for this is the Icosphere. The question is, can one conveniently maintain the even distribution when doing less regular shapes and is it worth the hassle? Actually I agree with your answer.

N-Gons with more than 4 sides and Tris are bad because they do not subdivide smoothly and so break up the flow of edges through a model.
Tris are only bad when you need to smooth a mesh ie add subdivisions.
This diagram shows the effect of using quads and the subdividing as you see you still have quads after subdivision, so you could do it again for example.

There is nothing wrong with Tris except were you are wanting to smooth and sometimes they can't be avoided, in which case hide them in a unseen part of the mesh, under a arm etc.
Tris are not bad and in fact when the mesh is rendered all polygons are reduced to Tris.

its not always true that all geometry is triangulated before rendering. It depends on the rendering engine. blender-internal for example doesn't do this unless the faces are non-planar.

Triangles work fine in lowpoly models (such as for games).
However, when you subdivide them, they dont respond well. You will often see stretching and artifacts. Since subdivision is such a common workflow, it has become a general rule of thumb to avoid triangles.
I will at a later time (if nobody beats me to it) show an example.
It can be ok to use triangles if the surrounding area is completely flat. Or if the triangle is hidden away in inside of something (like an ear).
Pentagons are a little better than triangles (I think, please correct me if I am wrong), but generally avoid them too, if you can.
More vertices than 5 are really bad.

I'm relativly new to modeling characters, but what I've found is:

Triangles don't deform well when rigging.
It's easier to read edge loops when looking at quads in a low poly model.

I am not sure about ngons and issues using them in character animation.


text:
Help scaling an armature and mesh (FBX import)
I'm using Blender 3.3.1.  I imported a free elephant that is rigged of sketchfab (https://sketchfab.com/3d-models/hide-the-elephant-g-baselitz-version-49bd291888204d45adf6074f764735a1) which is pretty cool and I'm using it to learn some things.
I'm having problems with the armature set to 0.010 scale and the mesh was at 1.0 scale.   For my application,  need both to be at 1.0 scale.  I did some research and see this is common, and found a solution suggested that works so far which is to import the FBX at 100 scale. That worked great and both mesh and its parented armature are at 1.0.

My problem is now I need to bring the size of the elephant down to normal scale again, and when I try and scale down the mesh deforms.  Here for example I tried to scale it down to 0.20 ... so far so good.

But as soon as I select-all and apply all transforms, the mesh deforms and gets worse and worse the more I scale down, which is basically unrecoverable at .01 where I need it to be.

What can I do to make this the proper scale without deforming, and have the armature scale at 1.0 and the mesh at 1.0?  I also attached the blend file.  Thank you.

Hello for some reason I can't open your blend file, could you please save and share again?

@moonboots the file is actually a zip file with the wrong file extension ("Elephant.zip.blend"). You need to rename it and remove the ".blend" part, then you can extract the zip file to get the real blend file.

Thanks Blunder. I'm not sure what's the problem though, maybe it's the same as this? https://blender.stackexchange.com/questions/196995/applying-armature-scale-messes-up-the-action

Thanks, here's a better link the blend file https://drive.google.com/file/d/1rFeQc8G-7nqJ3vhNOuWMQ1NtTQ1rRfEK/view?usp=sharing  I'll take a look at those posts above, I've seen them before but could not work it out.  Will try again.


text:
how to realign a bone when a lot of constraints are used
I'm trying to rig the wing of a bird (I'm following the piero training course of the CG Cookie) and I noticed that two bones are out of place. Since the author of the tutorial used a lot of constraints and became a mess for a newbie to understand,I would like to know if there is a method to know how to fix the bones that are misaligned when a lot of constraints have been used. thanks.

There is no automated function for fixing false constraints, because there is no way blender knowing whether this constraint is doing it's intended job right or wrong. You have to fix this manually.
The only automated feature, is "clear transform" (type it after pressing SPACE). but this only resets your animated translation, scale and rotation and will most likely don't fix your problem.
You actually have to manually click through every bone and disable and enable the constraints (by clicking on the eye icon of the constraint), to find the wrong constraint and fix it by hand.


text:
Partycle system's labels error?
I'm following this Gleb Alexandrov tutorial :
Blender tutorial: How to Create a City, Covered with Fog
Go to minute 4:52,under the particle system/render tab,you will see that he chosen as Dupli Group "Group.001". Where/when he took/created this label ? I don't have it on my side. He also has 2 others label : g_antenna and group. I imagine that g_antenna is related to the mesh of the antenna that he got somewhere,but I'm not able to understand where,and the other label,that's group,I don't know what is this.
I add two screens. The first is what I see on my side and the other one is what I see on the particle system/render tab of the Gleb Tutorial.
1)

2)

Mate, Gleb created roof details meshes (antennas, chimneys and stuff) himself and grouped them to use in the particle system. You won't find them in your .blend file. You can try to find similar objects online, but if I were you, I'd just create them myself. It would be nice exercise for a beginner.
To group objects, you need to select them and press Ctrl+G. On the left bar (under T key) group name field will appear. You can leave the name as Group or change it to your liking. Highlight of grouped objects should turn green. Check this image to see an example:

The group name will appear in particle settings.

yes. I found them online,but how can I group them using the particle system ? This is the point that I don't know how to do.

I've got the antenna,here : http://www.blendswap.com/blends/view/72323 ; and the Chimney,here : http://www.blendswap.com/blends/view/74699 ; and I have copied the model from the original blender file and pasted to mine,but still,I have no groups under the partycle system...


text:
How to join two bones that are part of the same armature
after looking for a solution all the day,I surrendered. I would like to know how to join two disconnected bones that are part of the same armature.

I tried to select the two points of the bones and then pressing F to complete the gap but they don't stick. Check here what happens :

FILE BLEND

Here some shots of the final result

In order
1) In Edit Mode I select boneA and press alt + f in order to switch its direction (as you can see is the only bone having the opposite direction respect the others bone of the tail of your bird)
PS remember when you use alt + f your bone will switch direction AND will lose every connection with the other bones; for this reason i will do step number 4) and number 5)
2) I take the boneA and i move its "head" near to the tail of boneB
3) Now I follow the step i tell you before:  select boneB - press shift - select boneA (remember the order is important); in this way you'll have both bones selected.
4) Press Ctrl + P and click Connected
5) In the end to keep your boneA connected with your bird's tail (i.e. the boneC and the others) i add a Copy Location in boneA

thanks man. I tried to do what you said,but it didn't work. you can see what happened here : http://psychonews.it/dati/2016-04-19_22-17-55.png and here : http://psychonews.it/dati/2016-04-19_22-18-30.png ; what can I do ?

Ok i understand! Please upload your file. I need to check the armature

sure : http://psychonews.it/dati/Pierino78.blend

I edit my question; tell me if it's what are you looking for

check this picture : http://psychonews.it/dati/2016-04-20_00-08-31.png. I see that you haven't joined one bone with the upper one,but anyway I see that there is a dashed line. What's the difference between a dashed link and a non dashed link ? thanks...

It's a different way to connect 2 bones (and it's very quickly) but comments are not the place to answer a question like that; if you need more info ask directly a question in the site and we will answer as soon as. Furthermore if my answer reply and clarify your doubt about your armature please tick the answer as correct in order to check this problem as solved


text:
Transfer UV maps or Join as UVs?
I'm trying to apply textures to a 3D character that I have modelled following a tutorial where has been used blender 2.66.1,while I'm using blender 2.76. At a certain point,I see there are differences between versions. As you can see from the pictures,if I do "CTRL + L",the last item is called "Transfer UV map",while in the tutorial the same feature is called "Join as UVs". I'm not experienced but I think that since there is a difference,I have to follow another procedure than that used on the tutorial. Also because,on the tutorial the 4 claws are the same size but my model has 4 claws of different size.

I have separated (with P in edit mode) claws from the rest of the body and this is what happens when I try to transfer the UV maps of two claws :

So,what should I do at this point ? thanks.

Do you have any modifiers associated to your claw objects that were inherited from the original mesh? You probably want to disable them and see if your geometry straitens out. Also you probably need to kill your vertex groups on your claws as well. You are in a pretty big mess, because you are manipulating the vertex indices, and you are doing this to both your claws and at least the foot mesh that it is attached to. You will probably have to rebuild them as needed. Once you have this strait, Ctrl+L will most likely work for you.

The operator name from "Join as UV" in 2.66 is the same as the one used in 2.76 for "Transfer UV Maps" - bpy.ops.object.join_uvs() which would indicate that the description has been changed to better describe the function that is performed while the function performed is the same, meaning you should use Transfer UV Maps in a newer version of blender to do the same thing.
In the current release it is described as

bpy.ops.object.join_uvs()
  Transfer UV Maps from active to selected objects (needs matching geometry)

While back in 2.66 it was described as

bpy.ops.object.join_uvs()
  Copy UV Layout to objects with matching geometry

If you also want to compare the source code you will find that the description used in 2.66 and the description used in 2.76 is the only part of the operator that has changed.


text:
How to create random angled curves in geonodes?
I'm trying to recreate this script (https://github.com/mantissa-/RandoGrid) in geometry nodes and I have some questions.

This is what I've got so far:

This is inside of my NodeGroup:

And at frame 20 it looks like this:

So I want to give user a choice on number of repeats. I figured I would do it this way and if user wants 20 repeats then he can go to frame 20.
Is there a better way of doing this or that's how it's suppose to work?

If that's how it's suppose to work then I have this problem. Look at number of vertices at frame 20:

Insane! What am I doing wrong?

How do I limit this so it doesn't extrude outside of the initial x and y dimension (5 and 3 in this case) and if it does how to make it choose a diffrent direction?

About the repeating part, blender version 4.0 will have loops. It's called repeat zone for now. You can check that out by downloading the alpha build.

Are you sure you need a simulation? Would some cunning weights in Shortest Edge Paths do the trick?  https://imgur.com/a/BeNAMOO

As Robin Betts already pointed out, you don't need a simulation zone or a repeat zone. Here's a solution using Accumulate Field:

on the 2nd image you can see more horizontal offsets for overlaps, but this technique allows the lines to move away (horizontally) from its starting trajectory (by a lot). If you don't want this to happen, you can just set random positions without accumulation on XY, or use a noise texture to do that if you want an effect in between…
Here's an example how that could look like, this time I'm normalizing the random vector, so the distribution doesn't favor diagonals:

Also notice dividing the index by 2 and ceiling, to get a consistent random number on points of the vertical segments.

I managed to fix issue I described in question 2 by adding Merge by Distance node after Join Geometry inside my created NodeGroup.

Now my loop is properly only adding new geometry instead of doubling it every frame.


text:
Trying to align multiple instances of an object normal to faces using geometry nodes
I am trying to align instances of an object normal to faces using geometry nodes. The one in the circle is the only one correctly aligned. I have tried all the solutions I have found on youtube or here, but this is the closest I have been to what I am looking for. Objects align with random rotations and I am not even able to add more instances next to the good one, I have tried distribute points to faces but it results in random distribution and misalignment.
First I thought it could be easier aligning them to an hexagon of edges converted to a curve, but that identifies the normal as the normal of the hexagon, not individual edges. So objects never align well, towards the centre of the hexagon. Maybe exploring this path deeper could be the solution.
Any help or guidance with this would be much welcomed.
Thank you

If your question has been solved, please be so kind and mark the answer that contributed to the solution as "Accepted answer" so that this question will not continue to be displayed as unsolved. Thank you! Here you can find more information: What should I do if someone answers my question?. If you still haven't gotten a solution to your question, please be kind enough to address it.

Your objects align correctly – you tell them to align to normals and they do. Now, obviously what you actually mean to do is to not only align the biggest face of an instance to be perpendicular (to face) the normal of the instancer, but you also want one of the smaller sides of the cuboid to face up, so you need to align again and this time limit the rotation axis:

Here I intentionally rotated the instancer to show how this arbitrary angle is not necessarily what you want, you may want to rotate up, based on the direction of the face:

I'm cheating a little bit and removing longer edges because I know the "horizontal" edges are longer. Otherwise you could take the difference between verts of an edge, take an attribute stat of the normalized Z component and compare with that instead (you probably would need a bigger εpsilon for that if edges don't all point in the same direction). Or you could use topology, if there's some logic like e.g. the top verts having lower indices than bottom verts… Or maybe you could use "shortest path" node…

Thank you for the detailed answer and solution. I discovered my hexagon mesh is bad one, so I used your attached file and tried working on it. I was able to create an array and place it in every face but now the "cuboid" as you call it is pointing outwards, instead of inwards, and several other problems arise and I don't have the skills nor the knowledge to deal with them. I will do simple arrays and hope I will learn more in the future. Thank you for your patience.

@Indigo I spawn the cuboids on the centers of faces, and since the hexagon doesn't have thickness, the cuboids are visible on both sides. The cuboids could be translated so their origin is outside, then they would spawn on one side of the wall.

It has to be said...  Bandstands/Carousels built on a tilt are quite rare...  I suppose the  case has to be covered .... : )


text:
Extrude along the specified path
In this image, the extruding action is done along those two blue lines that cross the 3D cursor, how did it do this?

Assuming you have the faces selected, Alt-E > Extrude Faces along Normals?

Yes, of course directly extruded with the E shortcut
You can also watch this educational video from the link below:
https://www.youtube.com/watch?v=Abtnju3ttHM
He designs this part from the eighth minute onwards

@yasin1364 You cannot see it in your screenshot because he is already doing the extrusion, so the top menu bar is not visible. He has set the Transform Pivot Point to Individual Origins.


text:
Finding a camera position based on an image and a 3d model of the same scene
I'm new here, I really hope what I'm asking is possible, thanks for your help in advance.
I have an image from a security camera and a photogrammetry 3D model of the same scene. I want to find the exact position of the camera in Blender using tie points on an image and on the model, so that I'll able to reconstruct objects exactly as they were in the scene.
there is a question with a similar idea, but no answer:
Positioning of a 3D camera model in Blender to match the view of a camera object
I've tried to use the camera view to fit the camera specs exactly, but I always seem to have a little bit of parallax. I'd like to find a "mathematical" way to do it. As I see it, I have 8 variables to contend with: X, Y, Z, Pan, Tilt, Rotate, focal length (given 18mm fisheye, but that's not exact), and lens distortion.
I tried to pinpoint the exact position using COLMAP, but it won't register.
I would have tried to use fSpy if I could, but I do not have coherent strait lines in the frame to save my life. only random round bricks on the ground near the camera, a lot of plants and trees in the midground, and distant buildings in the background.
I want to use tie points - so I'll be able, for example, say - this brick is on the model here, and on the image there, and so on... for a number of tie points, until I have the correct perspective (XYZ, PTR and focal length) so I'll be left with only lens distortion to contend with. Automatic algorithms that I tried (SFM based) do not work.
Is there a solution for this weird problem?
Thanks again.

how does your image look like? If the perspective lines are coherent enough you can use fSpy, have you tried it?

Maybe you will get close to the real camera footage, but the problem is that real cameras might have specifications you can enter in Blender, but real cameras will never have the exact values given in the specifications and different lenses even with the same specifications can be built different and have varying results. The camera in Blender is virtual and uses the specifications as if the lens was built perfect or in some way standardized and optimally shaped.

@moonboots Thanks for the suggestion, I'll edit the question to be more specific, I would have tried to use fSpy if I could, but I do not have a coherent strait lines  in the frame to save my life. only random round bricks on the floor near the camera, a lot of plants and trees in the midground, and distant buildings in the background.

you're right, @GordonBrinkmann the real problem is probably optical distortions, but if I can get 95% there, I think it'll be good enough. I can't seem to find a simple solution to the problem, even though it's mostly solved. I want to use tie points - so I can, for example say - this brick is on the model here, and on the image there, and so on...