Versions Compared

Key

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

...

  • 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.

The code: 

Code Block
languagepy
fillObjects    = scene.getSelectedNodes()
dyversoDomain  = scene.add_DY_Domain()
dyversoEmitter = scene.add_DY_Emitter("Fill")

if (len(fillObjects) == 0):
	scene.message("Select exactly one object!")

else:
	for node in fillObjects:

		if (node.getType() == TYPE_OBJECT):
			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")

	scene.reset()