Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 // 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));
     }
 }
Exemplo n.º 4
0
        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);
        }