prop.rb - slagyr/limelight GitHub Wiki
remove_all is a function that is designed to delete all of the children of a chosen prop.
Lets say that I have a prop, called structure_container that had 5 child props built inside of it. If I want to get rid of all of them and start over clean with the structure_container, all I would need is this:
def reset_structure
structure_container = scene.find('structure_container') #=> structure_container.children.count == 5
structure_container.remove_all #=> structure_container.children.count == 0
end
build and remove_all are essentially opposites of one another. While remove_all destroys children, build creates new children for a prop.
Keeping the above example, we have just destroyed all of the children of the structure_container. Lets say that we wanted to rebuild 5 children:
def rebuild_structure
structure_container = scene.find('structure_container') #=> structure_container.children.count == 0
5.times do |i|
structure_container.build { structure_child :text => 'newly born child', :id => i }
end
end