Animated material = Driver broken when duplicating object.

Well, I don’t know if this should be in Materials or in animation, because it concerns animated materials :

Still working on my pack of self animated characters for crowd animation, I am building a system allowing to get a new set of materials for characters clothes, each time you duplicate a character and move its starting point. The goal is to get a large diversity of cloth colors without any effort for the user.

I give you a link to a blend file (made with Blender 2.62.3 rev45633).

http://3d-synthesis.com/BlenderTests/ColorDriver_07.blend

If you move the cube in the X or Y direction, you will notice that thanks to the Drivers used by the Cube, the color of the material changes. That’s fine, but if you duplicate the cube, the Driver is broken :

In a first time, you will notice that even if each cube has its own reference (itself) for the driver, they behave the same way, regardless to their location.

One could think that it is due to the fact that they still share the same material index.

So, just make the material of the copy of the original cube a single user : The Driver is broken on the copy of the cube.

Try the opposite : Make the material of the original cube Single User : the original cube driver is broken.

Updating Dependencies in the Driver panel doesn’t solve the problem.

After making the material of the copy a single user,
Instead of

R Diffuse Color
G Diffuse Color
B Diffuse Color

the Drivers panel shows :

"material_slots[“Material”].material.diffuse_color[0]
"material_slots[“Material”].material.diffuse_color[1]
"material_slots[“Material”].material.diffuse_color[2]

I tried to link the material to the object instead of object data, with no more success.

Any idea to make the system work on a copy ?

I made a different system based on mechanically animated drivers, vertex parented to a mesh deformed by a moving texture using the Cube wearing the material, as reference. In the provided example file, just move the Cube to see the effect, and try to duplicate the system and get the driver work on the two Cubes showing different colors.

One more time, duplicating the system breaks the Drivers, even when making the material single user :

http://3d-synthesis.com/BlenderTests/ColorDriver_08.blend

Import process also breaks the material animation :

I tried to import the Cube from ColorDriver_07.blend file into a new file : On the imported cube, the Driver animation doesntt work. Same thing when importing the system from ColorDriver_08.blend file into a new file.

Any idea ? If this is a bug, I would like to report it during the 2.63 RC testing period.

So any opinion would be usefull.

Thanks in advance.

Bad luck : Each time I try to Login on the bugtracker, I get an HTTP error 500…

try changing:
“material_slots[“Material”].material.diffuse_color[0]” to “material_slots[0].material.diffuse_color[0]”

or instead of “0” the slot number your material is on. Haven’t tried that by myself but i just watched that video :https://vimeo.com/40389198 and i think this guy’s tackling the same problem there.

Hi laune ! Thank you very much for this link and solution ! That’s exactly the explanation I was looking for !

I will also say thank you to David Miller. His video is really helpful.

This said, I still think that the thing behaves like a bug. Imho, it is abnormal that duplicating an object or importing it from an other file breaks the driver, when the reference of the driver is the object itself !

I am desperately trying to report that bug, but I always encounter an HTTP 500 internal server error when attempting to login on the Bugtracker pages on Blender.org.

I would want to report that before the end of the 2.63 RC period !

hi,
could the reason for the breaking of the driver in the copied/linked-in object
is the different naming?

Every time the object-names are changing - most times simple with the add of .00#
and then the references are not updated according to this.

As far as i can remember when using drivers for animation i ended with an script running over all created copies and updating the reference objects in the driver.

I never understood this problem complete, but a simple setup
with 2 objects, like the cube and an empty and a driver for the cube with the empty as driver-object (for example to change the scaling …) and then the duplication of this … most times failed.
But if i did setup some parenting and did the duplication of both objects at the same time … sometimes the relations were in sync.

Currently it is a big problem for me, because I have absolutely no ability a coding scripts, and the system I am working on manages currently with 15 characters having each at least 6 materials with drivers attached, and many more are coming.

As the system (I will release it under CC) is intended to allow the easiest possible use to everyone, the characters must work directly when duplicated and when appended from a file without any necessary work from the user.

As far as i can remember when using drivers for animation i ended with an script running over all created copies and updating the reference objects in the driver.

In the case of my characters, the color of the cloth materials will changes accordingly to the location of the characters parent that is duplicated with the character. In the first test file that I provided in this topic, the reference is the object itself and the reference object is correctly changed when duplicated, and despite that the driver is broken.

As I still can’t connect to the Bugtracker for an unknown reason, I sent an e-mail to ideasman42 (Campbell Barton). I hope that he will find it before the release of official 2.63…

@Roubal: did download your sample
and tested it in blender-2.61 !!
i can copy the cube (why does it have no faces? … a questions of bmesh?)
and the new cube gets a driver with an update to the driver-variable
now as cube.001.
Now i can move both and every one will change the material-color, because they
both use the same material.
I changed the default for the copy of objects to do the copy including with the material
and then the driver are broken (the go red-underlined), because the material reference is no more valid and i have to manually change the material reference in the driver to the new created material (with numbering .001 for the first copy). Then an update of the driver enables the driver again and i have a seperate cube with an total separate color-driver and its own material not influenced from the other copies.

But this is for blender-2.61 - so if its different to blender-2.62/3 …
… this is the “payback to live on the bleeding edge of development/evolution” …

for very complicated setups to be copied, duplicated … i still would prefer a scripting tool … but for blender-2.63 i can be no help, i am still trapped in the dungeon of glsl-shaders and opengl pitfalls (this evolution is a pain to, … even i hope now to know what is history and what may be the correct usage – for example this display-list-thing was a total waste of time …).

Hi test-dr, thank you for testing. Well, for the moment I will leave this problem a the side. I have no answer form Campbell. I don’t know if this problem will be seen.

Please could you try to report it to the bugtracker on my behalf, giving with a link to this topic ?

It is very hard to report a bug when I can’t connect to the bugtracker. I have to rely on other people…

I have tried from two computers (on the same network though) using IE8, IE9, Mozilla, Netscape and Safari… with same result : HTTP 500 internal server error. It already happened some time ago, and I never found why it happened.