Пример #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;
            }
        }
Пример #2
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);
        }