Exemplo n.º 1
0
bool __fastcall TUI_ControlSpawnAdd::Start(TShiftState Shift)
{
    TfraSpawn* F = (TfraSpawn*)parent_tool->pFrame;
	if (F->ebAttachObject->Down){
		CCustomObject* from = Scene->RayPickObject(UI->ZFar(), UI->m_CurrentRStart, UI->m_CurrentRDir, OBJCLASS_DUMMY, 0, 0);
        if (from->ClassID!=OBJCLASS_SPAWNPOINT){
            ObjectList 	lst;
            int cnt 	= Scene->GetQueryObjects(lst,OBJCLASS_SPAWNPOINT,1,1,0);
            if (1!=cnt)	ELog.DlgMsg(mtError,"Select one shape.");
            else{
                CSpawnPoint* base = dynamic_cast<CSpawnPoint*>(lst.back()); R_ASSERT(base);
                if (base->AttachObject(from)){
                    if (!Shift.Contains(ssAlt)){
                        F->ebAttachObject->Down	= false;
                        ResetActionToSelect		();
                    }
                }else{
		        	ELog.DlgMsg(mtError,"Attach impossible.");
                }
            }
        }else{
        	ELog.DlgMsg(mtError,"Attach impossible.");
        }
    }else{
	    DefaultAddObject(Shift,AppendCallback);             
    }
    return false;
}
Exemplo n.º 2
0
bool __fastcall TUI_ControlShapeAdd::Start(TShiftState Shift)
{
	TfraShape* F 		= (TfraShape*)parent_tool->pFrame;
    if (F->ebAttachShape->Down){
		CEditShape* from = dynamic_cast<CEditShape*>(Scene->RayPickObject(UI->ZFar(),UI->m_CurrentRStart, UI->m_CurrentRNorm, OBJCLASS_SHAPE, 0, 0));
        if (from){
            ObjectList lst;
            int cnt 		= Scene->GetQueryObjects(lst,OBJCLASS_SHAPE,1,1,0);
            if (1!=cnt)		ELog.DlgMsg(mtError,"Select one shape.");
            else{
                CEditShape* base = dynamic_cast<CEditShape*>(lst.back()); R_ASSERT(base);
                if (base!=from){
	                base->Attach(from);
    	            if (!Shift.Contains(ssAlt)){
        	            F->ebAttachShape->Down 	= false;
            	        ResetActionToSelect		();
                	}
                }
            }
        }
    }else
	    DefaultAddObject(Shift,0,AfterAppendCallback);
    return false;
}
Exemplo n.º 3
0
bool __fastcall TUI_ControlPSAdd::Start(TShiftState Shift)
{
    DefaultAddObject(Shift,0,AfterAppendCallback);
    return false;
}
Exemplo n.º 4
0
bool __fastcall TUI_CustomControl::AddStart(TShiftState Shift)
{
	DefaultAddObject(Shift,0);
    return false;
}