Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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:

 

Code Block
languagepy
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())