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 6 Next »

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

The script automatically fills a selected object (select exactly one closed object, e.g. a cube, sphere, or torus) with Dyverso particles. For this process a fill object and a collision object is needed:

  • A Dyverso domain and a "Fill" emitter are added and linked in the "Relationship Editor".
  • The object's "Volume" is set to "Solid inside" to make it fillable.
  • The object is attached to the Dyverso emitter and then unlinked from the "Relationship Editor", because it is only used to create the particles.
  • The object is copied and its "Volume mode" is set to "Solid outside" – now the copied objects acts as a collision object.
  • The scene is reset to add the particles.

 

fillObjects = scene.getSelectedNodes()


if (len(fillObjects) != 1):
	scene.message("Select one closed object!")

else:
	for node in fillObjects:
		if (node.getType() == TYPE_OBJECT):
			dyversoDomain  = scene.add_DY_Domain()
			dyversoEmitter = scene.add_DY_Emitter("Fill")

			dyversoEmitter.setParameter("Object", node.getName())
			node.setParameter("Volume mode", "Solid inside")

			scene.removeGlobalLink(node)
			scene.addExclusiveLink(dyversoDomain, dyversoEmitter)

			nodeCopy = node.clone()
			nodeCopy.setParameter("Volume mode", "Solid outside")

		else:
			scene.message("You must select an object.")

	scene.reset()
  • No labels