Timeline for Python: How to completely remove an object
Current License: CC BY-SA 4.0
29 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Nov 8, 2023 at 23:08 | history | suggested | Iaian7 | CC BY-SA 4.0 |
Adding example from the Blender 3.2 Python API changes and direct links to deprecation notice and temp_override documentation
|
Nov 8, 2023 at 19:26 | review | Suggested edits | |||
S Nov 8, 2023 at 23:08 | |||||
Apr 2, 2019 at 12:43 | comment | added | p2or | Thanks, iterating over scene objects now :) @batFINGER | |
Apr 2, 2019 at 12:39 | history | edited | p2or | CC BY-SA 4.0 |
context override
|
Jan 29, 2019 at 14:23 | comment | added | batFINGER |
Suggest iterate over scene objects, not bpy.data.objects
|
|
Jan 29, 2019 at 13:35 | comment | added | p2or | Yeah right, same here @batFINGER. Thanks for testing, I'll check whether there is some bizarre workaround or mention that. | |
Jan 29, 2019 at 12:45 | comment | added | batFINGER |
2.8 full copy scene, to test run script RuntimeError: Error: Object 'Camera' not in View Layer 'RenderLayer On the global flag, am of the understanding that it will remove same object from all scenes that it is linked to. Wont delete other objects in other scene or from data if not linked to context scene.
|
|
Jan 29, 2019 at 11:39 | comment | added | p2or |
Isn't use_global parameter for such cases? @batFINGER
|
|
Jan 29, 2019 at 11:37 | history | edited | p2or | CC BY-SA 4.0 |
added 26 characters in body
|
Jan 29, 2019 at 11:12 | comment | added | p2or | @TomášHübelbauer Updated the Answer for 2.8x. | |
Jan 29, 2019 at 11:11 | history | edited | p2or | CC BY-SA 4.0 |
2.8 Update, API links
|
Jan 28, 2019 at 23:39 | comment | added | Tomáš Hübelbauer |
FYI I am using Blender 2.8b and Object no longer seems to have the select attribute on it.
|
|
Oct 18, 2018 at 9:48 | comment | added | batFINGER |
Worth noting some objects in bpy.data.objects will never have context (not in context.selected_objects ), eg if not a member of the context scene, will not be removed even when select attribute is set to true when using the delete operator.
|
|
Mar 1, 2018 at 4:05 | comment | added | Amir | @JanRüegg I found a very easy solution to the problem :) I updated my answer in this question too | |
Mar 1, 2018 at 3:11 | comment | added | Amir | @p2or I have some memory leakage issues. While searching, I came across your answer. I wonder, are there better ways (after about two years) to solve memory leakage issues and removing left-out data blocks? Could you please take a look at my question here? I hope you can offer a solution besides saving/opening blender file. Thanks in advance! | |
Apr 13, 2017 at 12:57 | history | edited | CommunityBot |
replaced http://blender.stackexchange.com/ with https://blender.stackexchange.com/
|
|
Mar 14, 2017 at 11:38 | history | edited | p2or | CC BY-SA 3.0 |
spelling
|
Mar 14, 2017 at 11:26 | history | edited | p2or | CC BY-SA 3.0 |
API links, comments, how to remove multiple objects, how to clean up data blocks
|
Jan 9, 2017 at 13:31 | comment | added | anatoly techtonik | It doesn't seem to work if the object is on another layer. | |
Aug 26, 2016 at 9:39 | comment | added | p2or |
@ntg You can set the objects select flag to False for certain objects in the scene/context. For more control go with a for loop instead (for ob in bpy.data.objects: ob.select = False ), which does basically the same as the operator, but allows for instance to exclude objects in order to "avoid" re-selecting ;)
|
|
Aug 26, 2016 at 8:13 | comment | added | ntg | @poor: No question, just an observation.... Running bpy.ops.object.select_all(action='DESELECT') beforehand will deselect everything, "avoiding" it. | |
Aug 25, 2016 at 16:37 | comment | added | p2or |
@ntg Yep, that's the nature of the operator and also mentioned in the answer ...remove selected objects . What's your question? How to avoid that behavior?
|
|
Aug 25, 2016 at 16:11 | comment | added | ntg | if before that you had selected some other object, it will also be selected and then removed... | |
Jul 31, 2015 at 12:43 | history | edited | p2or | CC BY-SA 3.0 |
Added more information
|
Mar 17, 2015 at 12:56 | history | edited | p2or | CC BY-SA 3.0 |
Added more information
|
Mar 17, 2015 at 12:49 | vote | accept | Jan Rüegg | ||
Mar 17, 2015 at 12:48 | comment | added | Jan Rüegg | Ah, good to know, then thats the information I was missing! | |
Mar 17, 2015 at 12:38 | comment | added | Jan Rüegg | Doesn't work, the camera is still available in bpy.data.cameras | |
Mar 17, 2015 at 12:32 | history | answered | p2or | CC BY-SA 3.0 |