PDA

View Full Version : Undo/redo of multiple action slow, hack possible ?



Alundra
20th January 2015, 02:59
Hi,
I have a widget which has layout deleted and recreated each a new selection is made.
I saw that takes time to create all widget needed and when multiple undo is made of select that takes long time.
Is it possible to see if multiple undo command of select is made when undo multiple action in the undo view to only do the last select command ?
That can surely gives a very big boost of time, but since I have sometimes Select in child, that should look at child too to see the really last select needed.
That should works for undo or redo of multiple action.
Thanks for the help

wysota
20th January 2015, 07:36
Did you implement command merging as explained in the docs?

Alundra
20th January 2015, 15:43
Merging is good to have one command which do multiple same command but I want them to be splitted to be possible to undo separately.
All works good, the only problem is if you undo or redo multiple "select" in one click on the undo view, the delete+create of the property widget is too slow, block the app for 1s or more.
The problem is if you merge select, the problem will still be the same because if you have lot of select merged that's slow too.

wysota
20th January 2015, 15:57
Well then your only choice is to optimize your code, get rid of slow calls and replace them with something faster. For example I don't understand what "delete+create" you mean, how is that related to selection? Did you check what is the actual bottle neck in your code?

Alundra
20th January 2015, 18:09
When I select something I delete then create a widget to show property of the last selected, that's why I said "delete+create".
I commented the creation of the QTreeWidget which is used to create the property editor and the time was very fast, looks like Qt is slow on this point.
Screenshot of the widget which is deleted then recreated each time selection change : http://zupimages.net/up/15/01/iwtr.png.

wysota
20th January 2015, 19:54
When I select something I delete then create a widget to show property of the last selected
So maybe don't do that :)


I commented the creation of the QTreeWidget which is used to create the property editor and the time was very fast, looks like Qt is slow on this point.
I'm sure that if you only delete and create the widget, it will be as fast, your problem is filling the widget with data. First of all you shouldn't be using QTreeWidget but rather QTreeView with a properly implemented model. If you have 10 objects selected and you select one more then you should be able to deduce changes to your properties instead of recreating everything from scratch. Same for removing an object from the selection.

So all in all it is not Qt or selections that are slow but rather your own un-profiled code. Sorry for being blunt.

Alundra
22nd January 2015, 00:20
I see, I will try to find a workaround to minimize maximum of "new" when changing object.
I tried on unreal engine 4 and the time was also very long, looks normal at the end.