- added text3d.body_format to be able to set bold/italic/smallcaps etc on text.

- the length of a new text object wasnt set on creation.
- tex3d and controllers rna name was being set to its body (rather then ID name)
- remove reference to wave objects which are very old and not used anymore.
This commit is contained in:
2010-07-17 17:50:20 +00:00
parent a3d822f857
commit 1bb0c84236
7 changed files with 10 additions and 18 deletions

View File

@@ -83,7 +83,6 @@ struct Lamp *copy_lamp(struct Lamp *la);
void make_local_lamp(struct Lamp *la); void make_local_lamp(struct Lamp *la);
void free_camera(struct Camera *ca); void free_camera(struct Camera *ca);
void free_lamp(struct Lamp *la); void free_lamp(struct Lamp *la);
void *add_wave(void);
struct Object *add_only_object(int type, char *name); struct Object *add_only_object(int type, char *name);
struct Object *add_object(struct Scene *scene, int type); struct Object *add_object(struct Scene *scene, int type);

View File

@@ -148,7 +148,7 @@ Curve *add_curve(char *name, int type)
cu->vfont->id.us+=4; cu->vfont->id.us+=4;
cu->str= MEM_mallocN(12, "str"); cu->str= MEM_mallocN(12, "str");
strcpy(cu->str, "Text"); strcpy(cu->str, "Text");
cu->pos= 4; cu->len= cu->pos= 4;
cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo new"); cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo new");
cu->totbox= cu->actbox= 1; cu->totbox= cu->actbox= 1;
cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox"); cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");

View File

@@ -948,12 +948,6 @@ void free_lamp(Lamp *la)
la->id.icon_id = 0; la->id.icon_id = 0;
} }
void *add_wave()
{
return 0;
}
/* *************************************************** */ /* *************************************************** */
static void *add_obdata_from_type(int type) static void *add_obdata_from_type(int type)
@@ -967,7 +961,6 @@ static void *add_obdata_from_type(int type)
case OB_CAMERA: return add_camera("Camera"); case OB_CAMERA: return add_camera("Camera");
case OB_LAMP: return add_lamp("Lamp"); case OB_LAMP: return add_lamp("Lamp");
case OB_LATTICE: return add_lattice("Lattice"); case OB_LATTICE: return add_lattice("Lattice");
case OB_WAVE: return add_wave();
case OB_ARMATURE: return add_armature("Armature"); case OB_ARMATURE: return add_armature("Armature");
case OB_EMPTY: return NULL; case OB_EMPTY: return NULL;
default: default:
@@ -987,7 +980,6 @@ static char *get_obdata_defname(int type)
case OB_CAMERA: return "Camera"; case OB_CAMERA: return "Camera";
case OB_LAMP: return "Lamp"; case OB_LAMP: return "Lamp";
case OB_LATTICE: return "Lattice"; case OB_LATTICE: return "Lattice";
case OB_WAVE: return "Wave";
case OB_ARMATURE: return "Armature"; case OB_ARMATURE: return "Armature";
case OB_EMPTY: return "Empty"; case OB_EMPTY: return "Empty";
default: default:

View File

@@ -301,7 +301,7 @@ extern Object workob;
#define OB_LAMP 10 #define OB_LAMP 10
#define OB_CAMERA 11 #define OB_CAMERA 11
#define OB_WAVE 21 // #define OB_WAVE 21
#define OB_LATTICE 22 #define OB_LATTICE 22
/* 23 and 24 are for life and sector (old file compat.) */ /* 23 and 24 are for life and sector (old file compat.) */

View File

@@ -229,7 +229,6 @@ void RNA_def_controller(BlenderRNA *brna)
prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE); prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used"); RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, NC_LOGIC, NULL); RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);

View File

@@ -342,13 +342,13 @@ static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, Pointe
void rna_Curve_body_get(PointerRNA *ptr, char *value) void rna_Curve_body_get(PointerRNA *ptr, char *value)
{ {
Curve *cu= (Curve*)ptr->id.data; Curve *cu= (Curve*)ptr->id.data;
strcpy(value, cu->str); BLI_strncpy(value, cu->str, cu->len+1);
} }
int rna_Curve_body_length(PointerRNA *ptr) int rna_Curve_body_length(PointerRNA *ptr)
{ {
Curve *cu= (Curve*)ptr->id.data; Curve *cu= (Curve*)ptr->id.data;
return strlen(cu->str); return cu->len;
} }
/* TODO - check UTF & python play nice */ /* TODO - check UTF & python play nice */
@@ -357,8 +357,7 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value)
int len= strlen(value); int len= strlen(value);
Curve *cu= (Curve*)ptr->id.data; Curve *cu= (Curve*)ptr->id.data;
cu->pos = len; cu->len= cu->pos = len;
cu->len = len;
if(cu->str) MEM_freeN(cu->str); if(cu->str) MEM_freeN(cu->str);
if(cu->strinfo) MEM_freeN(cu->strinfo); if(cu->strinfo) MEM_freeN(cu->strinfo);
@@ -805,8 +804,12 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_ui_text(prop, "Body Text", "contents of this text object"); RNA_def_property_ui_text(prop, "Body Text", "contents of this text object");
RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set"); RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */ RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, 0, "rna_Curve_update_data"); RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len");
RNA_def_property_struct_type(prop, "TextCharacterFormat");
RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
/* pointers */ /* pointers */
prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE);

View File

@@ -1433,7 +1433,6 @@ static void rna_def_object(BlenderRNA *brna)
{OB_MBALL, "META", 0, "Meta", ""}, {OB_MBALL, "META", 0, "Meta", ""},
{OB_LAMP, "LAMP", 0, "Lamp", ""}, {OB_LAMP, "LAMP", 0, "Lamp", ""},
{OB_CAMERA, "CAMERA", 0, "Camera", ""}, {OB_CAMERA, "CAMERA", 0, "Camera", ""},
{OB_WAVE, "WAVE", 0, "Wave", ""},
{OB_LATTICE, "LATTICE", 0, "Lattice", ""}, {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
{OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};