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:
authorCampbell Barton <ideasman42@gmail.com>2011-04-26 11:17:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-26 11:17:21 +0400
commite4cc1c3f2c3e5a85fbf4f7f2757b09544dd556ee (patch)
tree1d134f4085ba2d90e854c47848c6fc82704667bb /source/blender/blenkernel/intern/mball.c
parent461a7c5c8185d0504c63ddc8de0b2c765e72be4b (diff)
fix [#27178] Material links lost when making mesh data local
- making local object data - Curve/Mesh/MBall lost references to linked materials. - joining a linked mesh object into a local one lost the link. As well as these reported bugs, checked all local functions for consistency/correctness and found other cases which would also fail. - making local metaball didn't ensure unique ID name. - make_local_armature() was missing check for object users - main body of code would never run. - local particles didn't set the dupli-group or textures to extern. checked all local functions for consistency/correctness.
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r--source/blender/blenkernel/intern/mball.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index e19a508658e..555d35726bc 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -67,6 +67,7 @@
#include "BKE_displist.h"
#include "BKE_mball.h"
#include "BKE_object.h"
+#include "BKE_material.h"
/* Global variables */
@@ -139,10 +140,17 @@ MetaBall *copy_mball(MetaBall *mb)
return mbn;
}
+static void extern_local_mball(MetaBall *mb)
+{
+ if(mb->mat) {
+ extern_local_matarar(mb->mat, mb->totcol);
+ }
+}
+
void make_local_mball(MetaBall *mb)
{
+ Main *bmain= G.main;
Object *ob;
- MetaBall *mbn;
int local=0, lib=0;
/* - only lib users: do nothing
@@ -154,37 +162,38 @@ void make_local_mball(MetaBall *mb)
if(mb->id.us==1) {
mb->id.lib= NULL;
mb->id.flag= LIB_LOCAL;
+ new_id(&bmain->mball, (ID *)mb, NULL);
+ extern_local_mball(mb);
+
return;
}
-
- ob= G.main->object.first;
- while(ob) {
- if(ob->data==mb) {
+
+ for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ if(ob->data == mb) {
if(ob->id.lib) lib= 1;
else local= 1;
}
- ob= ob->id.next;
}
if(local && lib==0) {
mb->id.lib= NULL;
mb->id.flag= LIB_LOCAL;
+
+ new_id(&bmain->mball, (ID *)mb, NULL);
+ extern_local_mball(mb);
}
else if(local && lib) {
- mbn= copy_mball(mb);
+ MetaBall *mbn= copy_mball(mb);
mbn->id.us= 0;
-
- ob= G.main->object.first;
- while(ob) {
- if(ob->data==mb) {
-
+
+ for(ob= G.main->object.first; ob; ob= ob->id.next) {
+ if(ob->data == mb) {
if(ob->id.lib==NULL) {
ob->data= mbn;
mbn->id.us++;
mb->id.us--;
}
}
- ob= ob->id.next;
}
}
}