0

The console results are correct, The result of running the script is wrong

I want to know what the problem is and run it in the script

def func(listTemp, n):
for i in range(0, len(listTemp), n):

    yield listTemp[i:i + n]  

def ins1():

a=bpy.data.meshes[0]

b=bpy.data.objects

d = [x for ob in bpy.data.objects for x in ob.dimensions]

temp=func(d,3)

e=[]

for i in temp:

    e.append(i)

for x,y in zip(b,e):

    x.dimensions=y

for w in b:

    w.data=a

return(e)

aa=ins1()

def ins2():

b=bpy.data.objects

for x,y in zip(b,aa):

    x.dimensions=y

return

ins2()

DaTuDou
  • 41
  • 3
  • 4
    What do you expect? Please elaborate on your goal: https://blender.stackexchange.com/help/how-to-ask – brockmann Aug 26 '21 at 10:27
  • 2
    Descriptive names of your functions and variables would also help us help you. – Markus von Broady Aug 26 '21 at 10:32
  • 1
    Very likely https://blender.stackexchange.com/questions/234020/exporting-data-looping-through-objects-gets-wrong-data-for-very-last-object/234068#234068 or https://blender.stackexchange.com/questions/234254/setting-translation-overrides-scaling running in the python console updates per line. To reiterate advice in those answers is use scale not dimension. – batFINGER Aug 26 '21 at 11:03
  • Thank you very much. I found the reason dimensions need "bpy.context.view_layer.update()", location,rotation,scale do not need. – DaTuDou Aug 27 '21 at 01:06

0 Answers0