diff options
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e5f826f670d..ffb614fdf11 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -972,19 +972,10 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name) } } -/* more general add: creates minimum required data, but without vertices etc. */ -Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) +void BKE_object_init(Object *ob) { - Object *ob; + /* BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(ob, id)); */ /* ob->type is already initialized... */ - if (!name) - name = get_obdata_defname(type); - - ob = BKE_libblock_alloc(bmain, ID_OB, name); - - /* default object vars */ - ob->type = type; - ob->col[0] = ob->col[1] = ob->col[2] = 1.0; ob->col[3] = 1.0; @@ -1012,7 +1003,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) ob->empty_drawtype = OB_PLAINAXES; ob->empty_drawsize = 1.0; - if (ELEM(type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) { + if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) { ob->trackflag = OB_NEGZ; ob->upflag = OB_POSY; } @@ -1053,6 +1044,22 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) /* Animation Visualization defaults */ animviz_settings_init(&ob->avs); +} + +/* more general add: creates minimum required data, but without vertices etc. */ +Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) +{ + Object *ob; + + if (!name) + name = get_obdata_defname(type); + + ob = BKE_libblock_alloc(bmain, ID_OB, name); + + /* default object vars */ + ob->type = type; + + BKE_object_init(ob); return ob; } |