Yes done
Would be useful to expose this variable in the Addon UI to have a quick margin feature.
Blender_Screenwriter.zip (3.4 KB)
Yes done
Would be useful to expose this variable in the Addon UI to have a quick margin feature.
Blender_Screenwriter.zip (3.4 KB)
Thank you. Iâm sorry something is wrong:
Btw. no need for () around margin and no space around + inside ().
Corrected the () and spaces, thank you.
For what i understand the original parser ârequire scene headings to be surrounded by blank linesâ ( maybe the python version too) :
Fountain Syntax about Line Breaks:
https://fountain.io/syntax#section-br
Adding blank lines ( like two carriage returns ) after âSyntax block elementsâ, the formatting is ok.
I also loaded the âBig-Fish.fountainâ by John August and beside the missing syntax elements, the formatting seems ok.
Formatting indications by John August :
Could we use the Courier Prime font? ( SIL Open Font License OFL )
https://johnaugust.com/2013/introducing-courier-prime
Other links about screenplay formatting:
https://en.wikibooks.org/wiki/Movie_Making_Manual/Writing/Screenplay_Format
https://www.oscars.org/nicholl/screenwriting-resources
Last changes:
Blender_Screenwriter.zip (3.4 KB)
Thanks. Letâs use this thread: Blender Screenwriter
The font can be manually set in the Preferences, but setting it with Python is very difficult because finding the right path for the Fonts folder cross platform is not easy.
watching a programming tuto I saw an interesting feature in sublime text the multi cursor. to write at several places at once.
Iâve spend some more hours on updating the essential Auto Complete add-on which also comes with multi-file add-on templates, handling and execution from the Text Editor. I think all of the word and syntax changes has been fixed, but Iâm no good with multi-file add-ons. I know registering has changed in 2.80 and therefore Iâve collected all registering of classes in the init, but I need someone to help me out with doing that part right. Anyone? https://github.com/tin2tin/code_autocomplete
A number of UI fixes ex. more space between line-numbers and code and theming for linenumbers:
Hotstrings:
Here there is a little script that allows the use of hotstrings (text replacement as we type) inside the Blenderâs text editor. Updated to support all python 3 builtins. list, repr, abs, dict, ⌠will add parenthesis automatically.
Download: Text replacement for Blender's text editor (hotstrings)
I donât know if you guys noticed, but in an attempt to raise awareness about the fine Text Editor add-ons here in this thread, I set up at poll. But since the number of votes doesnât reflect the sparse number of clicks to download the add-ons here, I guess the votes only reflect an interest in seeing an add-on with that name in the Text Editor.
Here are the current results: Vote for the essential Text Editor add-ons
Hi I tried some things and thatâs really useful. I wanted to do an addon but it already existed. for incremental autosave. really useful when coding and having some crashesâŚI explain how to configure things there and the addon is in the description or on github in sambler chanel https://www.youtube.com/watch?v=0Oyalp8dXl8
Thank you. Thatâs great to have. No more losing work because of crashes.
Lots of great stuff here!!
I have a self made pie menu I use for the Text Editor (Shift + RMB), very similar to Pistiwiqueâs.
Can somebody help me implement my âDeleteLineâ class?
For the moment, it deletes the line Iâm on and makes a backspace. But it works only on one line.
Iâm struggling to make it delete all the selected lines at once.
class DeleteLine(bpy.types.Operator):
bl_idname = "text.delete_line"
bl_label = "Delete Line"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(self, context):
return context.edit_text is not None
def execute(self, context):
bpy.ops.text.select_line()
bpy.ops.text.delete()
bpy.ops.text.delete(type='PREVIOUS_CHARACTER')
return {'FINISHED'}
Here is my full addon:
PieMenu_Toolbox_SCRIPTING_Text_Editor.py (3.6 KB)
Thanks!
Itâs possible to set text selection using text.select_set
. When the char index argument is -1
, it selects at the end of a line.
class TEXT_OT_delete_line(bpy.types.Operator):
bl_idname = "text.delete_line"
bl_label = "Delete Line"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(self, context):
return getattr(context, "edit_text", False)
def execute(self, context):
text = context.space_data.text
start_l, end_l = sorted((text.current_line_index, text.select_end_line_index))
start_c = end_c = -1
selc = text.select_end_character
if start_l == 0:
end_l += 1
start_c = end_c = 0
if len(text.lines) == 1:
end_c = -1
text.select_set(max(start_l, 1) - 1, start_c, end_l, end_c)
bpy.ops.text.delete(type='PREVIOUS_CHARACTER')
text.cursor_set(start_l, character=selc)
return {'FINISHED'}
Thanks a lot, worked like a charm!
In your API additions, is there an optimized way to âget selectionâ?
There isnât, but sounds like a nice weekend project.
So far Iâve been using this abomination:
def select_get(txt):
curl = txt.current_line_index
sell = txt.select_end_line_index
curc = txt.current_character
selc = txt.select_end_character
a, b = sorted((curl, sell))
selection = [line.body for line in txt.lines[a:b + 1]]
if curl == sell:
curc, selc = sorted((curc, selc))
return "".join(selection)[curc:selc]
if (a, b) != (curl, sell):
curc, selc = selc, curc
selection[0] = selection[0][curc:]
selection[-1] = selection[-1][:selc]
return "\n".join(selection)
edit: wrong one!
A basic âget selected textâ function is missing from the API and blocking for development of built-in operators for the Text Editor in Python. Iceythe/Kaio has submitted at patch to deal with this, so show some love here, if you would find that useful: https://developer.blender.org/D6377
Hi. Sometime I find a script and then I paste it in the text editor and Iâm searching for info in the API. so I was thinking about a way to go to the API directly from right clic when selecting.
In the first post of this thread youâll find a lot of add-ons for the Text Editor including one for searching the API etc. through the right click menu.