Fix T55260: load Text File with Python from GUI Button results in 0 User
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 4 Jun 2018 10:46:59 +0000 (12:46 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 4 Jun 2018 10:46:59 +0000 (12:46 +0200)
Let's just always ensure user_one when loading text from operator...

source/blender/editors/space_text/text_ops.c

index fe15d9165b77a704c0ffc6beb0f658e0879c46a3..3c2d3c557f66bc24135c86b366a2990f053b1b5f 100644 (file)
@@ -247,15 +247,15 @@ static int text_open_exec(bContext *C, wmOperator *op)
        /* hook into UI */
        pprop = op->customdata;
 
+       id_us_ensure_real(&text->id);
+
        if (pprop->prop) {
-               id_us_ensure_real(&text->id);
                RNA_id_pointer_create(&text->id, &idptr);
                RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
                RNA_property_update(C, &pprop->ptr, pprop->prop);
        }
        else if (st) {
                st->text = text;
-               id_us_ensure_real(&text->id);
                st->left = 0;
                st->top = 0;
                st->scroll_accum[0] = 0.0f;