0
$\begingroup$

I'm trying to apply rotation and scale to all objects, but blender apparently doesn't recognize its own functions.

I've copied this answers code and get the following error: 'Object' object has no attribute 'transform_apply'

For such a simple function there seems to be little speak of it, I suppose because no one else is having trouble with it. How do I figure out what's the problem?

import bpy

for obj in bpy.context.selected_editable_objects:
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
$\endgroup$

2 Answers 2

1
$\begingroup$

That error indicates that no objects are selected when the operator is run.

The for loop you show should prevent that, so you must have another copy of that (or another) operator call, or you are trying the one line by itself to get the error.

$\endgroup$
1
  • $\begingroup$ No, I did have everything selected. I also tried iterating through bpy.data.objects. $\endgroup$
    – Downstream
    Sep 14, 2014 at 6:16
1
$\begingroup$

So apparently this was an issue with the .blend I was working with. I appended everything to a new blend and then used the code, this time it worked as intended.

$\endgroup$
2
  • $\begingroup$ might have worked if you used selected_objects instead of selected_editable_objects $\endgroup$
    – Greg Zaal
    Sep 15, 2014 at 12:34
  • $\begingroup$ It did not work. $\endgroup$
    – Downstream
    Sep 16, 2014 at 17:28

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