4
$\begingroup$

What I'm trying to do is make an animated graph in Blender. I'm using animation nodes to generate text instances for the axis scale labels.

I'm not using 'copy from source' because when I use that, I'm not able to change the text of the object depending on the loop index, I'm just generating text instances. I have everything working fine except for the material.

This would be simple if I was using copy from source, because they could have the material of the source, but since I'm not doing that, I need a way to apply a material to the text instances in the animation node tree, and I can't see how to do this.

Can anyone help with this? Thanks in advance!

Edit:

I was about to post images of my node tree to show what happens when I use 'copy from source' to answer Omar's comment below, but in the course of doing that, I found the problem. Before, when I was using copy from source, all the numbers would be the same. When I have 'deep copy' checked, then the numbers change according to the index. But, if you have 'copy full object' checked, it won't copy the material. So, the solution is to use copy from source, not use copy full object, and use deep copy. Here is my node tree in case this helps anyone. Thanks Omar! enter image description here

$\endgroup$
  • $\begingroup$ Unfortunately, Animation Nodes have no system for dealing with materials as of now. The only solution is by using scripting and I think there are answers here describing this method. But before we get to that, I want to understand why using Copy From Source option won't work. Can you elaborate on "I'm not able to change the text of the object depending on the loop index"? Can you share your current node tree or a simplified version of it? $\endgroup$ – Omar Emara Aug 17 '18 at 14:48
  • $\begingroup$ Glad you were able to solve this yourself. Can you write the solution in an answer? $\endgroup$ – Omar Emara Aug 17 '18 at 16:33
2
$\begingroup$

In order to solve this problem, instead of just using text objects in the object instancer, I used 'copy from source' with 'deep copy' checked, and 'copy full object' unchecked.

This was done in order to apply a material to a set of text object instances, while allowing each of those instances to have different text. 'Deep copy' makes it so that the material of the source is applied to all of the instances, and having 'copy full object' unchecked allows each instance to have different text.

$\endgroup$
  • $\begingroup$ In my case this fails as I cannot guarantee the object name as its generated new by a list variable earlier in the node tree. But thats great to know, thank you $\endgroup$ – 3pointedit Apr 5 at 11:52
2
$\begingroup$

Now Blender 2.8 has Animation Nodes 2.0, as such there is more material handling available. I was able to use Animation Nodes to assign materials to text instances without deep copy. The text instances were created from a text block list making objects with unique names.

I used Object Material Output nodes (labeled 1,2) from a Get List Element node which you can iterate.

Object Material Output node for text Example text color

These materials were defined as Eevee types but it should work with Cycles as well. Note that the Get List Element is an integer index so you can't blend the materials this way.

$\endgroup$

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.