Пример #1
0
        // configure gizmo - constructs necessary ITransformWrapper to provide
        // desired gizmo behavior. You can modify behavior in subclasses by
        // overriding InitializeTransformWrapper (but you must
        void SetActiveFrame(FrameType eFrame)
        {
            // disconect existing wrapper
            if (targetWrapper != null)
            {
                targetWrapper.Target.OnTransformModified -= onTransformModified;
            }

            // if we have multiple targets, we construct a transient SO to
            // act as a parent (stored as internalGroupSO)
            if (targets.Count > 1 && internalGroupSO == null)
            {
                internalGroupSO = new TransientGroupSO();
                internalGroupSO.Create();
                parentScene.AddSceneObject(internalGroupSO);
                internalGroupSO.AddChildren(targets);
            }
            SceneObject useSO = (targets.Count == 1) ? targets[0] : internalGroupSO;

            // construct the wrapper
            targetWrapper = InitializeTransformWrapper(useSO, eFrame);

            //connect up to it
            targetWrapper.Target.OnTransformModified += onTransformModified;
            onTransformModified(null);

            // configure gizmo
            update_active();
        }
Пример #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);
            }

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