# Is it possible to add modifiers dynamically with animation nodes?

To add modifiers dynamically, I know that one can modify values of existing modifier via attribute output node. Can this node be used to create modifiers or does it need some sort of scripting?

• try pressing I over the Eye Icon of the Modifier – HenrikD Nov 8 '17 at 10:35
• sorry I dont know Animation Nodes but that would be the way I would try to do it – HenrikD Nov 8 '17 at 10:37
• No that´s not the case. Needs to be added dinamically – Jorge Losilla Martínez Nov 8 '17 at 10:41
• but it would be not effectively there if you hide it. That was my thought – HenrikD Nov 8 '17 at 10:51

The only way to do this is by using scripting, there are three important points to take into consideration when making this:

1. Make sure not to add the modifier if it was already added in a previous execution.
2. Output the input object and plug it into the attribute output node, making sure you are not editing a modifier before it gets added.
3. The modifier name should never be an empty text because then blender will automatically add a name and our first test will fail, so we should set a fallback value.

Making sure we got those three points right, we can write a code like this:

modifierName = modifierName if modifierName != "" else "Fallback"
if not modifierName in object.modifiers:
object.modifiers.new(modifierName, 'ARRAY')
outObject = object


• Great!!! This was what I was looking for. – Jorge Losilla Martínez Nov 8 '17 at 13:37