Move parent origin only

Hi all,

I have an script where I can move the origin to the bounding box, but the problem comes when I have a child object and run the script, the child object moves too.

Is there a way to tell in the script to move the origin by using the Affect Only Origins and Parents?

Thanks in advance.

import bpy

#you can get settings this way
#bpy.context.scene.tool_settings.use_transform_skip_children = False
#bpy.context.scene.tool_settings.use_transform_data_origin = True

#save original settings 
ts = bpy.context.scene.tool_settings
og_settings = (ts.use_transform_skip_children,ts.use_transform_data_origin)


#change value to your desire
ts.use_transform_skip_children = True
ts.use_transform_data_origin = True

#do something...
print(ts.use_transform_skip_children,ts.use_transform_data_origin)

#revert to original values after execution is done
ts.use_transform_skip_children = og_settings[0]
ts.use_transform_data_origin = og_settings[1]

1 Like

Thank you, I will try to joint it with my code to see if it works.

Basically I’m using as a basecode one guy posted in internet about a pie menu tochange origins (sorry I can’t find the source now)