public virtual void Disconnect() { // we could get this while we are in an active capture, if selection // changes. in that case we need to terminate gracefully. if (activeWidget != null) { EndCapture(null); } if (targetWrapper != null) { targetWrapper.Target.OnTransformModified -= onTransformModified; } // if we created an internal group SO, get rid of it if (internalGroupSO != null) { internalGroupSO.RemoveAllChildren(); parentScene.RemoveSceneObject(internalGroupSO, true); internalGroupSO = null; } // same for xform if (internalXFormSO != null) { internalXFormSO.Disconnect(); parentScene.RemoveSceneObject(internalXFormSO, true); internalXFormSO = null; } }
public void SetReferenceObject(SceneObject sourceSO) { if (sourceSO != null && frameSourceSO == sourceSO) { return; // ignore repeats as this is kind of expensive } if (internalXFormSO != null) { internalXFormSO.DisconnectTarget(); parentScene.RemoveSceneObject(internalXFormSO, true); internalXFormSO = null; } frameSourceSO = sourceSO; SetActiveFrame(eCurrentFrameMode); }
// you can override this to modify behavior. Note that this default // implementation currently uses some internal members for the relative-xform case virtual protected ITransformWrapper InitializeTransformWrapper(SceneObject useSO, FrameType eFrame) { if (frameSourceSO != null) { internalXFormSO = new TransientXFormSO(); internalXFormSO.Create(); parentScene.AddSceneObject(internalXFormSO); internalXFormSO.ConnectTarget(frameSourceSO, useSO); return(new PassThroughWrapper(internalXFormSO)); } else if (eFrame == FrameType.LocalFrame) { return(new PassThroughWrapper(useSO)); } else { return(new SceneFrameWrapper(parentScene, useSO)); } }
public virtual void Disconnect() { // we could get this while we are in an active capture, if selection // changes. in that case we need to terminate gracefully. if (activeWidget != null) { EndCapture(null); } foreach (var w in Widgets) { w.Value.Disconnect(); } Widgets.Clear(); if (targetWrapper != null) { targetWrapper.Target.OnTransformModified -= onTransformModified; } // if we created an internal group SO, get rid of it if (internalGroupSO != null) { internalGroupSO.RemoveAllChildren(); parentScene.RemoveSceneObject(internalGroupSO, true); internalGroupSO = null; } // same for xform if (internalXFormSO != null) { internalXFormSO.DisconnectTarget(); parentScene.RemoveSceneObject(internalXFormSO, true); internalXFormSO = null; } FUtil.SafeSendEvent(OnDisconnected, this, EventArgs.Empty); }