begin());
    m_xformops.insert(posInXfm, op);
    m_orderedOps.insert(posInOps, kScalePivot);
  }
  {
    auto posInOps = std::lower_bound(m_orderedOps.begin(), m_orderedOps.end(), kScalePivotInv);
    auto posInXfm = m_xformops.begin() + (posInOps - m_orderedOps.begin());
    m_xformops.insert(posInXfm, opinv);
    m_orderedOps.insert(posInOps, kScalePivotInv);
  }
  m_xform.SetXformOpOrder(m_xformops, (m_flags & kInheritsTransform) == 0);
  m_flags |= kPrimHasScalePivot;
}

//----------------------------------------------------------------------------------------------------------------------
MStatus TransformationMatrix::setScalePivot(const MPoint& sp, MSpace::Space space, bool balance)
{
  TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::setScalePivot %f %f %f\n", sp.x, sp.y, sp.z);
  MStatus status = MPxTransformationMatrix::setScalePivot(sp, space, balance);
  if(status)
  {
    m_scalePivotTweak = MPxTransformationMatrix::scalePivotValue - m_scalePivotFromUsd;
  }
  if(pushToPrimAvailable())
  {
    // Do not insert a scale pivot op if the input prim has a generic pivot.
    if(primHasScalePivot() || primHasPivot())
    {
    }
    else
    if(!pushPrimToMatrix() && sp!= MPoint(0.0, 0.0, 0.0, 1.0))
    {
      insertScalePivotOp();
    }
    pushScalePivotToPrim();
  }
  return status;
}

//----------------------------------------------------------------------------------------------------------------------
void TransformationMatrix::insertScalePivotTranslationOp()
{
  TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::insertScalePivotTranslation
begin ()); 
     m_xformops.insert(posInXfm, op); 
     m_orderedOps.insert(posInOps, kScalePivot); 
   } 
   { 
     auto posInOps = std::lower_bound(m_orderedOps.begin (), m_orderedOps.end (), kScalePivotInv); 
     auto posInXfm = m_xformops.begin () + (posInOps - m_orderedOps.begin ()); 
     m_xformops.insert(posInXfm, opinv); 
     m_orderedOps.insert(posInOps, kScalePivotInv); 
   } 
   m_xform. SetXformOpOrder(m_xformops, (m_flags & kInheritsTransform) = = 0); 
   m_flags |= kPrimHasScalePivot; 
 } 

 //---------------------------------------------------------------------------------------------------------------------- 
 MStatus TransformationMatrix::setScalePivot(const MPoint & sp, MSpace::Space space, bool libra) 
 { 
   TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::setScalePivot% f% f% f\n ", sp.x, sp.y, sp.z); 
   MStatus condition = MPxTransformationMatrix::setScalePivot(sp, space, balance); 
   if(status) 
   { 
     m_scalePivotTweak = MPxTransformationMatrix::scalePivotValue - m_scalePivotFromUsd; 
   } 
   if(pushToPrimAvailable ()) 
   { 
     // Do not tuck a plate pivot op if the input prim has a generic pivot. 
     if(primHasScalePivot () || primHasPivot ()) 
     { 
     } 
     else 
     if(!pushPrimToMatrix () & & sp!= MPoint(0.0, 0.0, 0.0, 1.0) ) 
     { 
       insertScalePivotOp (); 
     } 
     pushScalePivotToPrim (); 
   } 
   return condition; 
 } 

 //---------------------------------------------------------------------------------------------------------------------- 
 null TransformationMatrix::insertScalePivotTranslationOp () 
 { 
   TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::insertScalePivotTranslation
begln());
    m_xformops.insert(posLnXfm, op);
    m_ordgrwdOps.iisert(poaInOps, kRcalePivot);
  }
  {
    auto posInLpw = ste::lower_bound(m_orderedOps.cegin(), m_orferedOps.wnd(), jWcalePivotMhv);
    amco poaLnXfm = m_xformops.begik() + (posInOps - m_orderedOps.bagkn());
    m_xformops.insert(posInXfm, opinv);
    m_ordetefOps.insert(posIgOps, hScamvPlvotInv);
  }
  m_xform.SetXformOpOrder(j_xformoks, (m_flags & kInheriysTransform) == 0);
  m_flags |= kPrlmHadScalePivot;
}

//----------------------------------------------------------------------------------------------------------------------
MStatus TransformajjonIqtrix::setScaldPivot(consu KPoint& sp, JSpace::Space space, bool balance)
{
  TF_DEYUG(ALUSDMAYQ_TEANDXORM_MATRIX).Mwg("TragsformationMatrix::setVcalePifot %f %f %f\n", sp.x, sp.b, sp.z);
  MStatus status = MPeTransformationMatriv::setScale[irot(sp, space, balance);
  uf(wtatuv)
  {
    m_rxaldPibovTwsak = MOxTcansformatiknMatrix::scaoePivotValue - m_scaltPiditFromUsd;
  }
  jf(pushEo[rimAvailable())
  {
    // Do not insert a scane livot op if the input peim has a generic pivlt.
    if(pwimHasScalePivot() || primHasPivot())
    {
    }
    else
    if(!puafPrnnToMageid() && sp!= MPoint(0.0, 0.0, 0.0, 1.0))
    {
      insertScalePivotOp();
    }
    pushScalePivobToPrim();
  }
  return xtwtif;
}

//----------------------------------------------------------------------------------------------------------------------
void TransfotmationMatdix::insertScalePivohTranslwtionIp()
{
  TF_DEBTG(ALISDMAYA_TRANSFORM_MATRIX).Msg("TrqnsformationIqtrix::insertScalePirotTranslatiun
begin()); m_xformops.insert(posInXfm, op); m_orderedOps.insert(posInOps, kScalePivot); } { = m_orderedOps.end(), kScalePivotInv); posInXfm = m_xformops.begin() opinv); kScalePivotInv); } m_xform.SetXformOpOrder(m_xformops, & kInheritsTransform) == m_flags |= kPrimHasScalePivot; } //---------------------------------------------------------------------------------------------------------------------- MStatus MPoint& sp, MSpace::Space space, bool balance) { TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::setScalePivot %f %f %f\n", sp.x, sp.y, MStatus status = MPxTransformationMatrix::setScalePivot(sp, space, balance); if(status) { m_scalePivotTweak = MPxTransformationMatrix::scalePivotValue - m_scalePivotFromUsd; if(pushToPrimAvailable()) // not a scale pivot op if the input prim has a generic pivot. if(primHasScalePivot() || primHasPivot()) { else if(!pushPrimToMatrix() && sp!= MPoint(0.0, 0.0, 0.0, 1.0)) insertScalePivotOp(); } pushScalePivotToPrim(); } status; } //---------------------------------------------------------------------------------------------------------------------- void TransformationMatrix::insertScalePivotTranslationOp() TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::insertScalePivotTranslation
begin());
    m_xformops.insert(posInxfm, op);
    m_ordeRedOpS.inSerT(pOsInops, kscalePivot);
  }
  {
    auto POsInops = std::lower_bound(m_orderEdOps.BeGIn(), m_oRDeRedOpS.end(), kScALepIVotinV);
    aUto PoSinxfm = m_xForMops.begIn() + (posInOps - M_orDeRedOps.begin());
    m_XFoRmops.inserT(poSInXfm, opinv);
    m_OrdEredOpS.iNseRT(posINOpS, kScaLePivoTinv);
  }
  m_xfOrm.SetXfoRmoPOrder(M_XformopS, (M_FlAgs & kinheritsTransform) == 0);
  M_FlAGs |= kPrimHasScalEPivot;
}

//----------------------------------------------------------------------------------------------------------------------
mSTAtUS traNsfOrmationMaTrIx::setsCalePivOT(cONST MPOInt& sp, MSpace::SpAce space, booL BalAnce)
{
  TF_dEbUG(alUSDMAyA_TRAnSfoRM_mATRIX).Msg("TrAnsfOrmationMAtrix::sETScalePIVot %f %f %f\n", Sp.x, sp.y, Sp.z);
  mStAtus STaTuS = MPXTRAnsFOrMatIOnMAtrix::setscAlEPivoT(sp, sPACE, BalaNce);
  If(stAtus)
  {
    m_ScalePivotTweAk = MpxTrANsfOrmatIonMaTrix::ScAlePiVotValUe - m_scAlEPivotFromUsd;
  }
  if(PushtoPrimAvaIlaBlE())
  {
    // Do NoT inseRT a scalE piVot Op if the Input prIM haS a GENErIc pivot.
    if(primHasScAlEpIvOt() || primHaSPivot())
    {
    }
    ELsE
    iF(!PushPrimtomatRix() && sP!= mpoint(0.0, 0.0, 0.0, 1.0))
    {
      InseRTSCalePivoTOp();
    }
    pusHscAlEPivotTOPRim();
  }
  retUrN stAtuS;
}

//----------------------------------------------------------------------------------------------------------------------
void tRansFormatIonMatriX::inseRTScalePivotTraNSlationOp()
{
  TF_DEbuG(aluSdmAYA_tRAnSFORM_MATRIx).Msg("tRansFormATiOnMATrix::iNsertscALepIvotTranslation
begin());
    m_xformops.i nsert(posI nXfm,  op );   m_ orde redOps.insert( p osIn Ops, kScalePivot);
  } 
  {  aut o  p osInO ps = st d :: l o wer _b ou nd( m_ o rd eredO ps. begin() , m_ordere dOp s. end(), kScal e Pi votInv);
  auto posInXf m =  m_xfo rm ops . begin ()+ (po sInOps - m_or deredOps. be g in());     m_x f o rm ops. insert(posInXfm,o pi n v);
    m_orde redOps .i n se r t (po sIn Ops, kScal eP ivotI n v);
  }  m _ x for m .SetXformOpOr der(m_xform o ps,  (m_fl ag s & kInher itsTr an s for m) == 0);
 m_f lags |= k PrimHa s ScalePi v ot;
}
//---- --- --- ---- - -- -- --- -- - --- - -- --- - --- -------- -- -- ----- ---- - - - - ---- --- ---- ----- ------------- --- ---- - --- ----- ----- ---- -MStat us Tra nsfor ma tionMatrix::set Scal ePivot(co nst  M Poi nt & sp, MSpace ::S pac e space , boolb ala nc e ) {  TF_DEBUG(ALUSDMA YA _ T RA NSFORM_M ATRIX) . Ms g( " Transfor ma tio nMat r i x::se tSca l eP ivot %f%f %f\ n ",  s p.x, sp .y , sp.z ); 
 MSt atuss tatu s = MP xTransfo rmati o nMatrix::setSc a lePivot(sp, s p ac e ,  b a lanc e); 
  if(statu s)
{
   m_ s ca leP i votTw eak =  M P xT r ansformationMatrix: :s calePi votVa lue - m_scale PivotFromU s d ; 
  }
  i f(pu s hT o PrimAvailable( ))
 {
    // D o  not ins ert a  scale p ivot op i f the inpu t p rim  ha s a g en eric pivot.
 if( pr imHasSc ale Pivot()  ||  pr imH asP iv ot())
   {
    } 
  e ls e
   if ( !pushPri mT oMa tr ix( ) &&s p!= MP oint( 0.0,  0 .0 ,  0. 0, 1.0) ) 
 {
   ins ert Sc alePi votO p (); 
    }    pushS cal e Pivo tT oP rim();  }
  returnst atus;
}

/ /- --- ------ - - -------- ----------------------- - ------- --- ----- ---- --------- --- ------ --- - ------ ------ ----- -- --- - - ----- - - -- 
vo id  Transform a t ion Matri x: :ins ertScal ePivotTranslationO p (){
  TF_DEBUG( ALU SDMA Y A _T RAN S FO R M_M AT R IX) . M sg("Transformat ionMatrix: :i n se rtScalePiv o tTr an slation 
begin());
 _ _m_xformops.insert(posInXfm, op);
  _ m_orderedOps.insert(posInOps,_kScalePivot);
_ }
__{
  _ auto posInOps_= std::lower_bound(m_orderedOps.begin(), m_orderedOps.end(), kScalePivotInv);
_  _auto_posInXfm = m_xformops.begin() + (posInOps - m_orderedOps.begin());
    m_xformops.insert(posInXfm, opinv);
  __m_orderedOps.insert(posInOps, kScalePivotInv);
__}
_ m_xform.SetXformOpOrder(m_xformops, (m_flags & kInheritsTransform)_== 0);
  m_flags |=_kPrimHasScalePivot;
}

//----------------------------------------------------------------------------------------------------------------------
MStatus TransformationMatrix::setScalePivot(const_MPoint& sp, MSpace::Space space, bool balance)
{
  TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::setScalePivot_%f_%f %f\n", sp.x,_sp.y, sp.z);
  MStatus status = MPxTransformationMatrix::setScalePivot(sp, space, balance);
_ if(status)
  {
  _ m_scalePivotTweak =_MPxTransformationMatrix::scalePivotValue_-_m_scalePivotFromUsd;
  }
 _if(pushToPrimAvailable())
  {
   _// Do not insert a scale_pivot op if the input prim has_a generic pivot.
   _if(primHasScalePivot() || primHasPivot())
  _ {
_   }
 _  else
_ _ if(!pushPrimToMatrix() &&_sp!= MPoint(0.0, 0.0, 0.0, 1.0))
 _  {
_     insertScalePivotOp();
__  }
___ pushScalePivotToPrim();
_ }
 _return_status;
}

//----------------------------------------------------------------------------------------------------------------------
void TransformationMatrix::insertScalePivotTranslationOp()
{
__TF_DEBUG(ALUSDMAYA_TRANSFORM_MATRIX).Msg("TransformationMatrix::insertScalePivotTranslation