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?
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]