Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2013-09-11 11:23:23 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2013-09-11 11:23:23 +0400
commit801b8430a29a2c3a7fd2bd460414b8bb071ea617 (patch)
treeb1988fe333d37bcb22d9945495a7ff8fdca2f4d7 /source/blender/makesrna/intern/rna_text.c
parent2f6c748bb9eabbd6c3e54d45091b0381d6bc3556 (diff)
Add read-only access to index data for current line, top line and visible lines count.
Diffstat (limited to 'source/blender/makesrna/intern/rna_text.c')
-rw-r--r--source/blender/makesrna/intern/rna_text.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index df6181af4b2..3ba6550c400 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -81,6 +81,19 @@ static int rna_Text_modified_get(PointerRNA *ptr)
return text_file_modified(text);
}
+static int rna_Text_current_line_index_get(PointerRNA *ptr)
+{
+ Text *text = (Text *)ptr->data;
+ TextLine *linep = text->lines.first;
+ int i = 0;
+ while(linep) {
+ if(text->curl==linep) break;
+ linep = linep->next;
+ i++;
+ }
+ return i;
+}
+
static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
{
TextLine *line = (TextLine *)ptr->data;
@@ -141,6 +154,11 @@ static void rna_def_text(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Text", "Text datablock referencing an external or packed text file");
RNA_def_struct_ui_icon(srna, ICON_TEXT);
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+
+ prop = RNA_def_property(srna, "current_line_index", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_Text_current_line_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Current Line Index", "Index of current TextLine in TextLine collection");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");