View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004861||DarkRadiant||General||public||10.07.2018 22:37||20.09.2018 09:37|
|Priority||normal||Severity||normal||Reproducibility||have not tried|
|Target Version||2.7.0||Fixed in Version||2.7.0|
|Summary||0004861: Undo/Redo Does Not Restore Light Color|
|Description||Title. It is possible that this is also a problem with other entities that have the _color keyword. Have seen this happen in 2.0.5 too.|
|Steps To Reproduce||Change a light's color using the Light Inspector, several times|
Undo/Redo a bunch to see if the light color updates in the 3d viewport
Clicking on the light and going into Light Properties will show its color is not changed
|Tags||No tags attached.|
|This indeed happens in older versions as well, only checked the old 2.0.3 release and it's doing that too.|
|It appears that this behaviour can only be observed when doing the colour change through the Light Inspector. It must be something related to the way the entity properties are set by the Inspector, which triggers this odd behaviour in the UndoSystem.|
Ok, got the problem narrowed down to this: when undoing an operation where entity key values are added/removed *and* keyvalues of the same entity are changed, the whole EntityKeyValues list is imported back into the Entity class.
In the Entity::importState() method, all the key values are removed and re-inserted from the snapshot, which is when they are disconnected and re-connected to the UndoSystem.
After the call to UndoSystem::getStateSaver(), the KeyValue ends up with a state saver pointing to a nullptr Stack, that's why the _color keyvalue can't save its state before it's importing the old value.
So when redoing the step, the previous _color information is lost as it hasn't been saved to the UndoSystem - because the keyvalue has been newly connected to the undosystem when the parent entity had been importing its own keyvalue pair list from the snapshot.
# Some chronological notes I made during debugging:
# EntityKeyValues are imported from UndoSystem
Saving undoable's state of observed object 'EntityKeyValues'
Exporting state of observed object 'EntityKeyValues' # entity state is saved now
Importing state of observed object 'EntityKeyValues'
Importing state into entity light_1, got 10 key values
# Stack of _color keyvlue points to RedoStack
Disconnecting key value from undo system _color
[000000000EE67690] Disconnecting KeyValue with value '0.000 0.000 0.000' from undosystem
# _color Keyvalue is disconnected from undo systemConnecting new key value to undo system _color
[000000000EE67690] Connecting KeyValue with value '0.000 0.000 0.000' to undosystem
# _color keyvalue is connected, but its stack points to nullptr now, due to new getStateSaver() call
Saving undoable's state of observed object 'KeyValue'
# ObservedUndoable cannot save its state due to stack == nullptr, old value not saved to stackImporting state of observed object 'KeyValue'
[000000000EE67690] Importing value from undo system 1.000 0.000 0.000 (old value: 0.000 0.000 0.000)
# Redo will now import the entity key value list only, the old value of the _color key is lost.
|Fix committed in bf034c7.|
|10.07.2018 22:37||Spooks||New Issue|
|12.07.2018 04:03||greebo||Status||new => acknowledged|
|17.09.2018 11:45||greebo||Status||acknowledged => confirmed|
|17.09.2018 12:53||greebo||Note Added: 0010760|
|17.09.2018 12:53||greebo||Product Version||2.6.0 => 2.0.3|
|18.09.2018 05:51||greebo||Note Added: 0010761|
|20.09.2018 09:00||greebo||Note Added: 0010763|
|20.09.2018 09:36||greebo||Assigned To||=> greebo|
|20.09.2018 09:36||greebo||Status||confirmed => assigned|
|20.09.2018 09:36||greebo||Target Version||=> 2.7.0|
|20.09.2018 09:36||greebo||Note Added: 0010764|
|20.09.2018 09:36||greebo||Status||assigned => resolved|
|20.09.2018 09:36||greebo||Fixed in Version||=> 2.7.0|
|20.09.2018 09:36||greebo||Resolution||open => fixed|
|20.09.2018 09:37||greebo||Steps to Reproduce Updated||View Revisions|