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:
-rw-r--r--source/blender/blenkernel/BKE_group.h5
-rw-r--r--source/blender/blenkernel/BKE_object.h5
-rw-r--r--source/blender/blenkernel/intern/group.c8
-rw-r--r--source/blender/blenkernel/intern/library_remap.c10
-rw-r--r--source/blender/blenkernel/intern/object.c10
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c6
-rw-r--r--source/blender/editors/object/object_group.c24
-rw-r--r--source/blender/editors/object/object_relations.c4
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c2
-rw-r--r--source/blender/editors/physics/rigidbody_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_group.c3
12 files changed, 45 insertions, 40 deletions
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index 9e1ad1bc789..9824814990f 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -46,8 +46,9 @@ void BKE_group_copy_data(struct Main *bmain, struct Group *group_dst, c
struct Group *BKE_group_copy(struct Main *bmain, const struct Group *group);
void BKE_group_make_local(struct Main *bmain, struct Group *group, const bool lib_local);
bool BKE_group_object_add(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
-bool BKE_group_object_unlink(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
-struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
+bool BKE_group_object_unlink(
+ struct Main *bmain, struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
+struct Group *BKE_group_object_find(struct Main *bmain, struct Group *group, struct Object *ob);
bool BKE_group_object_exists(struct Group *group, struct Object *ob);
bool BKE_group_object_cyclic_check(struct Main *bmain, struct Object *object, struct Group *group);
bool BKE_group_is_animated(struct Group *group, struct Object *parent);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 51cfc5b0087..677d6b3fba2 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -283,8 +283,9 @@ typedef enum eObjectSet {
struct LinkNode *BKE_object_relational_superset(
struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter);
-struct LinkNode *BKE_object_groups(struct Object *ob);
-void BKE_object_groups_clear(struct Scene *scene, struct Base *base, struct Object *object);
+struct LinkNode *BKE_object_groups(struct Main *bmain, struct Object *ob);
+void BKE_object_groups_clear(
+ struct Main *bmain, struct Scene *scene, struct Base *base, struct Object *object);
struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 578aa97c255..f268c419e2f 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -223,11 +223,11 @@ bool BKE_group_object_cyclic_check(Main *bmain, Object *object, Group *group)
return group_object_cyclic_check_internal(object, group);
}
-bool BKE_group_object_unlink(Group *group, Object *object, Scene *scene, Base *base)
+bool BKE_group_object_unlink(Main *bmain, Group *group, Object *object, Scene *scene, Base *base)
{
if (group_object_unlink_internal(group, object)) {
/* object can be NULL */
- if (object && BKE_group_object_find(NULL, object) == NULL) {
+ if (object && BKE_group_object_find(bmain, NULL, object) == NULL) {
if (scene && base == NULL)
base = BKE_scene_base_find(scene, object);
@@ -253,12 +253,12 @@ bool BKE_group_object_exists(Group *group, Object *ob)
}
}
-Group *BKE_group_object_find(Group *group, Object *ob)
+Group *BKE_group_object_find(Main *bmain, Group *group, Object *ob)
{
if (group)
group = group->id.next;
else
- group = G.main->group.first;
+ group = bmain->group.first;
while (group) {
if (BKE_group_object_exists(group, ob))
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 8a64c0f8662..2a70e53be92 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -335,12 +335,12 @@ static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *o
* - unlinked old_ob (i.e. new_ob is NULL), in which case scenes' bases have been removed already.
* - remapped old_ob by new_ob, in which case scenes' bases are still valid as is.
* So in any case, no need to update them here. */
- if (BKE_group_object_find(NULL, old_ob) == NULL) {
+ if (BKE_group_object_find(bmain, NULL, old_ob) == NULL) {
old_ob->flag &= ~OB_FROMGROUP;
}
if (new_ob == NULL) { /* We need to remove NULL-ified groupobjects... */
for (Group *group = bmain->group.first; group; group = group->id.next) {
- BKE_group_object_unlink(group, NULL, NULL, NULL);
+ BKE_group_object_unlink(bmain, group, NULL, NULL, NULL);
}
}
else {
@@ -356,7 +356,7 @@ static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *o
}
}
-static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmain), Scene *sce, ID *old_id)
+static void libblock_remap_data_postprocess_group_scene_unlink(Main *bmain, Scene *sce, ID *old_id)
{
/* Note that here we assume no object has no base (i.e. all objects are assumed instanced
* in one scene...). */
@@ -365,11 +365,11 @@ static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmai
Object *ob = base->object;
if (ob->flag & OB_FROMGROUP) {
- Group *grp = BKE_group_object_find(NULL, ob);
+ Group *grp = BKE_group_object_find(bmain, NULL, ob);
/* Unlinked group (old_id) is still in bmain... */
if (grp && (&grp->id == old_id || grp->id.us == 0)) {
- grp = BKE_group_object_find(grp, ob);
+ grp = BKE_group_object_find(bmain, grp, ob);
}
if (!grp) {
ob->flag &= ~OB_FROMGROUP;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9178b889062..1944b01827b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3384,18 +3384,18 @@ LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectS
/**
* return all groups this object is apart of, caller must free.
*/
-struct LinkNode *BKE_object_groups(Object *ob)
+struct LinkNode *BKE_object_groups(Main *bmain, Object *ob)
{
LinkNode *group_linknode = NULL;
Group *group = NULL;
- while ((group = BKE_group_object_find(group, ob))) {
+ while ((group = BKE_group_object_find(bmain, group, ob))) {
BLI_linklist_prepend(&group_linknode, group);
}
return group_linknode;
}
-void BKE_object_groups_clear(Scene *scene, Base *base, Object *object)
+void BKE_object_groups_clear(Main *bmain, Scene *scene, Base *base, Object *object)
{
Group *group = NULL;
@@ -3405,8 +3405,8 @@ void BKE_object_groups_clear(Scene *scene, Base *base, Object *object)
base = BKE_scene_base_find(scene, object);
}
- while ((group = BKE_group_object_find(group, base->object))) {
- BKE_group_object_unlink(group, object, scene, base);
+ while ((group = BKE_group_object_find(bmain, group, base->object))) {
+ BKE_group_object_unlink(bmain, group, object, scene, base);
}
}
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 97d2280c021..4201bf3d3fb 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -581,7 +581,7 @@ static const DupliGenerator gen_dupli_verts = {
};
/* OB_DUPLIVERTS - FONT */
-static Object *find_family_object(const char *family, size_t family_len, unsigned int ch, GHash *family_gh)
+static Object *find_family_object(Main *bmain, const char *family, size_t family_len, unsigned int ch, GHash *family_gh)
{
Object **ob_pt;
Object *ob;
@@ -598,7 +598,7 @@ static Object *find_family_object(const char *family, size_t family_len, unsigne
ch_utf8[ch_utf8_len] = '\0';
ch_utf8_len += 1; /* compare with null terminator */
- for (ob = G.main->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (STREQLEN(ob->id.name + 2 + family_len, ch_utf8, ch_utf8_len)) {
if (STREQLEN(ob->id.name + 2, family, family_len)) {
break;
@@ -655,7 +655,7 @@ static void make_duplis_font(const DupliContext *ctx)
/* advance matching BLI_strncpy_wchar_from_utf8 */
for (a = 0; a < text_len; a++, ct++) {
- ob = find_family_object(cu->family, family_len, (unsigned int)text[a], family_gh);
+ ob = find_family_object(ctx->bmain, cu->family, family_len, (unsigned int)text[a], family_gh);
if (ob) {
vec[0] = fsize * (ct->xof - xof);
vec[1] = fsize * (ct->yof - yof);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4df79250125..d172dd685eb 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7582,9 +7582,9 @@ static void direct_link_group(FileData *fd, Group *group)
group->preview = direct_link_preview_image(fd, group->preview);
}
-static void lib_link_group(FileData *fd, Main *main)
+static void lib_link_group(FileData *fd, Main *bmain)
{
- for (Group *group = main->group.first; group; group = group->id.next) {
+ for (Group *group = bmain->group.first; group; group = group->id.next) {
if (group->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(group->id.properties, fd);
@@ -7601,7 +7601,7 @@ static void lib_link_group(FileData *fd, Main *main)
if (add_us) {
id_us_ensure_real(&group->id);
}
- BKE_group_object_unlink(group, NULL, NULL, NULL); /* removes NULL entries */
+ BKE_group_object_unlink(bmain, group, NULL, NULL, NULL); /* removes NULL entries */
group->id.tag &= ~LIB_TAG_NEED_LINK;
}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index e5accee171a..c764ee22162 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -65,6 +65,7 @@
/* can be called with C == NULL */
static const EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
+ Main *bmain = CTX_data_main(C);
Object *ob;
EnumPropertyItem *item = NULL, item_tmp = {0};
int totitem = 0;
@@ -82,7 +83,7 @@ static const EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA
/* if 2 or more groups, add option to add to all groups */
group = NULL;
- while ((group = BKE_group_object_find(group, ob)))
+ while ((group = BKE_group_object_find(bmain, group, ob)))
count++;
if (count >= 2) {
@@ -94,7 +95,7 @@ static const EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA
/* add groups */
group = NULL;
- while ((group = BKE_group_object_find(group, ob))) {
+ while ((group = BKE_group_object_find(bmain, group, ob))) {
item_tmp.identifier = item_tmp.name = group->id.name + 2;
/* item_tmp.icon = ICON_ARMATURE_DATA; */
item_tmp.value = i;
@@ -110,11 +111,11 @@ static const EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA
}
/* get the group back from the enum index, quite awkward and UI specific */
-static Group *group_object_active_find_index(Object *ob, const int group_object_index)
+static Group *group_object_active_find_index(Main *bmain, Object *ob, const int group_object_index)
{
Group *group = NULL;
int i = 0;
- while ((group = BKE_group_object_find(group, ob))) {
+ while ((group = BKE_group_object_find(bmain, group, ob))) {
if (i == group_object_index) {
break;
}
@@ -130,7 +131,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int single_group_index = RNA_enum_get(op->ptr, "group");
- Group *single_group = group_object_active_find_index(ob, single_group_index);
+ Group *single_group = group_object_active_find_index(bmain, ob, single_group_index);
Group *group;
bool is_cycle = false;
bool updated = false;
@@ -203,7 +204,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *ob = OBACT;
int single_group_index = RNA_enum_get(op->ptr, "group");
- Group *single_group = group_object_active_find_index(ob, single_group_index);
+ Group *single_group = group_object_active_find_index(bmain, ob, single_group_index);
Group *group;
bool ok = false;
@@ -221,7 +222,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
/* Remove groups from selected objects */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- BKE_group_object_unlink(group, base->object, scene, base);
+ BKE_group_object_unlink(bmain, group, base->object, scene, base);
ok = 1;
}
CTX_DATA_END;
@@ -268,7 +269,7 @@ static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- BKE_object_groups_clear(scene, base, base->object);
+ BKE_object_groups_clear(bmain, scene, base, base->object);
}
CTX_DATA_END;
@@ -299,7 +300,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int single_group_index = RNA_enum_get(op->ptr, "group");
- Group *single_group = group_object_active_find_index(ob, single_group_index);
+ Group *single_group = group_object_active_find_index(bmain, ob, single_group_index);
Group *group;
bool updated = false;
@@ -315,7 +316,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
/* now remove all selected objects from the group */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- BKE_group_object_unlink(group, base->object, scene, base);
+ BKE_group_object_unlink(bmain, group, base->object, scene, base);
updated = true;
}
CTX_DATA_END;
@@ -490,6 +491,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_context(C);
Group *group = CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
@@ -497,7 +499,7 @@ static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
if (!ob || !group)
return OPERATOR_CANCELLED;
- BKE_group_object_unlink(group, ob, scene, NULL); /* base will be used if found */
+ BKE_group_object_unlink(bmain, group, ob, scene, NULL); /* base will be used if found */
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 727b7d69723..15939f80535 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1550,7 +1550,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* avoid searching all groups in source object each time */
if (type == MAKE_LINKS_GROUP) {
- ob_groups = BKE_object_groups(ob_src);
+ ob_groups = BKE_object_groups(bmain, ob_src);
}
CTX_DATA_BEGIN (C, Base *, base_dst, selected_editable_bases)
@@ -1598,7 +1598,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
LinkNode *group_node;
/* first clear groups */
- BKE_object_groups_clear(scene, base_dst, ob_dst);
+ BKE_object_groups_clear(bmain, scene, base_dst, ob_dst);
/* now add in the groups from the link nodes */
for (group_node = ob_groups; group_node; group_node = group_node->next) {
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index 412f9acf718..85478673f96 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -101,7 +101,7 @@ void ED_rigidbody_constraint_remove(Main *bmain, Scene *scene, Object *ob)
BKE_rigidbody_remove_constraint(scene, ob);
if (rbw)
- BKE_group_object_unlink(rbw->constraints, ob, scene, NULL);
+ BKE_group_object_unlink(bmain, rbw->constraints, ob, scene, NULL);
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index b7083c29721..fa7298489b1 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -132,7 +132,7 @@ void ED_rigidbody_object_remove(Main *bmain, Scene *scene, Object *ob)
BKE_rigidbody_remove_object(scene, ob);
if (rbw)
- BKE_group_object_unlink(rbw->group, ob, scene, NULL);
+ BKE_group_object_unlink(bmain, rbw->group, ob, scene, NULL);
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 0ce0611fcc2..87e35ca4102 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -65,7 +65,8 @@ static void rna_Group_objects_link(Group *group, bContext *C, ReportList *report
static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *reports, Object *object)
{
- if (!BKE_group_object_unlink(group, object, CTX_data_scene(C), NULL)) {
+ Main *bmain = CTX_data_main(C);
+ if (!BKE_group_object_unlink(bmain, group, object, CTX_data_scene(C), NULL)) {
BKE_reportf(reports, RPT_ERROR, "Object '%s' not in group '%s'", object->id.name + 2, group->id.name + 2);
return;
}