0
$\begingroup$

Very new to scripting but utilize it's magic in nearly every .blend

I think most of us are familiar with Quixel's awful naming conventions but to give a sense of size in the Asset Browser, I figured naming by size would be best.

I have hundreds of Objects, and have done this process manually but it would certainly speed up my workflow if anybody had an idea on how to implement a script for All Objects/Selected Objects.

Thanks in advance.

$\endgroup$
2
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Aug 11, 2022 at 11:57
  • $\begingroup$ so you would like to rename or appened all the objects in the outliner with the xyz dimensions like what format do you need? Cube_2.00m_2.00m_2.00m ? 2 decimal places? or no deciaml places? Just appened the dimensions to the name? $\endgroup$ Aug 11, 2022 at 12:02

1 Answer 1

1
$\begingroup$

Since you haven't specified the name formatting you need, I assumed you want to append the dimensions with format _x_y_z

import bpy

def r(v):
    return '_' + str(round(v, 2))

objects = [o for o in bpy.data.objects]

for o in objects:
    if (o.type != "MESH"): continue
    d = o.dimensions
    o.name = o.name + r(d.x) + r(d.y) + r(d.z)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .