| 2163 | } |
| 2164 | |
| 2165 | void GuiConvexEditorUndoAction::undo() |
| 2166 | { |
| 2167 | ConvexShape *object = NULL; |
| 2168 | if ( !Sim::findObject( mObjId, object ) ) |
| 2169 | return; |
| 2170 | |
| 2171 | // Temporarily save the ConvexShape current data. |
| 2172 | Vector< MatrixF > tempSurfaces; |
| 2173 | tempSurfaces.merge( object->mSurfaces ); |
| 2174 | MatrixF tempObjToWorld( object->getTransform() ); |
| 2175 | Point3F tempScale( object->getScale() ); |
| 2176 | |
| 2177 | // Restore the Object to the UndoAction state. |
| 2178 | object->mSurfaces.clear(); |
| 2179 | object->mSurfaces.merge( mSavedSurfaces ); |
| 2180 | object->setScale( mSavedScale ); |
| 2181 | object->setTransform( mSavedObjToWorld ); |
| 2182 | |
| 2183 | // Regenerate the ConvexShape and synch the client object. |
| 2184 | object->_updateGeometry(); |
| 2185 | GuiConvexEditorCtrl::synchClientObject( object ); |
| 2186 | |
| 2187 | // If applicable set the selected ConvexShape and face |
| 2188 | // on the editor. |
| 2189 | mEditor->setSelection( object, -1 ); |
| 2190 | mEditor->updateGizmoPos(); |
| 2191 | |
| 2192 | // Now save the previous ConvexShape data in this UndoAction |
| 2193 | // since an undo action must become a redo action and vice-versa |
| 2194 | |
| 2195 | mSavedObjToWorld = tempObjToWorld; |
| 2196 | mSavedScale = tempScale; |
| 2197 | mSavedSurfaces.clear(); |
| 2198 | mSavedSurfaces.merge( tempSurfaces ); |
| 2199 | } |
| 2200 | |
| 2201 | ConvexEditorCreateTool::ConvexEditorCreateTool( GuiConvexEditorCtrl *editor ) |
| 2202 | : Parent( editor ), |
no test coverage detected