1
$\begingroup$

So I'm making an animation where I want about a dozen or so objects which all look the same to change their color, but with each object doing it at a different point, making a kind of swipe color change effect. But I don't want to make a bunch of different materials and animate each individual one. Help Please?

$\endgroup$
  • $\begingroup$ Depending on your use case, you could probably use some kind of animated texture, or this addon blenderdiplom.com/en/tutorials/all-tutorials/… $\endgroup$ – gandalf3 Sep 30 '14 at 18:30
  • $\begingroup$ ok so I'm watching that tutorial, and I ran this script that is run at 19:54 and this is the code I have so far: import bpy import math loops = 10 distanceX = 0.1 distanceY = 0 distanceZ = 0 rotationX = 0 rotationY = 0 rotationZ = 0 offset = 3 for i in range(loops): bpy.ops.object.duplicate_move(OBJECT_OT_duplicate = {"linked":False}) obj.location[0] += distanceX obj.location[1] += distanceY obj.location[2] += distanceZ obj.rotation_euler[0] += rotationX obj.rotation_euler[1] += rotationY obj.rotation_euler[2] += rotationZ $\endgroup$ – DragonHeart Sep 30 '14 at 19:24
  • $\begingroup$ Sorry, ran out of characters. So I put that code in, but I get this error: line 17, in <module> NameError: name 'obj' is not defined. That line is this one: obj.location[0] += distanceX HELP! $\endgroup$ – DragonHeart Sep 30 '14 at 19:26
  • $\begingroup$ consider obj = bpy.context.active_object on the line before the error.... this defines the name obj .... perhaps you missed copying a line. This is only to address your syntax error. $\endgroup$ – atomicbezierslinger Oct 1 '14 at 4:01
  • $\begingroup$ oh ok. yah, it didn't have that line. now it works just fine. Thanks! $\endgroup$ – DragonHeart Oct 1 '14 at 16:32
1
$\begingroup$

(01) (Difficult the first time) A color texture influence driver can be used ... with a numeric [custom property] .. 24, 48, 72 and so on ... on the objects ... object data. This would not be a lengthy script. You must locate the target of the script in the outliner datablocks view with great care as depicted below. This requires effort because it is deep hierarchy . Most people I suspect have rarely used the datablocks view. The Blender UI debug info will not behave as desired. Object location x, y, z scripts have better debug info. If you attempt to write a texture driver from the properties window it will fail. Blender will not give warning. Note the driver is located on the Cube object not its material. Below I typed a distinctive numeric value of .678, not 0 or 1,into the field to help me locate it in the datablock view. Note the absence of the driver in the texture panel.

The final render will be correct. Code

frame > 20

enter image description here

(02) Special case .. if the objects are static and identical with simple color... you may be able to join them and UV Map them together. Use a single texture that is an [image sequence] to slide the color across them. Your image sequence may need to be structured as twelve logical strips or color.

(03) Materials and textures are not the same .. I would consider 12 textures ... perhaps copying colors ... and keyframe the color influence of the texture. I am assuming you will not have more than 12. (I am supposed to avoid asking for clarification according to the yellow box text). This would avoid a lengthy script.

(04) The more objects you have the more utility of the driver or script.

$\endgroup$
  • $\begingroup$ Ok so I tried your animated texture method, and it worked just fine. thanks! I also want to try your first one, the pseudo code? where would I type that in? $\endgroup$ – DragonHeart Oct 1 '14 at 16:35
  • $\begingroup$ RMB Right Mouse Button the property and select one of the following options. Add Drivers. ... Blender Link wiki.blender.org/index.php/Doc:2.6/Manual/Animation/Basics/… .. See a video site for newer Blender driver video. ... I suggest you first modify only something simple like the x position of object. (frame * .02) code. The material drivers are not working as expected at this time today. I may post a question here at this site. A new topic might be better. $\endgroup$ – atomicbezierslinger Oct 1 '14 at 17:07
  • $\begingroup$ I am still investigating material driver updates. There are differences from simple position of an object. So (01) of the answer will be updated when I have a clear statement. $\endgroup$ – atomicbezierslinger Oct 1 '14 at 18:07
  • $\begingroup$ @DragonHeart So above is the driver for a material texture color influence. That is not necessarily a recommendation to use it. $\endgroup$ – atomicbezierslinger Oct 1 '14 at 21:21
  • $\begingroup$ Oh wow! thank you so much for your advice! It helps a TON! Thanks! $\endgroup$ – DragonHeart Oct 1 '14 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.