svn merge ^/trunk/blender -r43124:43160
[blender-staging.git] / source / blender / editors / object / object_edit.c
index b3e5232cfdcaef3570e75f1472a61f3fabd96cd7..fcb6e3c361017cd5ee1cb94a6f6f71322f815436 100644 (file)
@@ -1937,16 +1937,21 @@ 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 (name[0] != '\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);
@@ -1967,6 +1972,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)