I have a screen layout in my project file which appears to be corrupt. If I try selecting it via the Blender UI, Blender freezes and I have to quit out of the application.
I would like to remove this screen layout from the project, and I was thinking I could do it in Python with something like this…
…but am unable to do so. I get an “AttributeError: ‘bpy_prop_collection’ object has no attribute ‘remove’” message.
What is the correct syntax to remove a screen layout? Thanks!
**** UPDATE: Here’s an example .blend file that demonstrates the problem. See if you can delete the screen layout called “bad”: [ATTACH]497741[/ATTACH]
That puts a zero next to the bad screen layout in the screen layout dropdown. However, after saving the project file, closing Blender, then reloading the saved project file, the bad screen layout is still there. When I try to select the bad screen layout (either after executing the above code or after reloading the file), Blender still hangs.
Theoretically, that updated code should work, but it doesn’t because it’s first selecting the corrupt scene layout. So running that first line freezes Blender; it never gets to the second line where it deletes the scene layout.
I need a way to remove the corrupt scene layout without actually trying to display it in Blender. I tried going through the Outliner’s Data Blocks but didn’t see a way to delete the scene through there (if there is, please tell me!). That’s why I figured there had to be a way to do it via Python.
Yes may be you can’t delete a layout if you are not on it:
I agree with you: Difficult problem! I don’t know but go to the blender stack-exchange to tell your question to the blender dev…
but I know that the standart layouts can’t to be delete, only new custom layouts.
Great trick! Thanks for figuring that out. Now at least I have a startup file that isn’t corrupted.
OK, now for the trickier part. I’m working with a 112 MB .blend file. It has rigged characters (via BlenRig), tons of animation data, models, lattices and curves that affect models, Python Code (from BlenRig)…just a LOT of data in it. It also has a corrupted screen layout. I am unable to just append a scene into a ‘clean’ file, as Blender crashes when I try that.
I’ve got the following possible folders when I try to append the 112 MB .blend file into a clean .blend file:
Action
Armature
Brush
Camera
Curve
FreestyleLineStyle
Group
Image
Lamp
Lattice
Material
Mesh
MovieClip
NodeTree
Object
Scene
Sound
Text
Texture
World
Do you have any recommendations as far as which order I should append things into the clean file?
I can make some educated guesses on the correct order, but I wanted to first see if there were any “known good” ways to accomplish this before I sink any more time into this particular issue.