//TapeHelpCreationManager::~TapeHelpCreationManager void TapeHelpCreationManager::End() { if ( tapeObject ) { tapeObject->ClearAFlag(A_OBJ_LONG_CREATE); #ifndef NO_CREATE_TASK // russom - 12/04/01 tapeObject->EndEditParams( (IObjParam*)createInterface, END_EDIT_REMOVEUI, NULL); #endif if ( !attachedToNode ) { // RB 4-9-96: Normally the hold isn't holding when this // happens, but it can be in certain situations (like a track view paste) // Things get confused if it ends up with undo... theHold.Suspend(); tapeObject->DeleteAllRefsFromMe(); tapeObject->DeleteAllRefsToMe(); tapeObject->DeleteThis(); tapeObject = NULL; theHold.Resume(); // RB 7/28/97: If something has been put on the undo stack since this object was created, we have to flush the undo stack. if (theHold.GetGlobalPutCount()!=lastPutCount) { GetSystemSetting(SYSSET_CLEAR_UNDO); } macroRec->Cancel(); } else if ( tapeNode ) { // Get rid of the reference. DeleteReference(0); // sets tapeNode = NULL } } }
//LACamCreationManager::~LACamCreationManager void CreateSWrapObjectProc::End() { if ( SWrapObj ) { #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif #ifndef NO_CREATE_TASK // russom - 12/04/01 SWrapObj->EndEditParams( (IObjParam*)createInterface, END_EDIT_REMOVEUI, NULL); #endif if ( !attachedToNode ) { // RB 4-9-96: Normally the hold isn't holding when this // happens, but it can be in certain situations (like a track view paste) // Things get confused if it ends up with undo... theHold.Suspend(); delete SWrapObj; SWrapObj = NULL; theHold.Resume(); if (theHold.GetGlobalPutCount()!=lastPutCount) GetSystemSetting(SYSSET_CLEAR_UNDO); } else if ( SWrapNode ) { // Get rid of the reference. theHold.Suspend(); DeleteReference(0); // sets camNode = NULL theHold.Resume(); } } }
static BOOL InitMeshDll() { static BOOL InitBool=TRUE; if( InitBool ) { enabled = GetSystemSetting(SYSSET_ENABLE_EDITABLEMESH); // Register us as the editable tri object. if (enabled) { RegisterEditTriObjDesc(GetEditTriObjectDesc()); RegisterStaticEditTri (statob.GetEditTriOb ()); } InitBool=FALSE; } return TRUE; }
void CSettings::ReadSettings(void) { bool SyncAudio = m_Set_SyncAudio ? GetSystemSetting(m_Set_SyncAudio) != 0 : false; bool bLimitFPS = m_Set_LimitFPS ? GetSystemSetting(m_Set_LimitFPS) != 0 : true; m_Volume = GetSetting(Set_Volume); m_AudioEnabled = m_Set_EnableAudio ? GetSystemSetting(m_Set_EnableAudio) != 0 : true; m_advanced_options = m_Set_basic_mode ? GetSystemSetting(m_Set_basic_mode) == 0 : false; m_debugger_enabled = m_advanced_options && m_Set_debugger ? GetSystemSetting(m_Set_debugger) == 1 : false; m_TinyBuffer = GetSetting(Set_TinyBuffer) != 0; m_FPSBuffer = GetSetting(Set_FPSBuffer) != 0; m_FullSpeed = m_Set_FullSpeed ? GetSystemSetting(m_Set_FullSpeed) != 0 : false; m_SyncAudio = ((!m_advanced_options || bLimitFPS) && SyncAudio && m_FullSpeed); if (m_Set_log_dir != 0) { GetSystemSettingSz(m_Set_log_dir, m_log_dir, sizeof(m_log_dir)); } m_FlushLogs = m_Set_log_flush != 0 ? GetSystemSetting(m_Set_log_flush) != 0 : false; }
int TapeHelpCreationManager::proc( HWND hwnd, int msg, int point, int flag, IPoint2 m ) { int res = TRUE; TSTR targName; ViewExp& vpx = createInterface->GetViewExp(hwnd); assert( vpx.IsAlive() ); DWORD hideflags; switch ( msg ) { case MOUSE_POINT: switch ( point ) { case 0: { pt0 = m; assert( tapeObject ); if ( createInterface->SetActiveViewport(hwnd) ) { return FALSE; } if (createInterface->IsCPEdgeOnInView()) { res = FALSE; goto done; } // if helpers were hidden by category, re-display them hideflags = GetCOREInterface()->GetHideByCategoryFlags(); if(hideflags & (HIDE_HELPERS)) { hideflags = hideflags & ~(HIDE_HELPERS); GetCOREInterface()->SetHideByCategoryFlags(hideflags); hideflags = GetCOREInterface()->GetHideByCategoryFlags(); } if ( attachedToNode ) { // send this one on its way tapeObject->EndEditParams( (IObjParam*)createInterface, 0, NULL); macroRec->EmitScript(); // Get rid of the reference. if (tapeNode) DeleteReference(0); // new object CreateNewObject(); // creates tapeObject } needToss = theHold.GetGlobalPutCount()!=lastPutCount; theHold.Begin(); // begin hold for undo mat.IdentityMatrix(); // link it up INode *l_tapeNode = createInterface->CreateObjectNode( tapeObject); attachedToNode = TRUE; assert( l_tapeNode ); createCB = tapeObject->GetCreateMouseCallBack(); createInterface->SelectNode( l_tapeNode ); // Create target object and node targObject = (Object*) createInterface->CreateInstance(GEOMOBJECT_CLASS_ID,Class_ID(TARGET_CLASS_ID,0)); targObject->SetAFlag(A_OBJ_LONG_CREATE); assert(targObject); targNode = createInterface->CreateObjectNode( targObject); assert(targNode); targName = l_tapeNode->GetName(); targName += GetString(IDS_DB_DOT_TARGET); macroRec->Disable(); targNode->SetName(targName); macroRec->Enable(); // hook up camera to target using lookat controller. createInterface->BindToTarget(l_tapeNode,targNode); // Reference the new node so we'll get notifications. theHold.Suspend(); ReplaceReference( 0, l_tapeNode); theHold.Resume(); // Position camera and target at first point then drag. mat.IdentityMatrix(); //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif createInterface->SetNodeTMRelConstPlane(tapeNode, mat); createInterface->SetNodeTMRelConstPlane(targNode, mat); tapeObject->Enable(1); ignoreSelectionChange = TRUE; createInterface->SelectNode( targNode,0); ignoreSelectionChange = FALSE; res = TRUE; } break; case 1: if (Length(m-pt0)<2) goto abort; //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif macroRec->Disable(); createInterface->SetNodeTMRelConstPlane(targNode, mat); macroRec->Enable(); ignoreSelectionChange = TRUE; createInterface->SelectNode( tapeNode); ignoreSelectionChange = FALSE; createInterface->RedrawViews(createInterface->GetTime()); theHold.Accept(IDS_DS_CREATE); targObject->ClearAFlag(A_OBJ_LONG_CREATE); res = FALSE; // We're done break; } break; case MOUSE_MOVE: //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif macroRec->Disable(); createInterface->SetNodeTMRelConstPlane(targNode, mat); macroRec->Enable(); createInterface->RedrawViews(createInterface->GetTime()); macroRec->SetProperty(tapeObject, _T("target"), // JBW 4/23/99 mr_create, Class_ID(TARGET_CLASS_ID, 0), GEOMOBJECT_CLASS_ID, 1, _T("transform"), mr_matrix3, &mat); res = TRUE; break; case MOUSE_FREEMOVE: SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CROSS_HAIR))); #ifdef _OSNAP //Snap Preview #ifdef _3D_CREATE vpx.SnapPreview(m,m,NULL, SNAP_IN_3D); #else vpx.SnapPreview(m,m,NULL, SNAP_IN_PLANE); #endif #endif break; case MOUSE_PROPCLICK: // right click while between creations createInterface->RemoveMode(NULL); break; case MOUSE_ABORT: abort: assert( tapeObject ); tapeObject->EndEditParams( (IObjParam*)createInterface,0,NULL); macroRec->Cancel(); theHold.Cancel(); // deletes both the camera and target. // Toss the undo stack if param changes have been made if (needToss) GetSystemSetting(SYSSET_CLEAR_UNDO); tapeNode = NULL; targNode = NULL; createInterface->RedrawViews(createInterface->GetTime()); CreateNewObject(); attachedToNode = FALSE; res = FALSE; } done: return res; }
int CreateSWrapObjectProc::proc(HWND hwnd,int msg,int point,int flag, IPoint2 m ) { int res=TRUE; ViewExp *vpx = createInterface->GetViewport(hwnd); assert( vpx ); #ifdef _3D_CREATE DWORD snapdim = SNAP_IN_3D; #else DWORD snapdim = SNAP_IN_PLANE; #endif switch ( msg ) { case MOUSE_POINT: switch ( point ) { case 0: assert( SWrapObj ); vpx->CommitImplicitGrid(m, flag ); if ( createInterface->SetActiveViewport(hwnd) ) { return FALSE; } if (createInterface->IsCPEdgeOnInView()) { res = FALSE; goto done; } if ( attachedToNode ) { // send this one on its way #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif SWrapObj->EndEditParams( (IObjParam*)createInterface, 0, NULL); if (SWrapNode) { theHold.Suspend(); DeleteReference(0); theHold.Resume(); } // new object CreateNewObject(); // creates SWrapObj } theHold.Begin(); // begin hold for undo mat.IdentityMatrix(); // link it up SWrapNode = createInterface->CreateObjectNode( SWrapObj); attachedToNode = TRUE; assert( SWrapNode ); createCB = NULL; createInterface->SelectNode( SWrapNode ); // Reference the new node so we'll get notifications. theHold.Suspend(); MakeRefByID( FOREVER, 0, SWrapNode); theHold.Resume(); mat.IdentityMatrix(); default: res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP){ #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif theHold.Accept(GetString(IDS_AP_CREATE)); } createInterface->RedrawViews(createInterface->GetTime()); break; } break; case MOUSE_MOVE: res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP){ #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif theHold.Accept(GetString(IDS_AP_CREATE)); } createInterface->RedrawViews(createInterface->GetTime()); break; /* res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP) theHold.Accept(GetString(IDS_AP_CREATE)); createInterface->RedrawViews(createInterface->GetTime()); break;*/ case MOUSE_PROPCLICK: createInterface->SetStdCommandMode(CID_OBJMOVE); break; case MOUSE_ABORT: abort: assert( SWrapObj ); #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif SWrapObj->EndEditParams( (IObjParam*)createInterface,0,NULL); theHold.Cancel(); // deletes both the object and target. if (theHold.GetGlobalPutCount()!=lastPutCount) GetSystemSetting(SYSSET_CLEAR_UNDO); SWrapNode = NULL; createInterface->RedrawViews(createInterface->GetTime()); CreateNewObject(); attachedToNode = FALSE; res = FALSE; break; case MOUSE_FREEMOVE: SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CROSS_HAIR))); #ifdef _OSNAP //PREVIEW SNAP res = createmethod(vpx,msg,point,flag,m,mat); #endif vpx->TrackImplicitGrid(m); break; } done: if ((res == CREATE_STOP)||(res==CREATE_ABORT)) vpx->ReleaseImplicitGrid(); createInterface->ReleaseViewport(vpx); return res; }
void ResetPivot::ResetSel() { //theHold.Begin(); for (int i = 0; i < ip->GetSelNodeCount(); i++) { INode *node = ip->GetSelNode(i); if (node->IsGroupMember() || node->IsGroupHead()) continue; if (SelectedAncestor(node)) continue; Matrix3 ntm, ptm, rtm(1), piv(1), tm; // Get Parent and Node TMs ntm = node->GetNodeTM(ip->GetTime()); ptm = node->GetParentTM(ip->GetTime()); // Compute the relative TM ntm = ntm * Inverse(ptm); // The reset TM only inherits position rtm.SetTrans(ntm.GetTrans()); // Set the node TM to the reset TM tm = rtm * ptm; node->SetNodeTM(ip->GetTime(), tm); // Compute the pivot TM piv.SetTrans(node->GetObjOffsetPos()); PreRotateMatrix(piv, node->GetObjOffsetRot()); ApplyScaling(piv, node->GetObjOffsetScale()); // Reset the offset to 0 node->SetObjOffsetPos(Point3(0, 0, 0)); node->SetObjOffsetRot(IdentQuat()); node->SetObjOffsetScale(ScaleValue(Point3(1, 1, 1))); // Take the position out of the matrix since we don't reset position ntm.NoTrans(); // Apply the offset to the TM ntm = piv * ntm; // Apply a derived object to the node's object Object *obj = node->GetObjectRef(); IDerivedObject *dobj = CreateDerivedObject(obj); // Create an XForm mod SimpleMod *mod = (SimpleMod *)ip->CreateInstance( OSM_CLASS_ID, Class_ID(CLUSTOSM_CLASS_ID, 0)); // Apply the transformation to the mod. SetXFormPacket pckt(ntm); mod->tmControl->SetValue(ip->GetTime(), &pckt); // Add the bend modifier to the derived object. dobj->SetAFlag(A_LOCK_TARGET); // RB 3/11/99: When the macro recorder is on the derived object will get deleted unless it is locked. dobj->AddModifier(mod); dobj->ClearAFlag(A_LOCK_TARGET); // Replace the node's object node->SetObjectRef(dobj); /*Matrix3 ntm,notm,ptm, rtm(1), piv(1), tm; // Get Parent and Node TMs ntm = node->GetNodeTM(ip->GetTime()); ptm = node->GetParentTM(ip->GetTime()); // Compute the relative TM notm = ntm * Inverse(ptm); rtm = node->GetObjectTM(ip->GetTime()); // Set the node TM to the reset TM tm = rtm*ntm; node->SetNodeTM(ip->GetTime(), tm); // Reset the offset to 0 node->SetObjOffsetPos(Point3(0,0,0)); node->SetObjOffsetRot(IdentQuat()); node->SetObjOffsetScale(ScaleValue(Point3(1,1,1))); // Take the position out of the matrix since we don't reset position //ntm.NoTrans(); // Apply the offset to the TM notm.IdentityMatrix(); // Apply a derived object to the node's object Object *obj = node->GetObjectRef(); IDerivedObject *dobj = CreateDerivedObject(obj); // Create an XForm mod SimpleMod *mod = (SimpleMod*)ip->CreateInstance( OSM_CLASS_ID, Class_ID(CLUSTOSM_CLASS_ID,0)); // Apply the transformation to the mod. SetXFormPacket pckt(notm); mod->tmControl->SetValue(ip->GetTime(),&pckt); // Add the bend modifier to the derived object. dobj->SetAFlag(A_LOCK_TARGET); // RB 3/11/99: When the macro recorder is on the derived object will get deleted unless it is locked. dobj->AddModifier(mod); dobj->ClearAFlag(A_LOCK_TARGET); // Replace the node's object node->SetObjectRef(dobj);*/ } //theHold.Accept(GetString(IDS_RB_ResetPivot)); GetSystemSetting(SYSSET_CLEAR_UNDO); ip->RedrawViews(ip->GetTime()); SetSaveRequiredFlag(TRUE); }