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:
authorJohnny Matthews <johnny.matthews@gmail.com>2005-02-24 22:22:31 +0300
committerJohnny Matthews <johnny.matthews@gmail.com>2005-02-24 22:22:31 +0300
commit5519157c86df8de08e31fe0ccf588b402ec11f30 (patch)
treea84ca790d269f4d70ba4b056225e4fd607687076 /source/blender/src/editfont.c
parent386f390ab8ae9a13b1b31fa4cd5a0f01546415eb (diff)
This is an initial commit for inserting a text file as one 3d text object per line. The function for making the objects aligned to the screen needs to be added, since right now it is aligning rotation to the screen but translation is not right since I am adding an offset to the non-viewport location of the objects. That offset just needs to be translated to screen first.
Diffstat (limited to 'source/blender/src/editfont.c')
-rw-r--r--source/blender/src/editfont.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c
index fec40995a2c..2c5be982b7a 100644
--- a/source/blender/src/editfont.c
+++ b/source/blender/src/editfont.c
@@ -52,6 +52,7 @@
#include "DNA_vfont_types.h"
#include "DNA_scene_types.h"
#include "DNA_text_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_displist.h"
#include "BKE_font.h"
@@ -312,6 +313,72 @@ void txt_export_to_object(struct Text *text)
}
+void txt_export_to_objects(struct Text *text)
+{
+ ID *id;
+ Curve *cu;
+ struct TextLine *tmp, *curline;
+ int nchars;
+ int linNum = 0;
+
+ if(!text) return;
+
+ id = (ID *)text;
+
+ if (G.obedit && G.obedit->type==OB_FONT) return;
+ check_editmode(OB_FONT);
+
+ curline = text->lines.first;
+ while(curline){
+ /*skip lines with no text, but still make space for them*/
+ if(curline->line[0] == '\0'){
+ linNum++;
+ curline = curline->next;
+ continue;
+ }
+
+
+ nchars = 0;
+ add_object(OB_FONT);
+
+ base_init_from_view3d(BASACT, G.vd);
+ G.obedit= BASACT->object;
+ where_is_object(G.obedit);
+
+
+ /* Do the translation */
+
+ G.obedit->loc[1] -= linNum;
+
+ /* End Translation */
+
+
+ cu= G.obedit->data;
+
+ cu->vfont= get_builtin_font();
+ cu->vfont->id.us++;
+
+ nchars = strlen(curline->line) + 1;
+
+ if(cu->str) MEM_freeN(cu->str);
+
+ cu->str= MEM_mallocN(nchars+4, "str");
+
+ strcpy(cu->str, curline->line);
+ cu->len= strlen(curline->line);
+ cu->pos= cu->len;
+
+
+ make_editText();
+ exit_editmode(1);
+
+ linNum++;
+ curline = curline->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+
void do_textedit(unsigned short event, short val, char _ascii)
{
Curve *cu;