engine/component.cpp
(Diff revision 1)
|
Component::description() const |
|
|
116 |
if( d->enabled == newEnabled ) |
Doing the checks for initialzed in initialize() and cleanup() as suggested below would make this check obsolete.
engine/component.cpp
(Diff revision 1)
|
Component::description() const |
|
|
123 |
if( d->gameObject->enabled() && d->gameObject->initialized() ) |
What heppens if GameObject->enabled() == false but the component was initialized?
Since you have a bool initialized now anyway, I think it is better to check here whether we are already initialzied, and, if so, just return.
See initialize(), the same applies here, but the other way around. If we're not initialized, we can just ignore it.
See Component::initialize()
engine/gameobject.cpp
(Diff revision 1)
|
GameObject::enabled() const |
|
|
547 |
if( d->enabled && d->initialized ) |
You should make this similar to Component::initialize(), but using if(d->initialized) { if (d->enabled) { } }
- Arjen
On January 7th, 2011, 9:51 p.m., Giulio Camuffo wrote:
Review request for Gluon.
By Giulio Camuffo.
Updated Jan. 7, 2011, 9:51 p.m.
Description
Currently when in the creator a gameobject or component gets disabled it doesn't hide immediately. This patch fixes that behaviour, calling initialize() or cleanup() on the object.
To ensure initialize() won't be called by setEnabled() before actually wanted, I had to keep track if the gameobject's initialize() was called, with a new bool in the private class and a new initialized() method used by Component.
|
Diffs
- engine/component.cpp (03edc8d)
- engine/gameobject.h (403c018)
- engine/gameobject.cpp (1f29de8)
- engine/gameobjectprivate.h (82ac665)
- engine/gameobjectprivate.cpp (49823d5)
View Diff
|