Note: This is a long read, and I've mostly resolved my problem. Your reasons for reading it will be curiosity about a limited critical analysis of blender, or the desire to set me straight if for some reason some part of my understanding is very wrong. ..I'm sure there is a better title for the post.
As a result of a long convoluted process, I realized that my .blend
files were horribly bloated. This post put me onto the reason why. I discovered that each time I load a python file into the blender editor from outside the .blend file, an instance of that file is added to the internal text files stored by that .blend
. If, instead, I use the alternate load option, that goes and gets the file from the "library" of internal text files, it just gets loaded up, no problem.
This question is going to be a bit rambling because most of it's purpose is to allow me to confirm my understanding of how things work, and why.
My understanding of why internal text-blocks (and internal data-blocks in general) exist is so that everything can be said to be well-organized. You do a whole ton of work, and at the end, you have one nice well-organized file. As opposed to a whole directory of different kinds of file, such that it becomes much easier to just miss something if you want to take your work elsewhere. You change operating system, computer, you need a backup, you need to send your work to somebody, etc.
Now.. what happens when I have, say 50 different .py
files, all of which are parts of a larger program? And they all get imported by a master program? If I'm regularly editing them, changing them, I need to have all of them open somewhere somehow. I'm currently using multiple instances of blender to do this. Each blender window has a theme, and contains text-editor tabs with the different .py
files of that theme. I could do all this instead with external text editors, but I've got used to using blender's editor. If people here end up staring at me like I'm some kind of alien, (people give me compelling reasons to..), I could switch over to using (one or multiple) external editors.
One obvious problem with the way I'm doing it is that I know how to import .py
files into my (internal) script from -external- files, as modules with callable functions (def's), but I -don't- know how to import these same files, so that I can call these def's, from -internal- files. [Now, maybe that's actually the default way of doing things.. (importing from -external- files) ->you -do- have to perform the import, after all.] Now, you might not think that is a problem at all. Just import your files from the list of files external to your .blend
file. [Problem: That (partially) negates the benefit of having all your files nicely organized within the .blend
file.]
The real problem here, as I see it, is that this system, as designed, forces you to have duplicates of your files. It seems like in order to have a complex program, all the components of it -must- be stored external to the .blend
file. On the other hand, in order to have these files opened in the blender editor for editing, they must -also- be stored inside the .blend
file that contains the editor you're using for that file.
It also means that if you want to edit a certain file within a given blender window, (remember what I said about each blender window having a theme with related parts of the larger program?), and it isn't currently stored there internally, (and you've forgotten that), you first check for that code in the part of the editor that lists codes stored internally, and if it isn't there, you have to go to the other part of the editor and load it in from the external files. Again, this isn't really a huge problem, it's just a small amount of inefficiency.
Anybody who has read this far will probably call me a nit-picker, and they're probably right. So far, this whole thing originated from my ending up with massive .blend
files because they were storing thousands of .py
text files because I kept on loading up parts of my program from the external files, not realizing that I -should- be loading them up from the -internal- files [at which point, if that file had been changed by some other program, it would inform me -again, small amounts of time lost confirming that yes, indeed, I -do- want the updated file], which meant that it added a numbered copy of that file internally. So I ended up, essentially, with .blend
files that each contained a whole long list of backups. (I have plenty of those already) :-)
It concludes with some relatively simple ways I can change the way I do things (open files the right way, only edit them in one place), and the big question of whether I should abandon the blender text-editor entirely. I've seen opinions that there are other much more powerful editors available. As for dealing with my bloated files, I'm just going to delete them. (After re-creating their essentials in other files). I've read enough posts expounding on the difficulty of effectively cleaning them up. Yay! Problem solved! :-D