void AddCloneTree(HWND hTreeView, int nOrderInKClone, char* str) { vClone.AddItem(str, (nOrderInKClone>0) ? KCloneToCTreeView(nOrderInKClone) : nOrderInKClone); }
//更新処理 void RefreshCloneTree(KModelEdit* mdl, const char* szModelName, int select) { //static int old_sceneobject = GetSelectedSceneObject(); //int current_sceneobject = GetSelectedSceneObject(); //if(old_sceneobject!=current_sceneobject){ // old_sceneobject = current_sceneobject //}else{ SaveItemState(); //} //以前のデータをクリア ClearCloneTree(vClone.GetTreeWnd()); //ファイル名表示部分 if(szModelName!=NULL) { char* szTitle = (char*)GlobalAlloc(GPTR, sizeof(char) * (lstrlen(szModelName)+1)); lstrcpy(szTitle, szModelName); PathStripPath(szTitle); vClone.AddItem(szTitle, 0); GlobalFree(szTitle); }else vClone.AddItem("(null)", 0); KClone** node_ptr=(KClone**)GlobalAlloc(GPTR,256*sizeof(KClone*)); KClone* kpt=mdl->GetTree(); if(kpt == NULL) return; int* node_id=(int*)GlobalAlloc(GPTR,256*sizeof(int)); int node=0; long child_end=0; node_id[node] = 1; node_ptr[node]=NULL; //NULL->child node++; node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); node_ptr[node] = kpt; while(node!=-1) { if((child_end!=1)&&(kpt->child!=NULL)){ node++; kpt = kpt->child; node_ptr[node]=kpt; child_end=0; //--copy-------------------- node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); //-------------------------- }else if(kpt->sibling!=NULL){ kpt = kpt->sibling; node_ptr[node]=kpt; child_end=0; //--copy-------------------- node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); //-------------------------- }else{ node--; kpt = node_ptr[node]; if(kpt==NULL) kpt = mdl->GetTree()->sibling; if(kpt==NULL) break; child_end=1; } } GlobalFree(node_ptr); GlobalFree(node_id); long scene = GetSelectedScene(); if(scene<0) return; long scene_object = GetSelectedSceneObject(); if(scene_object<0) return; KModelEdit* m = demo.scene[scene].sceneobj[scene_object].model; long allocnum = 0; KClone* kcl = NULL; if(m){ allocnum = m->GetCloneAllocNum(); kcl = m->GetCloneAllocPtr(); } if(kcl==NULL) return; for(int i=0; i<allocnum; i++){ vClone.SetCheck(2+i, !(kcl[i].clone_data.visible)); } //for(int i=0; i<vClone.GetItemNum(); i++) //{ // //if(i==0) continue; // KClone* p = GetKClone(i+1); // if(!p){ // continue; // } // vClone.SetCheck(i+1, !(p->clone_data.visible)); //} // } ApplyItemState(); if(select>=0){ vClone.SelectItem(select+1); } }