There are many posts that ask the question about the relationship between an object and a bone. The methods differ. Some people do parenting without going through a change of mode(object, edit, pose,…).
Hy everyone,
Do you know how to stop the object from moving at the time of parenting?
def ParentBones() :
print("def ParentBones start")
context = bpy.context
scene = context.scene
objs_select = context.selected_objects
if objs_select is not None :
#ARMATURE
arma = scene.arma_props.obj
bone_name = scene.bones_map[scene.bones_map_index].name
bone = arma.pose.bones.get(bone_name)
for i in objs_select :
if i is arma :
continue
i.parent = arma
bone = arma.pose.bones.get("Bone")
i.parent_bone = bone_name
i.parent_type = 'BONE'
thanks for all your explanations, otherwise I probably wouldn’t have made it.
I don’t know if we can introduce him to the community once he’s clean. Knowing that, not surprisingly, it’s a beginner’s add-on. Just to get a feedback on it of course.