public void sceneLoaded(SimScene scene)
        {
            //restoreButton.Enabled = false;
            leftCP             = ControlPointController.getControlPoint("LeftCP");
            rightCP            = ControlPointController.getControlPoint("RightCP");
            movingMuscle       = MuscleController.getMuscle("MovingMuscleDynamic");
            movingMuscleTarget = MuscleController.MovingTarget;
            Enabled            = leftCP != null && rightCP != null && movingMuscle != null && movingMuscleTarget != null;
            if (Enabled)
            {
                //setup ui
                float leftNeutral = leftCP.NeutralLocation;
                synchronizeLeftCP(leftCP, leftNeutral);
                leftForwardBack.Minimum          = leftCP.PosteriorShiftMaxLocation;
                leftForwardBack.SequentialChange = (leftForwardBack.Maximum - leftForwardBack.Minimum) / 10.0f;
                float rightNeutral = rightCP.NeutralLocation;
                synchronizeRightCP(rightCP, rightNeutral);
                rightForwardBack.Minimum          = rightCP.PosteriorShiftMaxLocation;
                rightForwardBack.SequentialChange = (rightForwardBack.Maximum - rightForwardBack.Minimum) / 10.0f;
                bothForwardBack.Value             = rightForwardBack.Value;
                bothForwardBack.Minimum           = rightForwardBack.Minimum < leftForwardBack.Minimum ? rightForwardBack.Minimum : leftForwardBack.Minimum;
                bothForwardBack.SequentialChange  = rightForwardBack.SequentialChange;
                synchronizeMovingMuscleOffset(movingMuscleTarget, movingMuscleTarget.Offset);
                synchronizeForce(movingMuscle, movingMuscle.getForce());

                //setup callbacks
                leftCP.PositionChanged           += leftCP_PositionChanged;
                rightCP.PositionChanged          += rightCP_PositionChanged;
                movingMuscleTarget.OffsetChanged += movingMuscleTarget_OffsetChanged;
                movingMuscle.ForceChanged        += movingMuscle_ForceChanged;
            }
        }
예제 #2
0
        public virtual void createSceneView(SimScene scene)
        {
            Log.Info("Creating SceneView for {0}.", name);
            SimSubScene defaultScene = scene.getDefaultSubScene();

            sceneView = window.createSceneView(defaultScene, name, cameraMover.Translation, cameraMover.LookAt, zIndexStart + zOffset++);
            sceneView.setDimensions(sceneViewportLocation.x, sceneViewportLocation.y, sceneViewportSize.Width, sceneViewportSize.Height);
            if (vpBackground != null)
            {
                vpBackground.setDimensions(sceneViewportLocation.x, sceneViewportLocation.y, sceneViewportSize.Width, sceneViewportSize.Height);
            }
            sceneView.BackgroundColor = backColor;
            sceneView.setNearClipDistance(1.0f);
            sceneView.setFarClipDistance(1000.0f);
            sceneView.FovY            = fovY;
            sceneView.ClearEveryFrame = clearEveryFrame;
            sceneView.setRenderingMode(renderingMode);
            cameraMover.setCamera(new CameraPositioner(sceneView, MinNearDistance, NearPlaneWorld, NearFarLength));
            sceneView.RenderingStarted += sceneView_RenderingStarted;
            sceneView.RenderingEnded   += sceneView_RenderingEnded;
            sceneView.SchemeName        = schemeName;
            if (CameraCreated != null)
            {
                CameraCreated.Invoke(this);
            }
        }
 internal void sceneLoading(SimScene scene)
 {
     if (slideEditorContext != null)
     {
         slideEditorContext.resetSlide();
     }
 }
예제 #4
0
 void controller_BeforeSceneLoadProperties(SimScene scene)
 {
     if (splashScreen != null)
     {
         splashScreen.updateStatus(LoadingScenePropertiesPosition, "Loading Scene Properties");
     }
 }
 public void sceneUnloading(SimScene scene)
 {
     if (timelineEditorContext != null)
     {
         timelineEditorContext.clearSelection();
     }
 }
예제 #6
0
        public DebugVisualizer(StandaloneController standaloneController)
            : base("Developer.GUI.DebugVisualizer.DebugVisualizer.layout")
        {
            this.medicalController               = standaloneController.MedicalController;
            this.pluginManager                   = medicalController.PluginManager;
            standaloneController.SceneLoaded    += standaloneController_SceneLoaded;
            standaloneController.SceneUnloading += standaloneController_SceneUnloading;

            uiCallback = new GuiFrameworkUICallback();

            tree         = new Tree((ScrollView)window.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, uiCallback);

            propertiesForm = new ScrollablePropertiesForm((ScrollView)window.findWidget("TableScroller"), uiCallback);

            objectEditor = new ObjectEditor(editTreeView, propertiesForm, uiCallback);

            this.Resized += DebugVisualizer_Resized;

            currentScene = standaloneController.MedicalController.CurrentScene;

            splitter = new Splitter(window.findWidget("Splitter"));
            splitter.Widget1Resized += a => tree.layout();
            splitter.Widget2Resized += a => propertiesForm.layout();
        }
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadScene(ScenePackage scenePackage, SceneBuildOptions options)
        {
            currentScenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            currentScene = scenePackage.SceneDefinition.createScene();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, currentScene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(currentScene.getDefaultSubScene());
            foreach (var status in currentScene.buildSceneStatus(options))
            {
                yield return(status);
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, currentScene);
            }
        }
예제 #8
0
 private void standaloneController_SceneLoaded(SimScene scene)
 {
     currentScene = scene;
     foreach (AtlasPlugin plugin in plugins)
     {
         plugin.sceneLoaded(scene);
     }
 }
 public void destroyDebugObjects(SimScene scene)
 {
     if (debugDrawer != null)
     {
         medicalController.PluginManager.RendererPlugin.destroyDebugDrawingSurface(debugDrawer);
         debugDrawer = null;
     }
 }
예제 #10
0
 private void standaloneController_SceneUnloading(SimScene scene)
 {
     foreach (AtlasPlugin plugin in plugins)
     {
         plugin.sceneUnloading(scene);
     }
     currentScene = null;
 }
예제 #11
0
 private void SceneController_OnSceneLoaded(SceneController controller, SimScene scene)
 {
     sceneViewController.createCameras(scene);
     lightManager.sceneLoaded(scene);
     //var vrFramework = scene.Scope.Resolve<OgreFramework>();
     var subScene     = scene.getDefaultSubScene();
     var sceneManager = subScene.getSimElementManager <OgreSceneManager>();
     //vrFramework.Init(OgrePlugin.Root.getSingleton(), sceneManager.SceneManager);
 }
예제 #12
0
        void controller_SceneLoaded(SimScene scene)
        {
            var simScene = scene.getDefaultSubScene().getSimElementManager <SimulationScene>();

            AllowPosing = simScene.AllowIK;

            ikScene = scene.getDefaultSubScene().getSimElementManager <BEPUikScene>();
            togglePicking();
        }
예제 #13
0
 /// <summary>
 /// Callback for when the scene is unloading. Will clear all SimObject instances.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="scene"></param>
 private void SceneController_OnSceneUnloading(SceneController controller, SimScene scene)
 {
     if (simObjectManager != null)
     {
         simObjectManager.Dispose();
         simObjectManager = null;
         subScene         = null;
     }
 }
 void sceneController_OnSceneLoaded(SceneController controller, SimScene scene)
 {
     debugSurface = renderer.createDebugDrawingSurface("EditInterfaceRenderer", scene.getDefaultSubScene());
     if (debugSurface != null)
     {
         debugSurface.moveOrigin(currentOrigin);
         debugSurface.setOrientation(currentRotation);
     }
 }
예제 #15
0
 public void sceneLoaded(SimScene scene)
 {
     leftDiscPanel.sceneLoaded();
     rightDiscPanel.sceneLoaded();
     if (rightDiscPanel.Disc != null)
     {
         synchronizeHorizontalOffset(rightDiscPanel.Disc, rightDiscPanel.Disc.HorizontalOffset.x);
     }
 }
예제 #16
0
 public void destroyIkControls(SimScene scene)
 {
     if (ikDebug != null)
     {
         medicalController.PluginManager.RendererPlugin.destroyDebugDrawingSurface(ikDebug);
         ikDebug = null;
     }
     hips = null;
     ikDragSimObjects.Clear();
 }
 void controller_SceneLoaded(SimScene scene)
 {
     bindPosition = new MusclePosition();
     bindPosition.captureState();
     poseUndoRedoBuffer.clear();
     if (OnUndoRedoChanged != null)
     {
         OnUndoRedoChanged.Invoke(this);
     }
 }
예제 #18
0
        public void sceneLoaded(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null)
            {
                drawingSurface = rendererPlugin.createDebugDrawingSurface(name + "DebugSurface", subScene);
                drawingSurface.setDepthTesting(false);
                drawingSurface.setVisible(visible);
            }
        }
예제 #19
0
 void sceneUnloading(SimScene scene)
 {
     currentScene = null;
     if (!firstShow)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
     }
 }
예제 #20
0
 /// <summary>
 /// Use the current setup of the scene to create a "normal" state.
 /// </summary>
 public void sceneLoaded(SimScene scene)
 {
     sceneLoadNormalState                  = this.createState("Normal");
     sceneLoadNormalState.Notes.Notes      = "Normal";
     sceneLoadNormalState.Notes.DataSource = "Automatic";
     sceneLoadNormalState.Thumbnail        = imageRenderer.renderImage(imageProperties);
     states.Add(sceneLoadNormalState);
     if (StateAdded != null)
     {
         StateAdded.Invoke(this, sceneLoadNormalState);
     }
 }
예제 #21
0
 void standaloneController_SceneUnloading(SimScene scene)
 {
     medicalController.OnLoopUpdate -= MedicalController_OnLoopUpdate;
     currentScene = null;
     if (!firstShow)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
     }
 }
예제 #22
0
 public void sceneUnloading(SimScene scene)
 {
     if (sceneLoadNormalState != null)
     {
         states.Remove(sceneLoadNormalState);
         if (StateRemoved != null)
         {
             StateRemoved.Invoke(this, sceneLoadNormalState);
         }
         sceneLoadNormalState.Dispose();
         sceneLoadNormalState = null;
     }
 }
예제 #23
0
        public void sceneUnloading(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null && manualObject != null)
            {
                OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                sceneManager.SceneManager.getRootSceneNode().removeChild(sceneNode);
                sceneNode.detachObject(manualObject);
                sceneManager.SceneManager.destroyManualObject(manualObject);
                sceneManager.SceneManager.destroySceneNode(sceneNode);
                manualObject = null;
                sceneNode    = null;
            }
        }
예제 #24
0
        public void sceneLoaded(SimScene scene)
        {
            if (!activeSceneLights.ContainsKey(scene))
            {
                SimSubScene subScene = scene.getDefaultSubScene();

                if (subScene.hasSimElementManagerType(typeof(OgreSceneManager)))
                {
                    OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                    Light            light        = sceneManager.SceneManager.createLight("CameraLight");
                    LightMover       lightMover   = new LightMover(light);
                    sceneManager.SceneManager.addSceneListener(lightMover);
                    activeSceneLights.Add(scene, lightMover);
                }
            }
        }
예제 #25
0
        internal void destroyCamera(SimScene scene)
        {
            if (cameraPositioner != null)
            {
                SimSubScene      defaultScene = scene.getDefaultSubScene();
                OgreSceneManager sceneManager = defaultScene.getSimElementManager <OgreSceneManager>();

                renderTexture.destroyViewport(vp);
                vp = null;

                node.detachObject(camera);
                sceneManager.SceneManager.destroyCamera(camera);
                sceneManager.SceneManager.destroySceneNode(node);
                cameraPositioner = null;
            }
        }
예제 #26
0
        /// <summary>
        /// Create a model.
        /// </summary>
        /// <param name="meshName">The name of the mesh to load.</param>
        /// <param name="scene">The scene to load the mesh into.</param>
        public void createModel(String meshName, SimScene scene)
        {
            entityDefintion.MeshName = meshName;
            currentSimObject         = simObjectDefinition.register(scene.getDefaultSubScene());
            Stopwatch sw = new Stopwatch();

            sw.Start();
            scene.buildScene(SceneBuildOptions.None);
            sw.Stop();
            Log.Info("Scene loaded in {0} ms.", sw.ElapsedMilliseconds);
            entity = ((SceneNodeElement)currentSimObject.getElement("EntityNode")).getNodeObject("Entity") as Entity;
            readModelInfo();
            entity.setDisplaySkeleton(showSkeleton);
            selectableModel.ModelObject = currentSimObject;
            controller.ObjectMover.clearMovableObjects();
            controller.ObjectMover.addMovableObject("model", selectableModel);
        }
예제 #27
0
 public void createCameras(SimScene scene)
 {
     foreach (SceneViewWindow window in mdiWindows)
     {
         window.createSceneView(scene);
     }
     foreach (TextureSceneView window in textureWindows)
     {
         window.createSceneView(scene);
     }
     if (cloneWindow != null)
     {
         cloneWindow.createSceneView(scene);
     }
     camerasCreated = true;
     currentScene   = scene;
 }
예제 #28
0
 public void destroyCameras()
 {
     foreach (SceneViewWindow window in mdiWindows)
     {
         window.destroySceneView();
     }
     foreach (TextureSceneView window in textureWindows)
     {
         window.destroySceneView();
     }
     if (cloneWindow != null)
     {
         cloneWindow.destroySceneView();
     }
     camerasCreated = false;
     currentScene   = null;
 }
 /// <summary>
 /// Destroy the currently loaded scene. Does nothing if no scene is loaded.
 /// </summary>
 public void destroyScene()
 {
     if (currentScene != null)
     {
         if (OnSceneUnloading != null)
         {
             OnSceneUnloading.Invoke(this, currentScene);
         }
         currentSimObjects.Dispose();
         currentSimObjects = null;
         currentScene.Dispose();
         currentScene = null;
         if (OnSceneUnloaded != null)
         {
             OnSceneUnloaded.Invoke(this, null);
         }
     }
 }
예제 #30
0
        public void sceneLoaded(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null)
            {
                OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                manualObject = sceneManager.SceneManager.createManualObject(name + "__MeasurementManualObject");
                manualObject.setRenderQueueGroup(95);
                manualObject.RedrawRequired += manualObject_RedrawRequired;
                sceneNode = sceneManager.SceneManager.createSceneNode(name + "__MeasurementManualObjectSceneNode");
                sceneNode.attachObject(manualObject);
                sceneNode.setVisible(visible);
                sceneNode.setPosition(origin);
                sceneManager.SceneManager.getRootSceneNode().addChild(sceneNode);
                redraw();
            }
        }