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?
Asked
Active
Viewed 1,267 times
2
-
try pressing I over the Eye Icon of the Modifier – HenrikD Nov 08 '17 at 10:35
-
sorry I dont know Animation Nodes but that would be the way I would try to do it – HenrikD Nov 08 '17 at 10:37
-
No that´s not the case. Needs to be added dinamically – Jorge Losilla Martínez Nov 08 '17 at 10:41
-
but it would be not effectively there if you hide it. That was my thought – HenrikD Nov 08 '17 at 10:51
1 Answers
4
The only way to do this is by using scripting, there are three important points to take into consideration when making this:
- Make sure not to add the modifier if it was already added in a previous execution.
- Output the input object and plug it into the attribute output node, making sure you are not editing a modifier before it gets added.
- 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
Omar Emara
- 22,639
- 5
- 55
- 103
