From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

TextSaveBug

Doc:2.6 Wiki for Text Editor doesn't mention "make internal" or "Register", but this is where we should put results after bugs are fixed and we have figured it all out. I'd like to know what the "make internal" button does. My hope is that it bundles the python script with the .blend file. That would be sensible.

Summary

  1. filename field does not always reflect active file or file in text window
  2. "Run Script" executes unsaved modifications to file, but doesn't autosave the changes


Results from figuring "make internal" out are in User:Kesten/Projects/TextEditorWiki_Proposal



440p


Discussion:

Suppose that “make internal” creates a chunk in the .blend file. If i give the .blend file to a friend, they should have the .py script avialable in the text-block drop-up menu. If they “save” or “save as”, without making changes, it should save to their disk.

Now, if they make changes to the text-block, what should the behavior be?

I think it would be best if save made changes to both the .blend chunk (internal) and the .py file on disk. Otherwise there will be a version mismatch between internal and disk copies of the script.

Basically “make internal” switches actions to the .blend chunk while “save as” switches editing to the file on disk. “save” is a shortcut to "save as" for disk files. To save a file "made internal" you must use the blender main menu File->Save. To synch the .blend chunk with the disk file, one would “make internal” and then “save as” or vice versa.


The following can be used for debugging and unit testing the Text Editor

Tests

1. Type a few lines in test1.py . Click “save as” . File Browser menu opens. In File Browser type over filename to test2.py . Click save as. Blender returns to text-block view but the name in filename field is still test1.py . Restart blender. test1.py doesn't containt the changes. test2.py does. Expected Result: the filename field should reflect the active file and this should always be the file open in the text window.

2. Make changes to test2.py internal and test3.py disk files. Blender File->Save to textTesting.blend. Restart Blender. Changes were saved to test2.py . The changes to test3.py seem to have been stored in the .blend file, but changes to disk were not made. A “*” by the filename indicates they are out of synch.

3. With test3.py open, add a line and rename it test4.py in the filename field. Click Text->Save. test3.py saves the changes. test4.py is not saved. Expect that changing the name in the filename field would change the active file being worked on and create a new file if it doesn't exist (at least when Text->save is clicked). If this is not the behavior then the filename field should be read-only.

4. Make file test13.py internal, then click the “x” button to unlink the file. It is removed from the drop-up text-buffers menu.

5. Make some changes to a file, then Run Script. The changes are run in the script, but if you quit without saving, those changes were not autosaved. I believe most applications would either autosave upon running, or execute the un-saved text buffer.

Documentation I could find

bpy.ops.text.make_internal() Make active text file internal

make internal patch

2.5 text editor patch

Unanswered blender forum question about “make internal”

GoogleSummerOfCode2008 text work by Qorn
Text: Internal indicates the text is not associated with any file on disk
Text: External indicates the text has been linked from a library .blend file
File: <filename> indicates the text has been saved to/loaded from <filename>
File: * <filename> (unsaved) indicates changes in the text have not yet been saved
This page had been accessed 4,619 times before archiving.

http://wiki.blender.org/index.php/User:Quorn/SummerOfCode2008

http://wiki.blender.org/index.php/Doc:2.4/Manual/Extensions/Python#The_Text_Editor

http://wiki.blender.org/index.php/Doc:2.4/Manual/Extensions/Python/Text_editor

Map of Blender files related to text editor


Many features (like code completion) from the Google Summer of Code 2008 project do not exist in 2.5 or 2.6. Find out what happened to all that code. Check for text plugins/addons.

Bug Tracker

Bug related to undo in text-block

"The following seems to have been fixed at the expense of “make internal” working at all. This todo should be updated if work was done on it. Old todo: text files are default included in .blend files, no support for external text works, nor does it support relative paths [5]"

Bug Tracker searches on “text block editor” and “make internal” give no related results.