ParticleSystem::ParticleSystem(const String& name)
    :mName(name),
    mBoundingRadius(1.0f),
    mBoundsAutoUpdate(true),
    mBoundsUpdateTime(10.0f),
    mUpdateRemainTime(0),
    mIsRendererConfigured(false),
    mSpeedFactor(1.0f),
    mIterationInterval(0),
    mIterationIntervalSet(false),
    mSorted(false),
    mLocalSpace(false),
    mNonvisibleTimeout(0),
    mNonvisibleTimeoutSet(false),
    mTimeSinceLastVisible(0),
    mEmittedEmitterPoolInitialised(false),
    mIsEmitting(true),
    mRenderer(0), 
    mCullIndividual(false),
    mPoolSize(0),
    mEmittedEmitterPoolSize(0),
    mAttachedSpatial(0),
    mIsAttached(false)
{
    setDefaultDimensions(100, 100);

    // Default to 10 particles, expect app to specify (will only be increased, not decreased)
    setParticleQuota(10);
    setEmittedEmitterQuota(3);

    // Default to billboard renderer
    setRenderer("billboard");
    mRenderer->setBillboardSetName(name);
}
void ofxSimpleGuiToo::loadFromXML() {
	ofLog(OF_LOG_VERBOSE, "ofxSimpleGuiToo::loadFromXML");// + file);
	
	for(int i=1; i < pages.size(); i++) {
		pages[i]->loadFromXML();
	}
	
	setPage(1);
	setDefaultDimensions();
}
ParticleSystem& ParticleSystem::operator=(const ParticleSystem& rhs)
{
    // Blank this system's emitters & affectors
    removeAllEmitters();
    removeAllEmittedEmitters();
    removeAllAffectors();

    // Copy emitters
    for (unsigned short i = 0; i < rhs.getNumEmitters(); ++i)
    {
        ParticleEmitter* rhsEm = rhs.getEmitter(i);
        ParticleEmitter* newEm = addEmitter(rhsEm->getType());
        rhsEm->copyParametersTo(newEm);
    }

    // Copy affectors
    /*for(unsigned short i = 0; i < rhs.getNumAffectors(); ++i)
    {
        ParticleAffector* rhsAf = rhs.getAffector(i);
        ParticleAffector* newAf = addAffector(rhsAf->getType());
        //rhsAf->copyParametersTo(newAf);
    }*/

    setParticleQuota(rhs.getParticleQuota());
    setEmittedEmitterQuota(rhs.getEmittedEmitterQuota());
    setDefaultDimensions(rhs.mDefaultWidth, rhs.mDefaultHeight);
    mCullIndividual = rhs.mCullIndividual;
    mSorted = rhs.mSorted;
    mLocalSpace = rhs.mLocalSpace;
    mIterationInterval = rhs.mIterationInterval;
    mIterationIntervalSet = rhs.mIterationIntervalSet;
    mNonvisibleTimeout = rhs.mNonvisibleTimeout;
    mNonvisibleTimeoutSet = rhs.mNonvisibleTimeoutSet;
    // last frame visible and time since last visible should be left default

    setRenderer(rhs.getRendererName());
    // Copy settings
    /*if (mRenderer && rhs.getRenderer())
    {
        //rhs.getRenderer()->copyParametersTo(mRenderer);
    }*/

    return *this;
}
void ofxSimpleGuiToo::setDefaultDimensions(ofEventArgs& e){
	setDefaultDimensions();
}