Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.

The script loops through a spline node's ("Spline01") control points and adds bounded "Noise Field" daemons at the points' positions. Furthermore, the script checks if there is a "Noise_Daemons" groups in the scene. If not, a new group will be created:

 

spline         = scene.getSpline("Spline01")
numCP          = spline.getNumberOfControlPoints()
radius         = 2.0
existingGroups = scene.getGroups()
 
if (len(existingGroups) == 0):
	group = scene.addGroup()
	group.setName("Noise_Daemons")
 
else:
	for entry in existingGroups:
		if (entry.getName() == "Noise_Daemons"):
			group = entry
 
		else:
			group = scene.addGroup()
			group.setName("Noise_Daemons")
 
for controlPoint in range(0, numCP):
	cpPosition = spline.getControlPointPosition(controlPoint)
 
	daemon = scene.addDaemon("Noise Field")
 
	daemon.setParameter("Enable falloff", True)
	daemon.setParameter("@ Display falloff", True)
	daemon.setParameter("@ Falloff percent", 0.0)
	daemon.setParameter("@ Falloff bounds", "Sphere")
	daemon.setParameter("Scale", Vector.new(radius, radius, radius))
	daemon.setParameter("Position", cpPosition)
	group.add(daemon.getName())
  • No labels