Esempio n. 1
0
// enable custom speed
void CDlgClient::OnCbSecperframe() 
{
  INDEX iCustomSpeed = ((CButton*)GetDlgItem(IDC_CB_SECPERFRAME))->GetCheck();
  GetDlgItem(IDC_EB_SECPERFRAME)->EnableWindow(iCustomSpeed);
  // get selected item and his parent
  HTREEITEM hSelected = m_Tree.GetSelectedItem();
  if(hSelected == NULL) return;
  INDEX iSelected = m_Tree.GetItemData(hSelected);
  NodeInfo &niSelected = theApp.aNodeInfo[iSelected];
  HTREEITEM hParent = m_Tree.GetParentItem(hSelected);
  if(hParent == NULL) return;
  INDEX iParent = m_Tree.GetItemData(hParent);
  NodeInfo &niParent = theApp.aNodeInfo[iParent];
  // get type of selected item
  ASSERT(niSelected.ni_iType==NT_ANIMATION);

  CAnimSet *pas = (CAnimSet*)niParent.ni_pPtr;
  Animation *pan = (Animation*)niSelected.ni_pPtr;
  BOOL bCustomSpeed = iCustomSpeed;
  // set animation compression
  pan->an_bCustomSpeed = iCustomSpeed;
  // convert only one animation in animset
  if(!theApp.ConvertAnimationInAnimSet(pas,pan)) {
    pan->an_bCustomSpeed = bCustomSpeed;
  }

  // update model instance
  theApp.UpdateRootModelInstance();
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}
Esempio n. 2
0
// turn compression on or off
void CDlgClient::OnCbCompresion() 
{
  //CModelTreeCtrl &m_Tree = theApp.m_dlgBarTreeView.m_TreeCtrl;
  INDEX iCompresion = ((CButton*)GetDlgItem(IDC_CB_COMPRESION))->GetCheck();
  // get selected item and his parent
  HTREEITEM hSelected = m_Tree.GetSelectedItem();
  if(hSelected == NULL) return;
  INDEX iSelected = m_Tree.GetItemData(hSelected);
  NodeInfo &niSelected = theApp.aNodeInfo[iSelected];
  HTREEITEM hParent = m_Tree.GetParentItem(hSelected);
  if(hParent == NULL) return;
  INDEX iParent = m_Tree.GetItemData(hParent);
  NodeInfo &niParent = theApp.aNodeInfo[iParent];
  // get type of selected item
  ASSERT(niSelected.ni_iType==NT_ANIMATION);

  CAnimSet *pas = (CAnimSet*)niParent.ni_pPtr;
  Animation *pan = (Animation*)niSelected.ni_pPtr;
  BOOL bAnimCompresion = pan->an_bCompresed;
  // set animation compression
  pan->an_bCompresed = iCompresion;
  // convert only one animation in animset
  if(!theApp.ConvertAnimationInAnimSet(pas,pan)) {
    pan->an_bCompresed = bAnimCompresion;
  }

  // update model instance
  theApp.UpdateRootModelInstance();
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}
void CColoredButton::OnPasteColor() 
{
  SetColor( _colColorClipboard);
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
  // invalidate parent dialog
  if( m_pwndParentDialog != NULL) m_pwndParentDialog->UpdateData( TRUE);
}
Esempio n. 4
0
// Recalculate all frames bounding box for current model
void CDlgClient::OnBtCalcAllframesBbox() 
{
	CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  CModelInstance *pmi = pmiSelected;
  if(pmi == NULL) return;
  FLOATaabbox3D bbox;
  // AnimQueue aqOld = pmi->mi_aqAnims;

  ClearAnimQueue(*pmi);
  pmi->NewClearState(0.0f);
  bbox = AddAllVerticesToBBox(*pmi);
  // for each animset in model instance
  INDEX ctas = pmi->mi_aAnimSet.Count();
  for(INDEX ias=0;ias<ctas;ias++) {
    CAnimSet &as = pmi->mi_aAnimSet[ias];
    // for each animation in animset
    INDEX ctan = as.as_Anims.Count();
    for(INDEX ian=0;ian<ctan;ian++) {
      Animation &an = as.as_Anims[ian];
      AnimQueue &aq = pmi->mi_aqAnims;
      FLOAT fSecPerFrame = an.an_fSecPerFrame;
      INDEX ctFrames = an.an_iFrames;
      ClearAnimQueue(*pmi);
      pmi->NewClearState(0.0f);
      pmi->AddAnimation(an.an_iID,AN_NOGROUP_SORT,1,0);
      ASSERT(aq.aq_Lists.Count()==1);
      FLOAT fNow = aq.aq_Lists[0].al_fStartTime - fSecPerFrame*ctFrames;

      // for each frame in animation
      for(INDEX ifr=0;ifr<ctFrames;ifr++) {
        AnimList &an = aq.aq_Lists[0];
        ASSERT(an.al_PlayedAnims.Count()==1);
        PlayedAnim &pa = an.al_PlayedAnims[0];
        an.al_fStartTime=fNow;
        pa.pa_fStartTime=fNow;
        fNow+=fSecPerFrame;
        bbox |= AddAllVerticesToBBox(*pmi);
      }
    }
  }
  
  pmi->NewClearState(0.0f);
  ClearAnimQueue(*pmi);
  // pmi->mi_aqAnims = aqOld;

  
  // Set bbox in model instance
  FLOAT3D vMin = bbox.Min();
  FLOAT3D vMax = bbox.Max();
  pmi->mi_cbAllFramesBBox.SetMin(vMin);
  pmi->mi_cbAllFramesBBox.SetMax(vMax);

  theApp.ReselectCurrentItem();
  pDoc->MarkAsChanged();
  theApp.NotificationMessage("All frames bounding box recalculated.");
}
BOOL CSeriousSkaStudioApp::OnIdle(LONG lCount) 
{
  POSITION pos = m_pdtDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CSeriousSkaStudioDoc *pmdCurrent = (CSeriousSkaStudioDoc *)m_pdtDocTemplate->GetNextDoc(pos);
    pmdCurrent->OnIdle();
  }
  extern BOOL _bApplicationActive;
  return CWinApp::OnIdle(lCount) || _bApplicationActive;

}
Esempio n. 6
0
void CDlgClient::OnBtBrowseTexture() 
{
	CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  if(pDoc==NULL) {
    ASSERT(FALSE);
    return;
  }

  HTREEITEM hSelected = m_Tree.GetSelectedItem();;
  if(hSelected==NULL) {
    ASSERT(FALSE);
    return;
  }
  HTREEITEM hParent = m_Tree.GetParentItem(hSelected);
  if(hParent==NULL) {
    ASSERT(FALSE);
    return;
  }

  
  NodeInfo &ni = theApp.m_dlgBarTreeView.GetNodeInfo(hSelected);
  NodeInfo &niParent = theApp.m_dlgBarTreeView.GetNodeInfo(hParent);
  // is selected item texture instance
  if(ni.ni_iType == NT_TEXINSTANCE) {
    // get pointers to texture and mesh instances
    TextureInstance *pti = (TextureInstance*)ni.ni_pPtr;
    MeshInstance *pmshi = (MeshInstance*)niParent.ni_pPtr;
    CModelInstance *pmi = (CModelInstance*)ni.pmi;
    ASSERT(pmi!=NULL);
    ASSERT(pti!=NULL);
    ASSERT(pmshi!=NULL);

    // browse texture
    //CDynamicArray<CTFileName> afnTexture;
    CTFileName fnTexture = _EngineGUI.FileRequester( "Open texture files", 
      FILTER_TEXTURE, "Open directory", "Models\\", "", NULL);
    if(fnTexture=="") {
      return;
    }

    INDEX iTexID = pti->GetID();
    CTextureObject *pto = &pti->ti_toTexture;
    CTString strTexID = ska_GetStringFromTable(iTexID);
    pmi->RemoveTexture(pti,pmshi);
    pmi->AddTexture_t(fnTexture,strTexID,pmshi);

    // update root model instance
    theApp.UpdateRootModelInstance();
    pDoc->MarkAsChanged();
  }
}
Esempio n. 7
0
void CDlgClient::OnBtConvert() 
{
  HTREEITEM hSelected = m_Tree.GetSelectedItem();
  // just in case that no item is seleceted
  if(hSelected==NULL) {
    return;
  }

  NodeInfo &niSelected = theApp.m_dlgBarTreeView.GetNodeInfo(hSelected);
  // if selected type is mesh list
  if(niSelected.ni_iType == NT_MESHLODLIST) {

    MeshInstance *pmshi = (MeshInstance*)niSelected.ni_pPtr;
    CTString fnMesh = pmshi->mi_pMesh->GetName();
    // save and convert mesh instance
    if(theApp.SaveMeshListFile(*pmshi,TRUE)) {
      theApp.NotificationMessage("Mesh list file '%s' converted",(const char*)fnMesh);
      theApp.UpdateRootModelInstance();
    } else {
      theApp.ErrorMessage("Cannot convert mesh file '%s'",(const char*)fnMesh);
    }
  // if selected type is skeleton list
  } else if(niSelected.ni_iType == NT_SKELETONLODLIST) {
    // Get pointer to skeleton
    CSkeleton *pskl = (CSkeleton*)niSelected.ni_pPtr;
    CTString fnSkeleton = pskl->GetName();
    // save and convert mesh instance
    if(theApp.SaveSkeletonListFile(*pskl,TRUE)) {
      theApp.NotificationMessage("Skeleton list file '%s' converted",(const char*)fnSkeleton);
      theApp.UpdateRootModelInstance();
    } else {
      theApp.ErrorMessage("Cannot convert skeleton list file '%s'",(const char*)fnSkeleton);
    }
  // if selected type is animset
  } else if(niSelected.ni_iType == NT_ANIMSET) {
    // Get pointer to animset
    CAnimSet *pas = (CAnimSet*)niSelected.ni_pPtr;
    CTString fnAnimSet = pas->GetName();
    // save and convert mesh instance
    if(theApp.SaveAnimSetFile(*pas,TRUE)) {
      theApp.NotificationMessage("AnimSet file '%s' converted",(const char*)fnAnimSet);
      theApp.UpdateRootModelInstance();
    } else {
      theApp.ErrorMessage("Cannot convert animset file '%s'",(const char*)fnAnimSet);
    }
  }
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}
Esempio n. 8
0
void CDlgClient::OnBtResetOffset() 
{
	CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  NodeInfo &ni = theApp.m_dlgBarTreeView.GetSelectedNodeInfo();
  if(ni.ni_iType == NT_MODELINSTANCE) {
    CModelInstance &mi = *(CModelInstance*)ni.ni_pPtr;
    FLOAT fOffset[6] = {0,0,0,0,0,0};
    mi.SetOffset(fOffset);
  } else {
    ASSERT(FALSE);
  }

  theApp.ReselectCurrentItem();
  pDoc->MarkAsChanged();
}
Esempio n. 9
0
void CDlgClient::OnBtResetColision() 
{
	CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  NodeInfo &ni = theApp.m_dlgBarTreeView.GetSelectedNodeInfo();
  if(ni.ni_iType == NT_COLISIONBOX) {
    ColisionBox &cb = *(ColisionBox*)ni.ni_pPtr;
    cb.SetMax(FLOAT3D(0.5,2,0.5));
    cb.SetMin(FLOAT3D(-0.5,0,-0.5));
  } else {
    ASSERT(FALSE);
  }

  theApp.ReselectCurrentItem();
  pDoc->MarkAsChanged();
}
Esempio n. 10
0
// change parent bone of model instance
void CDlgClient::OnSelendokCbParentbone() 
{
  CComboBox *cbParentBone = ((CComboBox*)GetDlgItem(IDC_CB_PARENTBONE));
  if(pmiSelected==NULL) return;

  wchar_t strParentName[256];
  cbParentBone->GetLBText(cbParentBone->GetCurSel(),&strParentName[0]);
  INDEX iNewBoneParent = ska_GetIDFromStringTable(CTString(CStringA(strParentName)));
  if(iNewBoneParent != pmiSelected->mi_iParentBoneID)
  {
    pmiSelected->SetParentBone(iNewBoneParent);
    // pmiSelected->mi_iParentBoneID = iNewBoneParent;
    // save parent model instance file
    //theApp.SaveSmcParent(*pmiSelected,TRUE);
    // update model instance
    theApp.UpdateRootModelInstance();
    CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
    pDoc->MarkAsChanged();
  }
}
Esempio n. 11
0
void CDropDown::OnSelendok() 
{
  // theApp.NotificationMessage(m_strID);
  char str[MAX_PATH];
  GetWindowText(str,MAX_PATH);
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  // set ID of selected item
  if(m_bSetID)
  {
    theApp.m_dlgBarTreeView.ChangeTextureOnSelectedSurfaces(m_strID,str);
    pDoc->MarkAsChanged();
    return;
  }
  else
  {
    INDEX iIndex = GetCurSel();
    pDoc->MarkAsChanged();
    theApp.m_dlgBarTreeView.ChangeTextureCoordsOnSelectedSurfaces(m_strID,iIndex);
  }
}
Esempio n. 12
0
// change shader for current surface
void CDlgClient::OnSelendokCbShader() 
{
  CComboBox *cbShader = ((CComboBox*)DLGSHADER.GetDlgItem(IDC_CB_SHADER));
  ASSERT(cbShader!=NULL);
  // get selected item and his parent
  HTREEITEM hSelected = m_Tree.GetSelectedItem();
  if(hSelected == NULL) return;
  INDEX iSelected = m_Tree.GetItemData(hSelected);
  NodeInfo &niSelected = theApp.aNodeInfo[iSelected];
  ASSERT(niSelected.ni_iType==NT_MESHSURFACE);
  MeshSurface *pmsrf = (MeshSurface*)niSelected.ni_pPtr;

  // get text of current seleceted item in combo
  wchar_t strName[MAX_PATH];
  cbShader->GetLBText(cbShader->GetCurSel(),strName);
  CTString strNewShaderName = CTString("Shaders\\") + CTString(CStringA(strName)) + ".sha";
  // change shader for all selected mesh surfaces
  theApp.m_dlgBarTreeView.ChangeShaderOnSelectedSurfaces(strNewShaderName);
  // show new controls for new shader
  theApp.m_dlgBarTreeView.SelItemChanged(hSelected);
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}
void CColoredButton::OnColorChange()
{
  theApp.m_dlgBarTreeView.ChangeColorOnSelectedSurfaces(m_strID,m_colColor);
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();
  pDoc->MarkAsChanged();
}
Esempio n. 14
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();
}
Esempio n. 15
0
/////////////////////////////////////////////////////////////////////////////
// value changed in some text box
void CTextBox::ValueChanged() 
{
  CSeriousSkaStudioDoc *pDoc = theApp.GetDocument();

  wchar_t wstrText[32];
  // get value from text box
  GetWindowText(wstrText,31);
  CTString strText = CStringA(wstrText);
  CModelTreeCtrl &m_TreeCtrl = theApp.m_dlgBarTreeView.m_TreeCtrl;
  // get selected item in tree view
  HTREEITEM hSelected = m_TreeCtrl.GetSelectedItem();
  if(hSelected == NULL) return;
  if(pmiSelected == NULL) return;

  INDEX iSelected = m_TreeCtrl.GetItemData(hSelected);
  INDEX iParent;
  // get parent of selected item in tree view
  HTREEITEM hParent = m_TreeCtrl.GetParentItem(hSelected);
  // if no parent set iParent to = 1 
  if(hParent == NULL) iParent = -1;
  else iParent = m_TreeCtrl.GetItemData(hParent);

  NodeInfo &niSelected = theApp.aNodeInfo[iSelected];

  FLOATmatrix3D mat;
  FLOAT3D &vPos = pmiSelected->mi_qvOffset.vPos;
  ANGLE3D aRot;
  pmiSelected->mi_qvOffset.qRot.ToMatrix(mat);
  DecomposeRotationMatrix(aRot,mat);
  // colison
  ColisionBox *pcb = NULL;
  if(pmiSelected->mi_iCurentBBox >= 0 && pmiSelected->mi_iCurentBBox < pmiSelected->mi_cbAABox.Count()) {
    pcb = &pmiSelected->mi_cbAABox[pmiSelected->mi_iCurentBBox];
  }
  if(niSelected.ni_iType == NT_ALLFRAMESBBOX) {
    pcb = &pmiSelected->mi_cbAllFramesBBox;
  }


  FLOAT fOffset[6] = {vPos(1),vPos(2),vPos(3),aRot(1),aRot(2),aRot(3)};

  INDEX ictrlID = GetDlgCtrlID();
  switch(ictrlID)
  {
    case IDC_TB_OFFSET_POSX:
      fOffset[0] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
    break;
    case IDC_TB_OFFSET_POSY:
      fOffset[1] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
    break;
    case IDC_TB_OFFSET_POSZ:
      fOffset[2] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
    break;
    case IDC_TB_OFFSET_ROTH:
      fOffset[3] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
      // refresh all text boxes for colision 
      theApp.m_dlgBarTreeView.SelItemChanged(hSelected);
    break;
    case IDC_TB_OFFSET_ROTP:
      fOffset[4] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
      // refresh all text boxes for colision 
      theApp.m_dlgBarTreeView.SelItemChanged(hSelected);
    break;
    case IDC_TB_OFFSET_ROTB:
      fOffset[5] = atof(strText);
      // set offset of selected object
      pmiSelected->SetOffset(fOffset);
      // refresh all text boxes for colision 
      theApp.m_dlgBarTreeView.SelItemChanged(hSelected);
    break;
    case IDC_EB_DISTANCE:
    {
      // set lod distance
      if(niSelected.ni_iType == NT_SKELETONLOD)
      {
        // if no parent return
        if(iParent < 0) return;
        NodeInfo &niParent   = theApp.aNodeInfo[iParent];
        // get references to objects
        CSkeleton *psk = (CSkeleton*)niParent.ni_pPtr;
        SkeletonLOD *slod = (SkeletonLOD*)niSelected.ni_pPtr;
        // change slods max distance
        slod->slod_fMaxDistance = atof(strText);
        theApp.UpdateRootModelInstance();
      }
      else if(niSelected.ni_iType == NT_MESHLOD)
      {
        // if no parent return
        if(iParent < 0) return;
        NodeInfo &niParent = theApp.aNodeInfo[iParent];
        // get references to objects
        MeshInstance *pmshi = (MeshInstance*)niParent.ni_pPtr;
        MeshLOD *pmlod = (MeshLOD*)niSelected.ni_pPtr;
        CMesh *pmesh = pmshi->mi_pMesh;
        // change mlods max distance
        pmlod->mlod_fMaxDistance = atof(strText);
        theApp.UpdateRootModelInstance();
      }
    }
    break;
    case IDC_EB_TRESHOLD:
    {
      if(niSelected.ni_iType == NT_ANIMATION)
      {
        // if no parent return
        if(iParent < 0) return;
        NodeInfo &niParent = theApp.aNodeInfo[iParent];
        // get references to objects
        CAnimSet *pas = (CAnimSet*)niParent.ni_pPtr;
        Animation *pan = (Animation*)niSelected.ni_pPtr;
        // remember old treshold
        FLOAT fOldTreshold = pan->an_fTreshold;
        pan->an_fTreshold = atof(strText);
        // convert only one animation in animset
        if(!theApp.ConvertAnimationInAnimSet(pas,pan)) {
          pan->an_fTreshold = fOldTreshold;
        }
        // update model instance
        theApp.UpdateRootModelInstance();
      }
    }
    break;
    case IDC_TB_COLWIDTH:
    {
      // change width of colision box
      if(pcb!=NULL)
      {
        FLOAT fWidth = atof(strText);
        FLOAT fPosX = (pcb->Max()(1)+pcb->Min()(1)) / 2;
        pcb->Min()(1) = -(fWidth/2) + fPosX;
        pcb->Max()(1) = (fWidth/2) + fPosX;
      }
    }
    break;
    case IDC_TB_COLHEIGHT:
    {
      // change height of colision box
      if(pcb!=NULL)
      {
        FLOAT fHeight = atof(strText);
        FLOAT fPosY = pcb->Min()(2);
        pcb->Min()(2) = fPosY;
        pcb->Max()(2) = fHeight + fPosY;
      }
    }
    break;
    case IDC_TB_COLLENGTH:
    {                  
      // change length of colision box
      if(pcb!=NULL)
      {
        FLOAT fLength = atof(strText);
        FLOAT fPosZ = (pcb->Max()(3)+pcb->Min()(3)) / 2;
        pcb->Min()(3) = -(fLength/2) + fPosZ;
        pcb->Max()(3) = (fLength/2) + fPosZ;
      }
    }
    break;
    case IDC_TB_COLPOSX:
    {
      // change pos x of colision box
      if(pcb!=NULL)
      {
        FLOAT fPosX = atof(strText);
        FLOAT fWidth = (pcb->Max()(1)-pcb->Min()(1));
        pcb->Min()(1) = -(fWidth/2) + fPosX;
        pcb->Max()(1) = (fWidth/2) + fPosX;
      }
    }
    break;
    case IDC_TB_COLPOSY:
    {
      // change pos y of colision box
      if(pcb!=NULL)
      {
        FLOAT fPosY = atof(strText);
        FLOAT fHeight = (pcb->Max()(2)-pcb->Min()(2));
        fPosY += fHeight/2;
        pcb->Min()(2) = -(fHeight/2) + fPosY;
        pcb->Max()(2) = (fHeight/2) + fPosY;
      }
    }
    break;
    case IDC_TB_COLPOSZ:
    {
      // change pos z of colision box
      if(pcb!=NULL)
      {
        FLOAT fPosZ = atof(strText);
        FLOAT fLength = (pcb->Max()(3)-pcb->Min()(3));
        pcb->Min()(3) = -(fLength/2) + fPosZ;
        pcb->Max()(3) = (fLength/2) + fPosZ;
      }
    }
    break;
    case IDC_TB_COLNAME:
    {
      // change name of colision box
      if(pcb!=NULL) {
        pcb->SetName(strText);
        m_TreeCtrl.SetItemText(hSelected, CString(strText));
      }
    }
    break;
    // change animation speed
    case IDC_EB_SECPERFRAME:
    {
      // if no parent return
      if(iParent < 0) return;
      NodeInfo &niParent = theApp.aNodeInfo[iParent];
      Animation *pan = (Animation*)niSelected.ni_pPtr;
      CAnimSet *pas = (CAnimSet*)niParent.ni_pPtr;
      pan->an_fSecPerFrame = atof(strText);
      if(pan->an_fSecPerFrame == 0) pan->an_fSecPerFrame = 0.00001f;
      // update model instance
      theApp.UpdateRootModelInstance();
    }
    break;
    // change animation walk speed 
    case IDC_TB_WALKSPEED:
    {
      pDoc->m_fSpeedZ = atof(strText);
      return; // do not mark doc as channged
    }
    break;
    // change animation walk loop
    case IDC_TB_WALKLOOP:
    {
      pDoc->m_fLoopSecends = atof(strText);
      return; // do not mark doc as channged
    }
    break;
    case IDC_EB_TEXTURENAME:
    {
      TextureInstance *pti = (TextureInstance*)niSelected.ni_pPtr;
      pti->SetName(CTString(strText));
      // update model instance
      theApp.UpdateRootModelInstance();
    }
    break;
    case IDC_TB_MI_NAME:
    {
      NodeInfo &ni = theApp.m_dlgBarTreeView.GetSelectedNodeInfo();
      CModelInstance &mi = *(CModelInstance*)ni.ni_pPtr;
      mi.SetName(strText);
      // update model instance
      theApp.UpdateRootModelInstance();
    }
    break;
    default:
    {
      // check if this text box is in shader dialog
      if((ictrlID>FIRSTSHADEID) && (ictrlID<LASTSHADEID))
      {
        // control is in shader dialog
        theApp.m_dlgBarTreeView.ChangeFloatOnSelectedSurfaces(m_strID,atof(strText));
      }
    }
    break;
  }
  pDoc->MarkAsChanged();
}