本文整理汇总了C++中CGroupObject类的典型用法代码示例。如果您正苦于以下问题:C++ CGroupObject类的具体用法?C++ CGroupObject怎么用?C++ CGroupObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGroupObject类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UngroupObjects
void ESceneGroupTool::UngroupObjects(bool bUndo)
{
ObjectList lst = m_Objects;
int sel_cnt = 0;
if (!lst.empty())
{
bool bModif = false;
for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
{
if ((*it)->Selected())
{
sel_cnt++;
CGroupObject* obj = dynamic_cast<CGroupObject*>(*it);
VERIFY(obj);
if (obj->CanUngroup(true))
{
obj->UngroupObjects ();
Scene->RemoveObject (obj,false,true);
xr_delete (obj);
bModif = true;
}else
ELog.DlgMsg (mtError,"Can't ungroup object: '%s'.",obj->Name);
}
}
if (bUndo&&bModif)
Scene->UndoSave();
}
if (0==sel_cnt)
ELog.Msg (mtError,"Nothing selected.");
}
示例2: SaveSelectedObject
void ESceneGroupTools::SaveSelectedObject()
{
CGroupObject* obj = 0;
// find single selected object
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++) {
if ((*it)->Selected()) {
if (obj!=0) {
ELog.DlgMsg(mtError,"Select single object and try again.");
return;
}
obj = dynamic_cast<CGroupObject*>(*it);
}
}
if (obj) {
if (obj->IsOpened()) {
ELog.DlgMsg(mtError,"Can't save opened group. Close group and retry.");
} else {
xr_string fn;
if (EFS.GetSaveName(_groups_,fn)) {
IWriter* W = FS.w_open(fn.c_str());
if (W) {
obj->Save (*W);
FS.w_close (W);
} else {
ELog.DlgMsg (mtError,"Access denied.");
}
}
}
} else {
ELog.DlgMsg(mtError,"Nothing selected.");
}
}
示例3: FillGroupItems
void __stdcall FillGroupItems(ChooseItemVec& items, void* param)
{
CGroupObject* group = (CGroupObject*)param;
for (ObjectIt it=group->GetObjects().begin(); it!=group->GetObjects().end(); it++) {
items.push_back (SChooseItem((*it)->Name,""));
}
}
示例4: _RemoveObject
BOOL ESceneGroupTool::_RemoveObject(CCustomObject* object)
{
inherited::_RemoveObject(object);
CGroupObject* go = dynamic_cast<CGroupObject*>(object);
go->Clear1 ();
return TRUE;
}
示例5: FillGroupItems
void __stdcall FillGroupItems(ChooseItemVec& items, void* param)
{
CGroupObject* group = (CGroupObject*)param;
ObjectList grp_lst;
group->GetObjects (grp_lst);
for (ObjectIt it=grp_lst.begin(); it!=grp_lst.end(); ++it)
items.push_back (SChooseItem((*it)->Name,""));
}
示例6: MakeThumbnail
void ESceneGroupTool::MakeThumbnail()
{
if (SelectionCount(true)==1)
{
CGroupObject* object = 0;
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
{
if ((*it)->Selected())
{
object = dynamic_cast<CGroupObject*>(*it);
break;
}
}
VERIFY (object);
object->Select (false);
// save render params
Flags32 old_flag = psDeviceFlags;
// set render params
psDeviceFlags.set (rsStatistic|rsDrawGrid,FALSE);
U32Vec pixels;
u32 w=512,h=512;
if (EDevice.MakeScreenshot (pixels,w,h))
{
AnsiString tex_name = ChangeFileExt(object->Name,".thm");
SStringVec lst;
ObjectList grp_lst;
object->GetObjects (grp_lst);
for (ObjectIt it=grp_lst.begin(); it!=grp_lst.end(); ++it)
lst.push_back ((*it)->Name);
EGroupThumbnail tex (tex_name.c_str(),false);
tex.CreateFromData (pixels.begin(),w,h,lst);
string_path fn;
FS.update_path (fn,_groups_,object->RefName());
strcat (fn,".group");
tex.Save (FS.get_file_age(fn));
}else
{
ELog.DlgMsg (mtError,"Can't make screenshot.");
}
object->Select (true);
// restore render params
psDeviceFlags = old_flag;
}else
{
ELog.DlgMsg (mtError,"Select 1 GroupObject.");
}
}
示例7: R_ASSERT
bool __fastcall TUI_ControlGroupAdd::AfterAppendCallback(TShiftState Shift, CCustomObject* obj)
{
bool result = false;
ESceneGroupTools* ot = dynamic_cast<ESceneGroupTools*>(parent_tool);
if (ot->GetCurrentObject()){
CGroupObject* group = dynamic_cast<CGroupObject*>(obj); R_ASSERT(group);
LPCSTR short_name = ot->GetCurrentObject();
result = group->SetReference(short_name);
if (result){
string256 namebuffer;
Scene->GenObjectName(OBJCLASS_GROUP, namebuffer, short_name);
group->Name = namebuffer;
}
}
return result;
}
示例8: SelectionCount
void ESceneGroupTool::SaveSelectedObject()
{
u32 scnt = SelectionCount(true);
if(scnt==0)
{
ELog.DlgMsg(mtError,"No object(s) selected.");
return;
}else
if(scnt>1)
{
if(mrYes != ELog.DlgMsg(mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, "Process multiple objects?") )
return;
}
CGroupObject* obj = 0;
// find single selected object
for(ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); ++it)
{
if((*it)->Selected())
{
obj = dynamic_cast<CGroupObject*>(*it);
xr_string fn;
if(scnt==1)
{
fn = obj->RefName();
if( !EFS.GetSaveName(_groups_,fn) )
return;
}else
{
string_path S;
FS.update_path (S, _groups_, obj->RefName());
fn = S;
fn += ".group";
}
IWriter* W = FS.w_open(fn.c_str());
if (W)
{
obj->SaveStream (*W);
FS.w_close (W);
}else
ELog.DlgMsg (mtError, "Cant write file [%s]", fn.c_str());
}
}
}
示例9: GroupObjects
void ESceneGroupTools::GroupObjects(bool bUndo)
{
string256 namebuffer;
Scene->GenObjectName(OBJCLASS_GROUP, namebuffer);
CGroupObject* group = xr_new<CGroupObject>((LPVOID)0,namebuffer);
// validate objects
ObjectList lst;
if (Scene->GetQueryObjects(lst,OBJCLASS_DUMMY,1,1,0)) group->GroupObjects(lst);
if (group->ObjectCount()) {
ELog.DlgMsg(mtInformation,"Group '%s' successfully created.\nContain %d object(s)",group->Name,group->ObjectCount());
Scene->AppendObject(group,bUndo);
} else {
ELog.DlgMsg(mtError,"Group can't created.");
xr_delete(group);
}
}
示例10: VERIFY
void ESceneGroupTools::ReloadRefsSelectedObject()
{
ObjectList lst = m_Objects;
int sel_cnt = 0;
if (!lst.empty()){
bool bModif = false;
for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
if ((*it)->Selected()){
sel_cnt++;
CGroupObject* obj = dynamic_cast<CGroupObject*>(*it); VERIFY(obj);
if (obj->UpdateReference()){
bModif = true;
}else{
ELog.Msg (mtError,"Can't reload group: '%s'.",obj->Name);
}
}
}
if (bModif) Scene->UndoSave();
}
if (0==sel_cnt) ELog.Msg (mtError,"Nothing selected.");
}
示例11: ReloadRefsSelectedObject
void ESceneGroupTool::ReloadRefsSelectedObject()
{
ObjectList lst = m_Objects;
int sel_cnt = 0;
if (!lst.empty())
{
string_path temp_file_name_sector,temp_file_name_portal;
GetTempFileName ( FS.get_path(_temp_)->m_Path, "tmp_sector", 0, temp_file_name_sector );
Scene->SaveToolLTX (OBJCLASS_SECTOR, temp_file_name_sector);
GetTempFileName ( FS.get_path(_temp_)->m_Path, "tmp_portal", 0, temp_file_name_portal );
Scene->SaveToolLTX (OBJCLASS_PORTAL, temp_file_name_portal);
bool bModif = false;
for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
{
if ((*it)->Selected())
{
sel_cnt++;
CGroupObject* obj = dynamic_cast<CGroupObject*>(*it);
VERIFY (obj);
if (obj->UpdateReference(true))
{
bModif = true;
}else
{
ELog.Msg (mtError,"Can't reload group: '%s'.",obj->Name);
}
}
}
if(bModif)
Scene->UndoSave ();
Scene->LoadToolLTX (OBJCLASS_SECTOR, temp_file_name_sector);
Scene->LoadToolLTX (OBJCLASS_PORTAL, temp_file_name_portal);
}
if (0==sel_cnt)
ELog.Msg (mtError,"Nothing selected.");
}