public void OnSave(ref Dictionary <string, object> data) { Animator anim = GetComponent <Animator>(); // Save parameters List <ParameterState> parameters = new List <ParameterState>(); foreach (var p in anim.parameters) { parameters.Add(new ParameterState { nameHash = p.nameHash, type = p.type, value = GetParameterValue(anim, p.type, p.nameHash) }); } data["anim@parameters"] = parameters; // Save animationstates in layers LayerState[] layers = new LayerState[anim.layerCount]; for (int layer = 0; layer < anim.layerCount; layer++) { var stateInfo = anim.GetCurrentAnimatorStateInfo(layer); layers[layer] = new LayerState { clipHash = stateInfo.shortNameHash, time = stateInfo.normalizedTime }; } data["anim@layers"] = layers; }
void Start() { hp = T2.Stat.MAX_HP; dp = T2.Stat.INIT_DP; pp = T2.Stat.MAX_PP; ap = T2.Stat.MAX_AP; ep = T2.Stat.MAX_EP; curLayerState = LayerState.normal; moveCtrl = GetComponent <T2.MoveCtrl>(); controller = GetComponent <CharacterController>(); line = GetComponent <LineRenderer>(); //마우스 커서 숨기기 //Cursor.visible = false; ctrlPossible.Run = true; ctrlPossible.Sprint = true; ctrlPossible.Attack = true; ctrlPossible.MouseRot = true; ctrlPossible.Skill = true; ChangeState(State.idle); }
void anatomyList_ItemAdded(ButtonGrid arg1, ButtonGridItem arg2) { Anatomy anatomy = (Anatomy)arg2.UserObject; //Ok to access user object here since it is set during the add. Radian theta = sceneViewController.ActiveWindow.Camera.getFOVy(); //Generate thumbnail AxisAlignedBox boundingBox = anatomy.WorldBoundingBox; Vector3 center = boundingBox.Center; //PROBABLY DON'T NEED THIS, ASPECT IS A SQUARE float aspectRatio = (float)ThumbSize / ThumbSize; if (aspectRatio < 1.0f) { theta *= aspectRatio; } Vector3 translation = center; Vector3 direction = anatomy.PreviewCameraDirection; translation += direction * boundingBox.DiagonalDistance / (float)Math.Tan(theta); LayerState layers = new LayerState(anatomy.TransparencyNames, 1.0f); buttonGridThumbs.itemAdded(arg2, layers, translation, center, anatomy); }
public void Insert( int index, LayerState item ) { int baseIndex = GetBaseIndex(index); if (baseIndex == -1) { Add(item); } else { PdfArray baseDataObject = BaseDataObject; // Low-level definition. baseDataObject.Insert(baseIndex++, item.Mode.GetName()); foreach (Layer layer in item.Layers) { baseDataObject.Insert(baseIndex++, layer.BaseObject); } // High-level definition. items.Insert(index, item); item.Attach(this); } }
public void OnSave(ref Dictionary<string, object> data) { Animator anim = GetComponent<Animator>(); // Save parameters List<ParameterState> parameters = new List<ParameterState>(); foreach (var p in anim.parameters) { parameters.Add(new ParameterState { nameHash = p.nameHash, type = p.type, value = GetParameterValue(anim, p.type, p.nameHash) }); } data["anim@parameters"] = parameters; // Save animationstates in layers LayerState[] layers = new LayerState[anim.layerCount]; for(int layer = 0; layer < anim.layerCount; layer++) { var stateInfo = anim.GetCurrentAnimatorStateInfo(layer); layers[layer] = new LayerState { clipHash = stateInfo.shortNameHash, time = stateInfo.normalizedTime }; } data["anim@layers"] = layers; }
public void applyLayers(LayerState layers) { if (layers != null) { layers.apply(); } }
public void applyBlendedLayers(LayerState start, LayerState end, float blend) { if (start != null && end != null) { start.instantlyApplyBlended(end, blend); } }
public void saveLayers(String name) { LayerState layerState = new LayerState(); layerState.captureState(); modelMemory.add(name, layerState); }
public LayerStateManager(IMSCatalog catalog, IMap layerObj, TreeViewItem item, Image treeNodeImg, LayerTreeNodeType layerTreeNodeType = LayerTreeNodeType.ChildLayer, LayerState layerState = LayerState.Visible) { if (item != null && treeNodeImg != null) { this.m_layerState = layerState; this.m_layerStateOld = layerState; m_catalog = catalog; m_layerObj = layerObj; if (m_layerObj is VectorLayer) { m_layerType = LayerType.VectorLayer; } else if (m_layerObj is VectorMapDoc) { m_layerType = LayerType.VectorMapDoc; } m_treeViewItem = item; m_treeNodeImg = treeNodeImg; m_layerTreeNodeType = layerTreeNodeType; //m_treeNodeImg.MouseLeftButtonDown += new MouseButtonEventHandler(OnMouseLeftButtonDown); //m_treeNodeImg.MouseLeftButtonUp += new MouseButtonEventHandler(OnMouseLeftButtonUp); m_treeNodeImg.Source = StateBitmapList[(int)m_layerState]; if (m_treeNodeImg.Tag is RadioButton && layerTreeNodeType == LayerTreeNodeType.ChildLayer) { (m_treeNodeImg.Tag as RadioButton).Click += new RoutedEventHandler(RadioButton_Click); } } }
void hideButton_MouseButtonClick(Widget source, EventArgs e) { LayerState undoState = LayerState.CreateAndCapture(); anatomy.smoothBlend(0.0f, MedicalConfig.CameraTransitionTime, EasingFunction.EaseOutQuadratic); layerController.pushUndoState(undoState); }
public override bool Equals(object obj) { if (!(obj is LayerState)) { return(false); } LayerState state = (LayerState)obj; if (!state.Mode.Equals(Mode) || state.Layers.Count != Layers.Count) { return(false); } IEnumerator <Layer> layerIterator = Layers.GetEnumerator(); IEnumerator <Layer> stateLayerIterator = state.Layers.GetEnumerator(); while (layerIterator.MoveNext()) { stateLayerIterator.MoveNext(); if (!layerIterator.Current.Equals(stateLayerIterator.Current)) { return(false); } } return(true); }
internal void showOnly(Anatomy anatomy) { LayerState currentLayers = LayerState.CreateAndCapture(); TransparencyController.smoothSetAllAlphas(0.0f, MedicalConfig.CameraTransitionTime, EasingFunction.EaseOutQuadratic); anatomy.smoothBlend(1.0f, MedicalConfig.CameraTransitionTime, EasingFunction.EaseOutQuadratic); layerController.pushUndoState(currentLayers); }
void slider_MouseButtonReleased(Widget source, EventArgs e) { if (RecordUndo != null) { RecordUndo.Invoke(undoState); } undoState = null; }
public void CanBackPropagateTwoLayerNetGradient1() { Layer inputlayer = new Layer(new double[, ] { { 1, 1, 1 }, { 1, 1, 1 } }); Layer outputlayer = new Layer(new double[, ] { { 1, 1 } }); LayerChain network = new LayerChain(); network.Add(inputlayer); network.Add(outputlayer); NetworkVector inputvector = new NetworkVector(new double[] { 1, 0, 0 }); NetworkVector outputgradient = new NetworkVector(new double[] { 1 }); network.Run(inputvector); network.BackPropagate(outputgradient); LayerState inputState = network.State[0]; LayerState outputState = network.State[1]; double[,] inputWeights = inputState.Weights; double[,] inputWeightsCheck = new double[, ] { { 0, 1, 1 }, { 0, 1, 1 } }; double[] inputBiases = inputState.Biases; double[] inputBiasesCheck = new double[] { -1, -1 }; for (int i = 0; i < inputWeights.GetLength(0); i++) { Assert.AreEqual(inputBiasesCheck[i], inputBiases[i]); for (int j = 0; j < inputWeights.GetLength(1); j++) { Assert.AreEqual(inputWeights[i, j], inputWeights[i, j]); } } double[,] outputWeights = outputState.Weights; double[,] outputWeightsCheck = new double[, ] { { 0, 0 } }; double[] outputBiases = outputState.Biases; double[] outputBiasesCheck = new double[] { -1 }; for (int i = 0; i < outputWeights.GetLength(0); i++) { Assert.AreEqual(outputBiasesCheck[i], outputBiases[i]); for (int j = 0; j < outputWeights.GetLength(1); j++) { Assert.AreEqual(outputWeightsCheck[i, j], outputWeights[i, j]); } } }
public void applyBookmark(Bookmark bookmark) { SceneViewWindow window = standaloneController.SceneViewController.ActiveWindow; LayerState undoLayers = LayerState.CreateAndCapture(); CameraPosition undoCameraPosition = window.createCameraPosition(); window.setPosition(bookmark.CameraPosition, MedicalConfig.CameraTransitionTime); bookmark.Layers.timedApply(MedicalConfig.CameraTransitionTime); standaloneController.LayerController.pushUndoState(undoLayers); window.pushUndoState(undoCameraPosition); }
//void applyButton_MouseButtonClick(Widget source, EventArgs e) //{ // int numImagesToUpdate; // if (int.TryParse(numToUpdateEdit.Caption, out numImagesToUpdate)) // { // LiveThumbnailUpdater.NumImagesToUpdate = numImagesToUpdate; // } // double secondsToSleep; // if (double.TryParse(secondsToSleepEdit.Caption, out secondsToSleep)) // { // LiveThumbnailUpdater.SecondsToSleep = secondsToSleep; // } //} void addButton_MouseButtonClick(Widget source, EventArgs e) { SceneViewWindow activeWindow = sceneViewController.ActiveWindow; LayerState layers = new LayerState(); layers.captureState(); ButtonGridItem item = buttonGrid.addItem("Main", count++.ToString()); buttonGrid.resizeAndLayout(window.ClientWidget.Width); liveThumbHost.itemAdded(item, layers, activeWindow.Translation, activeWindow.LookAt); }
public void SetLayerState(LayerState s) { curLayerState = s; //캐릭터의 State를 이용하여 무적상태와 일반 상태를 변경시켜주는 부분, if (curLayerState == LayerState.normal) { gameObject.layer = LayerMask.NameToLayer(Layers.T_HitCollider); } else if (curLayerState == LayerState.invincibility) { gameObject.layer = LayerMask.NameToLayer(Layers.T_Invincibility); } }
public void restoreLayers(String name) { LayerState layers = modelMemory.get <LayerState>(name); if (layers != null) { core.applyLayers(layers); } else { Log.Warning("A layer state named '{0}' cannot be found to restore.", name); } }
public void Setup(Map map) { if (true) //map.RenderString.Length==0) { foreach (MapLayer ml in map.Layers) { LayerState ls = new LayerState(); ls.bRender = true; ls.mlayer = ml; Layers.Add(ls); } } }
public bool Remove( LayerState item ) { int index = IndexOf(item); if (index == -1) { return(false); } RemoveAt(index); return(true); }
public Bookmark createBookmark(String name) { LayerState layerState = new LayerState(); layerState.captureState(); SceneViewWindow window = standaloneController.SceneViewController.ActiveWindow; Bookmark bookmark = new Bookmark(name, window.Translation, window.LookAt, layerState); saveBookmark(bookmark, currentPath, bookmarksResourceProvider); fireBookmarkAdded(bookmark); return(bookmark); }
public void AddLayer(MapLayer ml) { LayerState ls = new LayerState(); if (ml.HLine != 0) { ls.drawMode = LayerState.DrawMode.Hline; } else { ls.drawMode = LayerState.DrawMode.None; } ls.bRender = true; Layers.Add(ls); }
public virtual void Initialize(LayerState layerState, double damagedSD, int rowCount) { this.SetState(layerState, damagedSD, rowCount); LayerStroageMatrix = DenseMatrix.Create(rowCount, UnitCount, 0); LayerActivationMatrix = DenseMatrix.Create(rowCount, UnitCount, 0); LayerErrorMatrix = DenseMatrix.Create(rowCount, UnitCount, 0); if (CleanupUnitCount > 0) { CleanupLayerStroageMatrix = DenseMatrix.Create(rowCount, CleanupUnitCount, 0); CleanupLayerActivationMatrix = DenseMatrix.Create(rowCount, CleanupUnitCount, 0); CleanupLayerErrorMatrix = DenseMatrix.Create(rowCount, CleanupUnitCount, 0); } }
public void RemoveLayer(MapLayer ml) { LayerState lsr = null; foreach (LayerState ls in Layers) { if (ls.mlayer == ml) { lsr = ls; } } if (lsr != null) { Layers.Remove(lsr); } }
public void Add( LayerState item ) { PdfArray baseDataObject = BaseDataObject; // Low-level definition. baseDataObject.Add(item.Mode.GetName()); foreach (Layer layer in item.Layers) { baseDataObject.Add(layer.BaseObject); } // High-level definition. items.Add(item); item.Attach(this); }
public void SetState(LayerState layerState, double damagedSD, int rowCount) { state = layerState; switch (layerState) { case LayerState.On: stateMatrix = DenseMatrix.Create(rowCount, UnitCount, 1); break; case LayerState.Off: stateMatrix = DenseMatrix.Create(rowCount, UnitCount, 0); break; case LayerState.Damaged: stateMatrix = RandomizeGaussianMatrixMaker(damagedSD, rowCount); break; } }
public SetupSceneAction(String name, CameraPosition cameraPosition, LayerState layers, MusclePosition musclePosition, PresetState medicalState, bool captureHighlight, bool isHighlighted) { action = new RunCommandsAction(name); Layers = layers != null; Camera = cameraPosition != null; MusclePosition = musclePosition != null; MedicalState = medicalState != null; HighlightTeeth = captureHighlight; if (Layers) { ChangeLayersCommand changeLayersCommand = new ChangeLayersCommand(); changeLayersCommand.Layers.copyFrom(layers); action.addCommand(changeLayersCommand); } if (MusclePosition) { SetMusclePositionCommand musclePositionCommand = new SetMusclePositionCommand(); musclePositionCommand.MusclePosition = musclePosition; action.addCommand(musclePositionCommand); } if (Camera) { MoveCameraCommand moveCameraCommand = new MoveCameraCommand(); moveCameraCommand.CameraPosition = cameraPosition; action.addCommand(moveCameraCommand); } if (MedicalState) { ChangeMedicalStateCommand medicalStateCommand = new ChangeMedicalStateCommand(); medicalStateCommand.PresetState = medicalState; action.addCommand(medicalStateCommand); } if (HighlightTeeth) { action.addCommand(new ChangeTeethHighlightsCommand(isHighlighted)); } AllowPreview = true; }
public IGraphicBufferProducer CreateLayer(out long layerId, ulong pid, LayerState initialState = LayerState.ManagedClosed) { layerId = 1; lock (Lock) { foreach (KeyValuePair <long, Layer> pair in _layers) { if (pair.Key >= layerId) { layerId = pair.Key + 1; } } } CreateLayerFromId(pid, layerId, initialState); return(GetProducerByLayerId(layerId)); }
public void OnLoad(Dictionary <string, object> data) { Animator anim = GetComponent <Animator>(); // Load parameters List <ParameterState> parameters = (List <ParameterState>)data["anim@parameters"]; foreach (var p in parameters) { SetParameterValue(anim, p); } // Jump back to correct animation clips LayerState[] layers = (LayerState[])data["anim@layers"]; for (int layer = 0; layer < layers.Length; layer++) { LayerState state = layers[layer]; anim.Play(state.clipHash, layer, state.time); } }
public void applySceneStateToSlide(Slide slide) { CameraPosition cameraPos = new CameraPosition(); if (sceneViewController.ActiveWindow != null) { SceneViewWindow window = sceneViewController.ActiveWindow; cameraPos.Translation = window.Translation; cameraPos.LookAt = window.LookAt; window.calculateIncludePoint(cameraPos); } LayerState layers = new LayerState(); layers.captureState(); PresetState medicalState = medicalStateController.createPresetState(""); MusclePosition musclePosition = new MusclePosition(); musclePosition.captureState(); slide.StartupAction = new SetupSceneAction("Show", cameraPos, layers, musclePosition, medicalState, true, TeethController.HighlightContacts); }
public void BackPropagateIsCorrect() { double[,] weights = new double[, ] { { 1, 2 }, { 3, 5 } }; Layer layer = new LinearLayer(weights); NetworkVector layerinput = new NetworkVector(new double[] { 1, -1 }); layer.Run(layerinput); NetworkVector outputgradient = new NetworkVector(new double[] { 7, 11 }); layer.BackPropagate(outputgradient); double[,] weightsCheck = new double[, ] { { -6, 9 }, { -8, 16 } }; LayerState state = layer.State; for (int i = 0; i < layer.NumberOfInputs; i++) { for (int j = 0; j < layer.NumberOfInputs; j++) { Assert.AreEqual(weightsCheck[i, j], state.Weights[i, j], string.Format("Failed for (i, j) = ({0}, {1}", i, j)); } } double[] biasesCheck = new double[] { -7, -11 }; for (int i = 0; i < layer.NumberOfInputs; i++) { Assert.AreEqual(biasesCheck[i], layer.State.Biases[i]); } double[] inputGradientCheck = new double[] { 40, 69 }; double[] inputGradientValues = layer.InputGradient.ToArray(); for (int i = 0; i < layer.NumberOfInputs; i++) { Assert.AreEqual(inputGradientCheck[i], inputGradientValues[i], string.Format("Failure for input {0}", i)); } }
public void Setup(Map map) { if (true)//map.RenderString.Length==0) { foreach (MapLayer ml in map.Layers) { LayerState ls = new LayerState(); ls.bRender = true; ls.mlayer = ml; Layers.Add(ls); } } }
public void AddLayer(MapLayer ml) { LayerState ls = new LayerState(); if (ml.HLine != 0) ls.drawMode = LayerState.DrawMode.Hline; else ls.drawMode = LayerState.DrawMode.None; ls.bRender = true; Layers.Add(ls); }
public void SetState(LayerState layerState, double damagedSD, int rowCount) { state = layerState; switch(layerState) { case LayerState.On: stateMatrix = DenseMatrix.Create(rowCount, UnitCount, 1); break; case LayerState.Off: stateMatrix = DenseMatrix.Create(rowCount, UnitCount, 0); break; case LayerState.Damaged: stateMatrix = RandomizeGaussianMatrixMaker(damagedSD, rowCount); break; } }
public override void Initialize(LayerState layerState, double damagedSD, int rowCount) { base.Initialize(layerState, damagedSD, rowCount); CurrentTick = 0; HideLayerList = new List<Layer>(); for (int layerIndex = 0; layerIndex <= Tick; layerIndex++) { Layer newLayer = new Layer(random, Name + "-Hide" + layerIndex, UnitCount, 0, 0); newLayer.BiasMatrix = (Matrix<double>)BaseHideBiasMatrix.Clone(); newLayer.Initialize(layerState, damagedSD, rowCount); HideLayerList.Add(newLayer); } HideConnectionList = new List<Connection>(); for (int connectionIndex = 0; connectionIndex < Tick; connectionIndex++) { Connection newConnection = new Connection(random, Name + "-Hide" + connectionIndex, HideLayerList[connectionIndex], HideLayerList[connectionIndex + 1], 0); newConnection.WeightMatrix = (Matrix<double>)BaseHideWeightMatrix.Clone(); newConnection.Initialize(ConnectionState.On, 0); HideConnectionList.Add(newConnection); } }