mirror of https://github.com/axmolengine/axmol.git
Merge pull request #306 from songchengjiang/v3
enable users to clone PUParticleSystem3D
This commit is contained in:
commit
56276458b6
|
@ -187,10 +187,13 @@ float PUAffector::getMass() const
|
|||
void PUAffector::copyAttributesTo( PUAffector* affector )
|
||||
{
|
||||
affector->setName(_name);
|
||||
affector->setAffectorType(_affectorType);
|
||||
affector->_position = _position;
|
||||
affector->_isEnabled = _isEnabled;
|
||||
affector->_particleSystem = _particleSystem;
|
||||
affector->_affectorScale = _affectorScale;
|
||||
affector->_affectSpecialisation = _affectSpecialisation;
|
||||
affector->_excludedEmitters = _excludedEmitters;
|
||||
}
|
||||
|
||||
void PUAffector::addEmitterToExclude( const std::string& emitterName )
|
||||
|
|
|
@ -890,6 +890,10 @@ void PUEmitter::copyAttributesTo( PUEmitter* emitter )
|
|||
emitter->setEmitterType(_emitterType);
|
||||
emitter->setEmitsName(_emitsName);
|
||||
emitter->setEmitsType(_emitsType);
|
||||
emitter->_position = _position;
|
||||
emitter->_isEnabled = _isEnabled;
|
||||
emitter->_originEnabled = _originEnabled;
|
||||
emitter->_originEnabledSet = _originEnabledSet;
|
||||
emitter->_particleDirection = _particleDirection;
|
||||
emitter->_originalParticleDirection = _originalParticleDirection;
|
||||
emitter->_particleOrientation = _particleOrientation;
|
||||
|
|
|
@ -317,6 +317,7 @@ void PUObserver::copyAttributesTo( PUObserver* observer )
|
|||
{
|
||||
// Copy attributes
|
||||
observer->setName(_name);
|
||||
observer->setObserverType(_observerType);
|
||||
observer->_particleTypeToObserve = _particleTypeToObserve;
|
||||
observer->_particleTypeToObserveSet = _particleTypeToObserveSet;
|
||||
observer->_particleSystem = _particleSystem;
|
||||
|
|
|
@ -1051,7 +1051,8 @@ void PUParticleSystem3D::copyAttributesTo( PUParticleSystem3D* system )
|
|||
|
||||
system->setName(_name);
|
||||
system->_state = _state;
|
||||
system->setRender(static_cast<PURender *>(_render)->clone());
|
||||
if (_render)
|
||||
system->setRender(static_cast<PURender *>(_render)->clone());
|
||||
system->_particleQuota = _particleQuota;
|
||||
system->_blend = _blend;
|
||||
system->_keepLocal = _keepLocal;
|
||||
|
@ -1102,6 +1103,11 @@ PUParticleSystem3D* PUParticleSystem3D::clone()
|
|||
{
|
||||
auto ps = PUParticleSystem3D::create();
|
||||
copyAttributesTo(ps);
|
||||
for (auto &iter : _children){
|
||||
PUParticleSystem3D *child = dynamic_cast<PUParticleSystem3D *>(iter);
|
||||
if (child)
|
||||
ps->addChild(child->clone());
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue