This patch creates an interface for ["Text"] properties in Font objects.
[blender.git] / source / blender / editors / object / object_edit.c
index 658f4acf940beb482cf012ea102d46bedb9a7a7f..6e1a4ba6cf2d7157f60d87ce5e5bf06acdca39a7 100644 (file)
@@ -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)