Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-04-18 12:58:21 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-04-18 12:58:21 +0400
commit4df0c46f838f7c316b10a6667705c093f067cadd (patch)
tree9620cb8dbe215e30a3738509bed50408bca2452d /source/blender/editors
parent093f95afaa4a08d2cf194b88803a35ef16cfec58 (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/editors')
-rw-r--r--source/blender/editors/curve/editfont.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c2
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_constraint.c3
-rw-r--r--source/blender/editors/object/object_hook.c6
-rw-r--r--source/blender/editors/object/object_modifier.c9
-rw-r--r--source/blender/editors/object/object_relations.c4
7 files changed, 16 insertions, 14 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 16e7e0fde4a..f990afcc044 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -56,6 +56,7 @@
#include "BKE_depsgraph.h"
#include "BKE_font.h"
#include "BKE_library.h"
+#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -439,6 +440,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
static void txt_add_object(bContext *C, TextLine *firstline, int totline, float offset[3])
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Curve *cu;
Object *obedit;
@@ -447,7 +449,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
int nchars = 0, a;
float rot[3] = {0.f, 0.f, 0.f};
- obedit = BKE_object_add(scene, OB_FONT);
+ obedit = BKE_object_add(bmain, scene, OB_FONT);
base = scene->basact;
/* seems to assume view align ? TODO - look into this, could be an operator option */
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 9e70fe550bc..efc4acd7c4f 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -537,7 +537,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
if (matmap) MEM_freeN(matmap);
/* other mesh users */
- test_object_materials((ID *)me);
+ test_object_materials(bmain, (ID *)me);
/* free temp copy of destination shapekeys (if applicable) */
if (nkey) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 7ededa50a15..ffdfe053127 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -376,7 +376,7 @@ Object *ED_object_add_type(bContext *C, int type, const float loc[3], const floa
ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */
/* deselects all, sets scene->basact */
- ob = BKE_object_add(scene, type);
+ ob = BKE_object_add(bmain, scene, type);
BASACT->lay = ob->lay = layer;
/* editor level activate, notifiers */
ED_base_object_activate(C, BASACT);
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 3e66c4ca110..2ba5fb24292 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1572,12 +1572,13 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* if still not found, add a new empty to act as a target (if allowed) */
if ((found == 0) && (add)) {
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Base *base = BASACT, *newbase = NULL;
Object *obt;
/* add new target object */
- obt = BKE_object_add(scene, OB_EMPTY);
+ obt = BKE_object_add(bmain, scene, OB_EMPTY);
/* set layers OK */
newbase = BASACT;
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index e3a679e8bc3..69ad3f3225f 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -438,12 +438,12 @@ static int hook_op_edit_poll(bContext *C)
return 0;
}
-static Object *add_hook_object_new(Scene *scene, Object *obedit)
+static Object *add_hook_object_new(Main *bmain, Scene *scene, Object *obedit)
{
Base *base, *basedit;
Object *ob;
- ob = BKE_object_add(scene, OB_EMPTY);
+ ob = BKE_object_add(bmain, scene, OB_EMPTY);
basedit = BKE_scene_base_find(scene, obedit);
base = BKE_scene_base_find(scene, ob);
@@ -473,7 +473,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
- ob = add_hook_object_new(scene, obedit);
+ ob = add_hook_object_new(bmain, scene, obedit);
/* transform cent to global coords for loc */
mul_v3_m4v3(ob->loc, obedit->obmat, cent);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index e89c581a7b6..7d9feec6d78 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -464,7 +464,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
if (totvert == 0) return 0;
/* add new mesh */
- obn = BKE_object_add(scene, OB_MESH);
+ obn = BKE_object_add(bmain, scene, OB_MESH);
me = obn->data;
me->totvert = totvert;
@@ -1721,8 +1721,7 @@ static void skin_armature_bone_create(Object *skin_ob,
}
}
-static Object *modifier_skin_armature_create(struct Scene *scene,
- Object *skin_ob)
+static Object *modifier_skin_armature_create(Main *bmain, Scene *scene, Object *skin_ob)
{
BLI_bitmap edges_visited;
DerivedMesh *deform_dm;
@@ -1745,7 +1744,7 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
NULL,
me->totvert);
- arm_ob = BKE_object_add(scene, OB_ARMATURE);
+ arm_ob = BKE_object_add(bmain, scene, OB_ARMATURE);
BKE_object_transform_copy(arm_ob, skin_ob);
arm = arm_ob->data;
arm->layer = 1;
@@ -1815,7 +1814,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
}
/* create new armature */
- arm_ob = modifier_skin_armature_create(scene, ob);
+ arm_ob = modifier_skin_armature_create(bmain, scene, ob);
/* add a modifier to connect the new armature to the mesh */
arm_md = (ArmatureModifierData *)modifier_new(eModifierType_Armature);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 9ed57adf207..9838c99a81b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -344,7 +344,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
char name[MAX_ID_NAME + 4];
/* Add new object for the proxy */
- newob = BKE_object_add(scene, OB_EMPTY);
+ newob = BKE_object_add(bmain, scene, OB_EMPTY);
BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
@@ -1459,7 +1459,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
ob_dst->data = id;
/* if amount of material indices changed: */
- test_object_materials(ob_dst->data);
+ test_object_materials(bmain, ob_dst->data);
DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;