diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-18 12:58:21 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-18 12:58:21 +0400 |
commit | 4df0c46f838f7c316b10a6667705c093f067cadd (patch) | |
tree | 9620cb8dbe215e30a3738509bed50408bca2452d /source/blender/blenkernel/intern/object.c | |
parent | 093f95afaa4a08d2cf194b88803a35ef16cfec58 (diff) |
Make freestyle use local Main for temporary objects
This means main database is no longer pollutes with
temporary scene and objects needed for freestyle
render.
Actually, there're few of separated temporary mains
now. Ideally it's better to use single one, but it's
not so much trivial to pass it to all classes. Not
so big deal actually.
Required some changes to blender kernel, to make it
possible to add object to a given main, also to
check on mesh materials for objects in given main.
This is all straightforward changes.
As an additional, solved issue with main database
being infinitely polluted with text blocks created
by create_lineset_handler function.
This fixes:
- #35003: Freestyle crashes if user expands objects in FRS1_Scene
- #35012: ctrl+f12 rendering crashes when using Freestyle
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 538cead5d5b..fb950b180a9 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -845,19 +845,19 @@ bool BKE_object_exists_check(Object *obtest) /* *************************************************** */ -void *BKE_object_obdata_add_from_type(int type) +void *BKE_object_obdata_add_from_type(Main *bmain, int type) { switch (type) { - case OB_MESH: return BKE_mesh_add(G.main, "Mesh"); - case OB_CURVE: return BKE_curve_add(G.main, "Curve", OB_CURVE); - case OB_SURF: return BKE_curve_add(G.main, "Surf", OB_SURF); - case OB_FONT: return BKE_curve_add(G.main, "Text", OB_FONT); - case OB_MBALL: return BKE_mball_add(G.main, "Meta"); - case OB_CAMERA: return BKE_camera_add(G.main, "Camera"); - case OB_LAMP: return BKE_lamp_add(G.main, "Lamp"); - case OB_LATTICE: return BKE_lattice_add(G.main, "Lattice"); - case OB_ARMATURE: return BKE_armature_add(G.main, "Armature"); - case OB_SPEAKER: return BKE_speaker_add(G.main, "Speaker"); + case OB_MESH: return BKE_mesh_add(bmain, "Mesh"); + case OB_CURVE: return BKE_curve_add(bmain, "Curve", OB_CURVE); + case OB_SURF: return BKE_curve_add(bmain, "Surf", OB_SURF); + case OB_FONT: return BKE_curve_add(bmain, "Text", OB_FONT); + case OB_MBALL: return BKE_mball_add(bmain, "Meta"); + case OB_CAMERA: return BKE_camera_add(bmain, "Camera"); + case OB_LAMP: return BKE_lamp_add(bmain, "Lamp"); + case OB_LATTICE: return BKE_lattice_add(bmain, "Lattice"); + case OB_ARMATURE: return BKE_armature_add(bmain, "Armature"); + case OB_SPEAKER: return BKE_speaker_add(bmain, "Speaker"); case OB_EMPTY: return NULL; default: printf("BKE_object_obdata_add_from_type: Internal error, bad type: %d\n", type); @@ -972,16 +972,16 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) /* general add: to scene, with layer from area and default name */ /* creates minimum required data, but without vertices etc. */ -Object *BKE_object_add(struct Scene *scene, int type) +Object *BKE_object_add(Main *bmain, Scene *scene, int type) { Object *ob; Base *base; char name[MAX_ID_NAME]; BLI_strncpy(name, get_obdata_defname(type), sizeof(name)); - ob = BKE_object_add_only_object(G.main, type, name); + ob = BKE_object_add_only_object(bmain, type, name); - ob->data = BKE_object_obdata_add_from_type(type); + ob->data = BKE_object_obdata_add_from_type(bmain, type); ob->lay = scene->lay; |