コード例 #1
0
ファイル: AntiVirus.cpp プロジェクト: ivan386/Shareaza
void CAntiVirus::UpdateData(CComboBox& wndAntiVirus)
{
	if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
		return;

	if ( wndAntiVirus.IsWindowEnabled() )
	{
		Settings.General.AntiVirus = *(CString*)wndAntiVirus.GetItemDataPtr( wndAntiVirus.GetCurSel() );
	}
}
コード例 #2
0
ファイル: AntiVirus.cpp プロジェクト: ivan386/Shareaza
void CAntiVirus::Free(CComboBox& wndAntiVirus)
{
	if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
		return;

	const int nCount = wndAntiVirus.GetCount();
	for ( int i = 0; i < nCount; ++i )
	{
		delete (CString*)wndAntiVirus.GetItemDataPtr( i );
	}
}
コード例 #3
0
//-----  OnBnClickedBtConvert()  ----------------------------------------------
void CFormChunkMergeView::OnBnClickedBtConvert()
{
	Configuration*			pConfig  (Configuration::getInstance());
	CComboBox*				pCBox    ((CComboBox*) GetDlgItem(IDC_CB_MAT_SINGLE));
	NifCollisionUtility		ncUtility(*(NifUtlMaterialList::getInstance()));
	map<int, unsigned int>	materialMap;
	unsigned short			ncReturn (NCU_OK);

	//  store data
	UpdateData(TRUE);

	//  build full texture path and set to utility
	ncUtility.setSkyrimPath(pConfig->getPathTextures());

	//  set callback for log info
	ncUtility.setLogCallback(logCallback);

	//  get material handling
	MaterialTypeHandling	matHandling((MaterialTypeHandling) (GetCheckedRadioButton(IDC_RD_MAT_SINGLE, IDC_RD_MAT_DEFINE) - IDC_RD_MAT_SINGLE));

	//  set default material
	materialMap[-1] = ((unsigned int) pCBox->GetItemDataPtr(pCBox->GetCurSel()));

	//  add additional materials in case of special handling
	if (matHandling == NCU_MT_MATMAP)
	{
		//  do something special
	}

	//  set flags
	ncUtility.setCollisionNodeHandling((CollisionNodeHandling) (GetCheckedRadioButton(IDC_RD_COLL_CDATA, IDC_RD_COLL_MESH) - IDC_RD_COLL_CDATA));
	ncUtility.setMaterialTypeHandling (matHandling, materialMap);
	ncUtility.setDefaultMaterial      (materialMap[-1]);
	ncUtility.setMergeCollision       (((CButton*) GetDlgItem(IDC_RD_COLL_GLOBAL)) ->GetCheck() == TRUE);
	ncUtility.setReorderTriangles     (((CButton*) GetDlgItem(IDC_CK_REORDER_TRIS))->GetCheck() == TRUE);

	//  add collision data to nif
	ncReturn = ncUtility.addCollision(CStringA(_fileNameColl).GetString(), CStringA(_fileNameIn).GetString(), pConfig->getPathTemplates() + "\\" + CStringA(_template).GetString());

	//  decode result
	if (ncReturn == NCU_OK)
	{
		LogMessageObject::LogMessage(NCU_MSG_TYPE_SUCCESS, "Collision data added successfully");
	}
	else
	{
		LogMessageObject::LogMessage(NCU_MSG_TYPE_ERROR, "NifCollision returned code: %d", ncReturn);
	}
	LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
}
コード例 #4
0
// change parent of model instance
void CDlgClient::OnSelendokCbParentmodel() 
{
  CComboBox *cbParentModel = ((CComboBox*)GetDlgItem(IDC_CB_PARENTMODEL));

  wchar_t strParentName[256];
  INDEX iCurSelected = cbParentModel->GetCurSel();
  // no selection
  if(iCurSelected < 0)
    return;
  // get curent selected in combo box
  cbParentModel->GetLBText(iCurSelected,&strParentName[0]);
  // curent selected in combo box has pointer of model instance that is selected
  CModelInstance *pmiNewParent = (CModelInstance*)cbParentModel->GetItemDataPtr(iCurSelected);
  // get curent parent of this model instance
  CModelInstance *pmiOldParent = pmiSelected->GetParent(theApp.GetDocument()->m_ModelInstance);
  // if no parent
  if(pmiOldParent == NULL)
  {
    theApp.ErrorMessage("Can't move root object!");
    return;
  }
  // old parent is same as new parent
  if(pmiNewParent == pmiOldParent)
  {
    theApp.ErrorMessage("New parent is same as old one");
    return;
  }
  // new parent is same as selected model instance
  if(pmiNewParent == pmiSelected)
  {
    theApp.ErrorMessage("Can't attach object to himself!");
    return;
  }

  // check if pmiNewParent if child of pmiSelected
  if(pmiNewParent->GetParent(pmiSelected) != NULL)
  {
    theApp.ErrorMessage("Can't attach object to his child!");
    return;
  }
  CSkeleton *psklParent = pmiNewParent->mi_psklSkeleton;
  SkeletonLOD *psklodParent = NULL;
  INDEX iParentBoneID = 0;
  if(psklParent != NULL)
  {
    // if parent has skeleton lods
    INDEX ctslod = psklParent->skl_aSkeletonLODs.Count();
    if(ctslod > 0)
    {
      psklodParent = &psklParent->skl_aSkeletonLODs[0];
      INDEX ctsb = psklodParent->slod_aBones.Count();
      // if parent has any bones
      if(ctsb > 0)
      {
        SkeletonBone &sb = psklodParent->slod_aBones[0];
        iParentBoneID = sb.sb_iID;
      }
    }
  }
  // change parent of model instance (pmiSelected)
  pmiSelected->ChangeParent(pmiOldParent,pmiNewParent);
  pmiSelected->mi_iParentBoneID = iParentBoneID;
  // if pmiSelected wasn't added as include of parent
  if(pmiSelected->mi_fnSourceFile == pmiOldParent->mi_fnSourceFile)
  {
    pmiSelected->mi_fnSourceFile = pmiNewParent->mi_fnSourceFile;
  }
  // update model instance
  theApp.UpdateRootModelInstance();
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}