当前位置: 首页>>代码示例>>C++>>正文


C++ CModelerDoc::ClearAttachments方法代码示例

本文整理汇总了C++中CModelerDoc::ClearAttachments方法的典型用法代码示例。如果您正苦于以下问题:C++ CModelerDoc::ClearAttachments方法的具体用法?C++ CModelerDoc::ClearAttachments怎么用?C++ CModelerDoc::ClearAttachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CModelerDoc的用法示例。


在下文中一共展示了CModelerDoc::ClearAttachments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnRemoveAttachingPlacement

void CDlgPgInfoAttachingPlacement::OnRemoveAttachingPlacement()
{
  ASSERT( m_iActivePlacement != -1);
  CModelerDoc* pDoc = theApp.GetDocument();
  ASSERT( pDoc != NULL);
  if( pDoc == NULL) return;
  CModelData *pMD = &pDoc->m_emEditModel.edm_md;

  pMD->md_aampAttachedPosition.Lock();
  pDoc->m_emEditModel.edm_aamAttachedModels.Lock();

  // get currently active placement from edit model
  CAttachedModel *pamAttachedModel =
    &pDoc->m_emEditModel.edm_aamAttachedModels[ m_iActivePlacement];
  // and from model data
  CAttachedModelPosition *pampModelPosition =
    &pMD->md_aampAttachedPosition[ m_iActivePlacement];

  pDoc->m_emEditModel.edm_aamAttachedModels.Unlock();
  pMD->md_aampAttachedPosition.Unlock();

  pDoc->ClearAttachments();

  pDoc->m_emEditModel.edm_aamAttachedModels.Delete( pamAttachedModel);
  pMD->md_aampAttachedPosition.Delete( pampModelPosition);

  pDoc->SetupAttachments();

  if( pDoc->m_emEditModel.edm_aamAttachedModels.Count() == 0)
  {
    m_iActivePlacement = -1;
  }
  if( m_iActivePlacement == pDoc->m_emEditModel.edm_aamAttachedModels.Count())
  {
    m_iActivePlacement = pDoc->m_emEditModel.edm_aamAttachedModels.Count()-1;
  }
  UpdateData(FALSE);
  pDoc->SetModifiedFlag();
  pDoc->UpdateAllViews( NULL);
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:40,代码来源:DlgPgInfoAttachingPlacement.cpp

示例2: SetPlacementReferenceVertex

void CDlgPgInfoAttachingPlacement::SetPlacementReferenceVertex(INDEX iCenter, INDEX iFront, INDEX iUp)
{
  // patch for calling before page is refreshed
  if(this == NULL) return;
  CModelerView *pModelerView = CModelerView::GetActiveView();
  if(pModelerView == NULL) return;
  CModelerDoc* pDoc = pModelerView->GetDocument();
  CModelData *pMD = &pDoc->m_emEditModel.edm_md;

  pMD->md_aampAttachedPosition.Lock();
  CAttachedModelPosition &amp = pMD->md_aampAttachedPosition[ m_iActivePlacement];

  // --------- Set axis-defining vertices, but swap if owerlaping
  // Center vertex
  if( iCenter != -1)
  {
    if(amp.amp_iFrontVertex == iCenter)
    {
      amp.amp_iFrontVertex = amp.amp_iCenterVertex;
    }
    else if(amp.amp_iUpVertex == iCenter)
    {
      amp.amp_iUpVertex = amp.amp_iCenterVertex;
    }
    amp.amp_iCenterVertex = iCenter;
  }
  // Front vertex
  if( iFront != -1)
  {
    if(amp.amp_iCenterVertex == iFront)
    {
      amp.amp_iCenterVertex = amp.amp_iFrontVertex;
    }
    else if(amp.amp_iUpVertex == iFront)
    {
      amp.amp_iUpVertex = amp.amp_iFrontVertex;
    }
    amp.amp_iFrontVertex = iFront;
  }
  // Up vertex  
  if( iUp != -1)
  {
    if(amp.amp_iCenterVertex == iUp)
    {
      amp.amp_iCenterVertex = amp.amp_iUpVertex;
    }
    else if(amp.amp_iFrontVertex == iUp)
    {
      amp.amp_iFrontVertex = amp.amp_iUpVertex;
    }
    amp.amp_iUpVertex = iUp;
  }

  pMD->md_aampAttachedPosition.Unlock();

  theApp.m_chGlobal.MarkChanged();
  pDoc->ClearAttachments();
  pDoc->SetupAttachments();
  pDoc->SetModifiedFlag();
  pDoc->UpdateAllViews( NULL);
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:61,代码来源:DlgPgInfoAttachingPlacement.cpp

示例3: DoDataExchange


//.........这里部分代码省略.........
    GetDlgItem( IDC_ATTACHING_PLACEMENT_Z_OFFSET    )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_HEADING_T   )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_HEADING     )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_PITCH_T     )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_PITCH       )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_BANKING_T   )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_PLACEMENT_BANKING     )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_IS_VISIBLE		      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_BROWSE_MODEL		      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_MODEL_T			      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_MODEL_T			      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_MODEL_ANIMATION_T 	      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHMENT_MODEL_ANIMATION_COMBO)->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_VERTICES_T		      )->EnableWindow( bAttachmentExists);
    GetDlgItem( IDC_ATTACHING_VERTICES              )->EnableWindow( bAttachmentExists);
    
    if( bAttachmentExists)
    {
      pMD->md_aampAttachedPosition.Lock();
      pDoc->m_emEditModel.edm_aamAttachedModels.Lock();

      CPlacement3D plCurrent = pMD->md_aampAttachedPosition[ m_iActivePlacement].amp_plRelativePlacement;
	    m_fHeading	= DegAngle( plCurrent.pl_OrientationAngle(1));
	    m_fPitch	= DegAngle( plCurrent.pl_OrientationAngle(2));
      m_fBanking  = DegAngle( plCurrent.pl_OrientationAngle(3));
	    m_fXOffset	= plCurrent.pl_PositionVector(1);
	    m_fYOffset	= plCurrent.pl_PositionVector(2);
	    m_fZOffset	= plCurrent.pl_PositionVector(3);

      CAttachedModel *pam = &pDoc->m_emEditModel.edm_aamAttachedModels[ m_iActivePlacement];
      m_strName  = pam->am_strName;
      m_strAttachingModel = pam->am_moAttachedModel.GetName();
      char achrLine[ 256];
      sprintf( achrLine, "center:%d, front:%d, up:%d",
	pMD->md_aampAttachedPosition[ m_iActivePlacement].amp_iCenterVertex,
	pMD->md_aampAttachedPosition[ m_iActivePlacement].amp_iFrontVertex,
	pMD->md_aampAttachedPosition[ m_iActivePlacement].amp_iUpVertex);
      m_strAttachingVertices = achrLine;
      sprintf( achrLine, "%d.", m_iActivePlacement);
      m_strPlacementIndex = achrLine;

      m_bIsVisible =
	pDoc->m_emEditModel.edm_aamAttachedModels[ m_iActivePlacement].am_bVisible != 0;

      pDoc->m_emEditModel.edm_aamAttachedModels.Unlock();
      pMD->md_aampAttachedPosition.Unlock();

      if( IsWindow( m_comboAttachmentModelAnimation.m_hWnd))
      {
	m_comboAttachmentModelAnimation.EnableWindow( m_bIsVisible);
	FillAttachmentModelAnimationCombo();
      }

      // mark that the values have been updated to reflect the state of the view
      m_udAllValues.MarkUpdated();
    }
  }

	//{{AFX_DATA_MAP(CDlgPgInfoAttachingPlacement)
	DDX_Control(pDX, IDC_ATTACHMENT_MODEL_ANIMATION_COMBO, m_comboAttachmentModelAnimation);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_BANKING, m_fBanking);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_HEADING, m_fHeading);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_PITCH, m_fPitch);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_X_OFFSET, m_fXOffset);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_Y_OFFSET, m_fYOffset);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_Z_OFFSET, m_fZOffset);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_NAME, m_strName);
	DDX_Text(pDX, IDC_ATTACHING_MODEL_T, m_strAttachingModel);
	DDX_Text(pDX, IDC_ATTACHING_VERTICES, m_strAttachingVertices);
	DDX_Text(pDX, IDC_ATTACHING_PLACEMENT_INDEX_T, m_strPlacementIndex);
	DDX_Check(pDX, IDC_IS_VISIBLE, m_bIsVisible);
	//}}AFX_DATA_MAP
  // if transfering data from dialog to document

  if( pDX->m_bSaveAndValidate)
  {
    if( m_iActivePlacement == -1) return;
    pMD->md_aampAttachedPosition.Lock();
    pDoc->m_emEditModel.edm_aamAttachedModels.Lock();

    CPlacement3D plCurrent;
	  plCurrent.pl_OrientationAngle(1) = AngleDeg( m_fHeading);
	  plCurrent.pl_OrientationAngle(2) = AngleDeg( m_fPitch);
    plCurrent.pl_OrientationAngle(3) = AngleDeg( m_fBanking);
	  plCurrent.pl_PositionVector(1) = m_fXOffset;
	  plCurrent.pl_PositionVector(2) = m_fYOffset;
	  plCurrent.pl_PositionVector(3) = m_fZOffset;
    pMD->md_aampAttachedPosition[ m_iActivePlacement].amp_plRelativePlacement = plCurrent;
    pDoc->m_emEditModel.edm_aamAttachedModels[ m_iActivePlacement].am_strName = CStringA(m_strName);
    pDoc->m_emEditModel.edm_aamAttachedModels[ m_iActivePlacement].am_bVisible = m_bIsVisible;
    pDoc->m_emEditModel.edm_aamAttachedModels.Unlock();
    pMD->md_aampAttachedPosition.Unlock();

    pDoc->ClearAttachments();
    pDoc->SetupAttachments();

    pDoc->SetModifiedFlag();
    pDoc->UpdateAllViews( NULL);
  }
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:101,代码来源:DlgPgInfoAttachingPlacement.cpp


注:本文中的CModelerDoc::ClearAttachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。