0
$\begingroup$

i have again tiny problem :(

is it possible in blender python to create an Empty object without lost the selections before it ?

I have selected some objects and when i create an Empty object, I lose the previously set selection.

I hope there's a solution for that.

best regards -DevilSam

$\endgroup$
  • $\begingroup$ I'd try to save the prior selection in my own list, and then after adding an object, restore it from there. $\endgroup$ – Mechanic Dec 26 '18 at 23:22
  • $\begingroup$ own list ? do you mean a object group ?... $\endgroup$ – DevilSam Dec 26 '18 at 23:38
  • $\begingroup$ No, just adding something like old_selection = [] for obj in bpy.context.selected_objects: old_selection.append(obj) #create empty for obj in old_selection: obj.select = True $\endgroup$ – Mechanic Dec 26 '18 at 23:45
  • $\begingroup$ You're welcome. And right after the object creation you can deselect it, or deselect all before restoring the selection with bpy.ops.object.select_all(action='TOGGLE') $\endgroup$ – Mechanic Dec 26 '18 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.