1
$\begingroup$

By using

bpy.data.objects['object1'].parent = bpy.data.objects['object2']

enter image description here to parent one object to another the parented object gets a weird offset. Why does this happen and how can i fix this?

$\endgroup$
  • $\begingroup$ I asked a similar question before: blender.stackexchange.com/questions/62897/… The method you are using is equivalent to assigning the parent in the "Relations" section. This causes mesh to change location. The other way is using CTRL-P to do the parenting. It looks like the Python code might be: bpy.ops.object.parent_set(...) $\endgroup$ – TTTTTTa Nov 14 '16 at 19:35
  • $\begingroup$ It would be nice if they could eliminate the 5-minute rule for editing comments on this site. Not sure the reasoning behind this. Anyway, here is a link to another questions which looks like it has an explanation to the code: blender.stackexchange.com/questions/26108/… $\endgroup$ – TTTTTTa Nov 14 '16 at 19:44
  • 3
    $\begingroup$ Possible dupe of blender.stackexchange.com/a/29148/15543 $\endgroup$ – batFINGER Nov 15 '16 at 10:09