RescaleWorldUnits() UNDO


#1

is it possible to add RescaleWorldUnits() in undo redo when used through maxscript or sdk.
it shows in Undo list when used through utility panel.
Thanks


#2

see “\3ds Max … SDK\maxsdk\samples\utilities\rescale.cpp”

class RescaleRestore: public RestoreObj {
   float fact;
   BOOL doSel;
   public:
      RescaleRestore::RescaleRestore(float f, BOOL sel) { fact = f; doSel = sel; } 
      void Restore(int isUndo) {
         Interface *ip = GetCOREInterface();
         ip->RescaleWorldUnits(1.0f/fact,doSel);
         ip->RedrawViews(ip->GetTime());
         }
      void Redo() {
         Interface *ip = GetCOREInterface();
         ip->RescaleWorldUnits(fact,doSel);
         ip->RedrawViews(ip->GetTime());
         }
      TSTR Description() { return _T("RescaleRestore"); }
   };


void RescaleUtil::DoRescale()
   {

   if (DialogBoxParam(
      hInstance,
      MAKEINTRESOURCE(IDD_RESCALE_DLG),
      hPanel,
      RescaleDlgProc,(LPARAM)this)) {
      ip->RescaleWorldUnits(factor,doSel);
      ip->RedrawViews(ip->GetTime());
      theHold.Begin();
      theHold.Put(new RescaleRestore(factor,doSel));
      theHold.Accept(GetString(IDS_DS_RESCALE));
      }

   }

#3

that’s helpful thank you