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:
authorDalai Felinto <dfelinto@gmail.com>2012-01-05 01:40:00 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-01-05 01:40:00 +0400
commitbe025ea31985f7614106b47a519d6e678a19fb95 (patch)
tree369a126b807ff727a7faf624314e0389e5a9e5c5 /source/blender/editors
parent049ab984697aa277c476833670275624c4385257 (diff)
This patch creates an interface for ["Text"] properties in Font objects.
Interface: http://www.pasteall.org/pic/show.php?id=23785 Simple test file: http://www.pasteall.org/blend/10616 (I'll commit this to the text suite later) Code Explanation: --------------- (1) it adds a toggle to add/remove a "Text" gameproperty. - internally this property is just another game property (so we can find it within the game.properties lookup). - the property itself has no 'value', the interface shows the content of ob.data.body instead (why? because gameproperties are per object, while the text is per data). (2) at BGE converter time it sets the current value of the object.data.body to the ["Text"] property. (3) if you change object.text (bge text property) it automatically convert ["Text"] to a CStringValue. *** that means if the original property was a CIntegerValue, it will be converted to CStringValue forever *** * the only to do I can think of is to add a warning at doversion time if user has ["Text"] property for a Font object * * when that happens we print a warning in console/popup.*
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_edit.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 658f4acf940..6e1a4ba6cf2 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1936,16 +1936,23 @@ void ED_object_toggle_modes(bContext *C, int mode)
/************************ Game Properties ***********************/
-static int game_property_new(bContext *C, wmOperator *UNUSED(op))
+static int game_property_new(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
bProperty *prop;
+ char name[32];
+ int type= RNA_enum_get(op->ptr, "type");
if(!ob)
return OPERATOR_CANCELLED;
- prop= new_property(PROP_FLOAT);
+ prop= new_property(type);
BLI_addtail(&ob->prop, prop);
+
+ RNA_string_get(op->ptr, "name", name);
+ if(BLI_strnlen(name, 32) > 0)
+ BLI_strncpy(prop->name, name, sizeof(prop->name));
+
unique_property(NULL, prop, 0); // make_unique_prop_names(prop->name);
WM_event_add_notifier(C, NC_LOGIC, NULL);
@@ -1966,6 +1973,9 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_enum(ot->srna, "type", gameproperty_type_items, 2, "Type", "Type of game property to add");
+ RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the game property to add");
}
static int game_property_remove(bContext *C, wmOperator *op)