public void Witsml131Context_Rig_Can_Query_For_All_Rigs() { AddParents(); var rig = new Rig { Uid = DevKit.Uid(), Name = DevKit.Name("Rig"), UidWell = Well.Uid, NameWell = Well.Name, UidWellbore = Wellbore.Uid, NameWellbore = Wellbore.Name }; DevKit.Proxy.Write(DevKit.New <RigList>(x => x.Rig = DevKit.List(rig))); var witsmlQuery = Context.Rigs.With(OptionsIn.ReturnElements.IdOnly); var rigs = witsmlQuery.ToList(); Assert.IsTrue(rigs.Count > 0); Assert.IsNotNull(rigs.FirstOrDefault(r => r.Uid == rig.Uid)); }
public async Task Rig131_GetResources_Can_Get_All_Rig_Resources() { AddParents(); DevKit.AddAndAssert <RigList, Rig>(Rig); await RequestSessionAndAssert(); var uri = Rig.GetUri(); var parentUri = uri.Parent; await GetResourcesAndAssert(parentUri); var folderUri = parentUri.Append(uri.ObjectType); await GetResourcesAndAssert(folderUri); }
public async Task AddAsync(AddRigInputModel input, string userId) { var rig = new Rig { Name = input.Name, Description = input.Description, OwnerId = userId, }; var rigImgUrl = await this.cloudinaryService.UploadAsync(input.Image, input.Image.FileName); rig.Image = new Image { OwnerId = userId, Url = rigImgUrl, }; for (int i = 0; i < input.Materials.Count(); i++) { rig.Materials.Add(new Material { Rig = rig, Description = input.Materials[i].Description, MaterialNumber = i + 1, }); } for (int i = 0; i < input.Steps.Count(); i++) { var stepImgUrl = await this.cloudinaryService.UploadAsync(input.Steps[i].Image, input.Steps[i].Image.FileName); rig.Steps.Add(new Step { Rig = rig, Description = input.Steps[i].Description, StepNumber = i + 1, Image = new Image { OwnerId = userId, Url = stepImgUrl, }, }); } await this.rigsRepository.AddAsync(rig); await this.rigsRepository.SaveChangesAsync(); }
/// <summary> /// Validates if the Editor and the provided Rig are in a correct state to do motion transfer. /// </summary> /// <param name="rig">The Rig that will be used for motion transfer.</param> /// <returns>Returns true if both the editor and the provided Rig are in a valid state for motion transfer. Returns false if the requirements are not met.</returns> public static bool TransferMotionValidate(Rig rig) { if (!AnimationWindowUtils.isPreviewing || AnimationWindowUtils.activeAnimationClip == null) { return(false); } var selected = Selection.instanceIDs; if (selected.Length != 1) { return(false); } var selectedGO = EditorUtility.InstanceIDToObject(selected[0]) as GameObject; if (selectedGO != rig.gameObject) { return(false); } var rigBuilder = rig.GetComponentInParent <RigBuilder>(); if (rigBuilder == null) { return(false); } var animator = rigBuilder.GetComponent <Animator>(); if (animator.isHuman) { return(false); } bool inRigBuilder = false; var layers = rigBuilder.layers; for (int i = 0; i < layers.Count; ++i) { if (layers[i].rig == rig && layers[i].active) { inRigBuilder = true; } } return(inRigBuilder); }
public void TestSetUp() { Logger.Debug($"Executing {TestContext.TestName}"); DevKit = new DevKit200Aspect(TestContext); Rig = new Rig { SchemaVersion = EtpUris.GetUriFamily(typeof(Rig)).Version, Uuid = DevKit.Uid(), Citation = DevKit.Citation("Rig") }; BeforeEachTest(); OnTestSetUp(); }
public void CreateSequence(Rig rig, Recorder recorder, float[] rTimings) { var path = _pathPlanner.GetRandomPath(rig); float[] timings = new float[rTimings.Length]; float t = 0; for (int i = 0; i < rTimings.Length; ++i) { timings[i] = UnityEngine.Random.Range(t, rTimings[i]); t += rTimings[i]; } recorder.Record(path, timings, _pathPlanner.GetRandomContactingFrames()); }
private void ResetRigHandles() { inputDownEventData = null; if (this.AffineType == BoundingBoxGizmoHandleTransformType.Scale) { cachedRenderer.sharedMaterial = Rig.ScaleHandleMaterial; } else { cachedRenderer.sharedMaterial = Rig.RotateHandleMaterial; } HoloToolkit.Unity.InputModule.InputManager.Instance.PopModalInputHandler(); Rig.FocusOnHandle(null); }
protected override void OneTimeSetUp() { base.OneTimeSetUp(); // Create rig m_Rig = new Rig { Value = CreateTestRigDefinition() }; var path = "MotionClip.blob"; m_Clip = BlobFile.ReadBlobAsset <Clip>(path); ClipManager.Instance.GetClipFor(m_Rig, m_Clip); }
private void CreateDebugBoneRig(Entity entity, ref Rig rig) { var ecb = EsBufferSystem.CreateCommandBuffer(); var debugEntityRig = RigUtils.InstantiateDebugRigEntity(rig.Value, EntityManager, new BoneRendererProperties { BoneShape = BoneRendererUtils.BoneShape.Line, Color = new float4(0, 1, 0, 1), Size = 1 }); ecb.AddComponent(debugEntityRig, new LocalToParent { Value = float4x4.identity }); ecb.AddComponent(debugEntityRig, new Parent { Value = entity }); }
private void Drawing(Rig rig) { //Get Body Data SubRig R_hand = rig.GetSubRig("R_Hand"); SubRig L_hand = rig.GetSubRig("L_Hand"); SubRig L_leg = rig.GetSubRig("L_Leg"); SubRig R_leg = rig.GetSubRig("R_Leg"); SubRig[] body = rig.GetBodyRig(); //Draw Line in 3D Space rig.DrawLine(R_hand, Lines3D[0]); rig.DrawLine(L_hand, Lines3D[1]); rig.DrawLine(R_leg, Lines3D[2]); rig.DrawLine(L_leg, Lines3D[3]); rig.DrawLine(body, Lines3D[4]); }
private static int[] GetPingTimes(Dictionary <string, string>[] poolInfo, Rig rig) { if (poolInfo == null || poolInfo.Length == 0) { return new[] { 333, 333, 333 } } ; string[] stratum = PruvotApi.GetDictValue <string>(poolInfo[0], "URL").Split('/'); string[] stratumUrlPort = stratum[stratum.Length - 1].Split(':'); int[] pingTimes = new int[3]; Ping pinger = new Ping(); PingReply miningUrlPing = null; PingReply networkRigPing = null; try { miningUrlPing = stratumUrlPort[0] != "-1" ? pinger.Send(stratumUrlPort[0], 333) : null; networkRigPing = pinger.Send(rig.IpAddress, 333); // Will try to just ping the URL without subdomain if it failed, // May give bad results but it's just a small stat for fun ^^ // Ping by Pruvotapi is more accurate // PS: Let's hope it's not a .co.uk :D if (miningUrlPing != null && miningUrlPing.Status != IPStatus.Success) { string[] stratumDomains = stratumUrlPort[0].Split('.'); string lastParts = stratumDomains[stratumDomains.Length - 2] + '.' + stratumDomains[stratumDomains.Length - 1]; miningUrlPing = pinger.Send(lastParts, 333); } } catch { } pingTimes[0] = PruvotApi.GetDictValue <int>(poolInfo[0], "PING"); pingTimes[1] = (int)(miningUrlPing != null && miningUrlPing.Status == IPStatus.Success ? miningUrlPing.RoundtripTime : 333); pingTimes[2] = (int)(networkRigPing != null && networkRigPing.Status == IPStatus.Success ? networkRigPing.RoundtripTime : 333); return(pingTimes); }
// Update is called once per frame. void Update() { // If the rig and main camera are valid. if (Rig != null && MainCamera != null) { // Calculate the travel vector based on the user's head and the rig. Vector3 travelVector = MainCamera.transform.position - Rig.transform.position; // Ignore any height value. travelVector.y = 0.0f; // Activate human joystick if the travel vector is larger than the radius. if (travelVector.magnitude >= Radius) { // Calculate the ratio of the travel vector compared to the radius. float ratio = travelVector.magnitude / Radius; // Normalize the travel vector for multiplication. travelVector.Normalize(); // Scale the travel vector by the ratio and speed per second (which requires deltaTime). Vector3 movement = travelVector * ratio * Speed * Time.deltaTime; // Begin locomotion. if (CanBeginLocomotion() && BeginLocomotion()) { // Determine the camera's new world location. Vector3 newLocation = MainCamera.transform.position + movement; // Move the rig and camera to the character controller's world location. Rig.MoveCameraToWorldLocation(newLocation); // End locomotion. EndLocomotion(); } } // If the no-travel zone is valid. if (NoTravelZone != null) { // Move the no-travel zone to match the rig. NoTravelZone.transform.position = Rig.transform.position; // Scale the NoTravelZone to match the radius. float originalHeight = NoTravelZone.transform.localScale.y; NoTravelZone.transform.localScale = new Vector3(Radius, originalHeight, Radius); } } }
public void GenerateRig_ReturnsGeneratedRig() { RigTemplate rigTemplate = GetRigTemplate(); A.CallTo(() => m_rigTemplateRepo.GetRigTemplate("Jackup")).Returns(rigTemplate); Rig expectedRig = new Rig() { Id = Guid.NewGuid().ToString() }; A.CallTo(() => m_rigRepo.Create("Jackup", string.Empty, string.Empty)).Returns(expectedRig); Rig rig = m_testSubject.GenerateRig("Jackup", string.Empty, string.Empty); Assert.AreEqual(expectedRig.Id, rig.Id); }
protected override FKGraphData CreateGraph(Entity entity, ref Rig rig, PreAnimationGraphSystem graphSystem, ref FKGraphSetup setup) { var set = graphSystem.Set; var debugEntity = RigUtils.InstantiateDebugRigEntity( rig, EntityManager, new BoneRendererProperties { BoneShape = BoneRendererUtils.BoneShape.Line, Color = math.float4(1f, 0f, 0f, 1f), Size = 1f } ); if (EntityManager.HasComponent <Translation>(entity)) { float3 t = EntityManager.GetComponentData <Translation>(entity).Value; PostUpdateCommands.AddComponent( debugEntity, new Translation { Value = t - math.float3(0f, 0f, 0.5f) } ); } var data = new FKGraphData(); data.DeltaTimeNode = set.Create <DeltaTimeNode>(); data.ClipNode = set.Create <ClipPlayerNode>(); data.EntityNode = set.CreateComponentNode(entity); data.DebugEntityNode = set.CreateComponentNode(debugEntity); set.Connect(data.DeltaTimeNode, DeltaTimeNode.KernelPorts.DeltaTime, data.ClipNode, ClipPlayerNode.KernelPorts.DeltaTime); set.Connect(data.ClipNode, ClipPlayerNode.KernelPorts.Output, data.EntityNode); set.Connect(data.ClipNode, ClipPlayerNode.KernelPorts.Output, data.DebugEntityNode); set.SetData(data.ClipNode, ClipPlayerNode.KernelPorts.Speed, 1.0f); set.SendMessage(data.ClipNode, ClipPlayerNode.SimulationPorts.Configuration, new ClipConfiguration { Mask = ClipConfigurationMask.LoopTime | ClipConfigurationMask.LoopValues }); set.SendMessage(data.ClipNode, ClipPlayerNode.SimulationPorts.Rig, rig); set.SendMessage(data.ClipNode, ClipPlayerNode.SimulationPorts.Clip, setup.Clip); PostUpdateCommands.AddComponent(entity, graphSystem.Tag); return(data); }
public void CreateRig() { if (rigBuilder == null) { rigBuilder = transform.parent.gameObject.AddComponent <RigBuilder>(); } if (rigGameObject == null) { rigGameObject = new GameObject("rig"); rigGameObject.transform.SetParent(rigBuilder.transform); } if (rig == null) { rig = rigGameObject.AddComponent <Rig>(); rigBuilder.layers.Add(new RigLayer(rig)); } if (twoBoneManager == null) { twoBoneManager = new GameObject("ik"); twoBoneManager.transform.SetParent(rigGameObject.transform); } twoBoneManager.transform.position = lowLegPosition.position; if (twoBoneIK == null) { twoBoneIK = twoBoneManager.AddComponent <TwoBoneIKConstraint>(); twoBoneIK.data.root = upLegPivot.transform; twoBoneIK.data.mid = midLegPivot.transform; twoBoneIK.data.tip = lowLegPivot.transform; twoBoneIK.data.target = twoBoneManager.transform; } if (hint == null) { hint = new GameObject("hint"); hint.transform.SetParent(twoBoneManager.transform); twoBoneIK.data.hint = hint.transform; } hint.transform.position = midLegPosition.position + new Vector3(0, 0, 1); }
public void TestGetTotalBahtAutoBtcMiningPerDayFromZergPool() { string json = System.IO.File.ReadAllText("myrig.json"); Rig myRig = JsonConvert.DeserializeObject <Rig>(json); HashPower.SetupHardware(myRig); MiningCalculator calc = new MiningCalculator(); foreach (string algorithmName in AlgoritmName.Symbols) { calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName); double btcCurrentPerDay = calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, true, FiatCurrency.THB); double btc24HoursPerDay = calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, false, FiatCurrency.THB); Debug.WriteLine(string.Format("{0} estimate_current: {1} baht estimate_24hour: {2} baht ", algorithmName, btcCurrentPerDay.ToString("N2"), btc24HoursPerDay.ToString("N2"))); Assert.AreEqual(true, btcCurrentPerDay > -1); } }
// This one is signed up to the UPGRADED A RIG delegate in the MapDelegateHolder void UpdateMyRigUI(int idOfUpdatedRig, Rig currentRigInfo) { if (idOfUpdatedRig == myRigID.myControlID) { // FIRST check whether this is the last upgrade if (currentRigInfo.id >= 9) { title.text = currentRigInfo.title; description.text = currentRigInfo.myDescription; miscText.text = "MAX RIG LVL REACHED!"; rigIcon.sprite = currentRigInfo.icon; buttonText.text = "MAX UPGRADE REACHED"; tempEffectPercentage += currentRigInfo.myEffectOnMining; currentEffectText.text = "+ " + tempEffectPercentage.ToString() + "%"; upgradeLvlUI.fillAmount = currentRigInfo.buildingID / currentMapController.itemDatabase.rigTypes.Count; // Set this button as disabled upgradeLvlUI.fillAmount = 1; upgradeButton.GetComponent <Image>().color = Color.gray; upgradeButton.interactable = false; fullyUpgraded = true; myRig = currentRigInfo; return; } title.text = currentRigInfo.title; description.text = currentRigInfo.myDescription; miscText.text = "Next rig effect: \n" + "+" + currentRigInfo.myEffectOnMining + "% mining speed"; rigIcon.sprite = currentRigInfo.icon; tempEffectPercentage += currentRigInfo.myEffectOnMining; currentEffectText.text = "+ " + tempEffectPercentage.ToString() + "%"; buttonText.text = "BUY BETTER RIG\n" + currentRigInfo.priceOfNextUpgradeLvl; //rigsControlled.text = "x1"; upgradeLvlUI.fillAmount = (float)currentRigInfo.id / itemDatabase.rigTypes.Count; myRig = currentRigInfo; } }
public void OnInputDown(InputEventData eventData) { inputDownEventData = eventData; initialHandPosition = GetHandPosition(eventData.SourceId); lastHandWorldPos = initialHandPosition; initialScale = transformToAffect.localScale; initialPosition = transformToAffect.position; initialOrientation = transformToAffect.rotation.eulerAngles; initialRotation = transformToAffect.rotation; initialHandOrientation = GetHandOrientation(eventData.SourceId); initialScaleOrigin = transformToAffect.position - this.transform.position; HoloToolkit.Unity.InputModule.InputManager.Instance.PushModalInputHandler(gameObject); cachedRenderer.sharedMaterial = Rig.InteractingMaterial; Rig.FocusOnHandle(this.gameObject); eventData.Use(); }
private void onPropAccessoryLoaded(string path, GameObject prefab) { if (base.gameObject.IsDestroyed()) { return; } if (prefab != null) { propAccessory = UnityEngine.Object.Instantiate(prefab); Prop component = GetComponent <Prop>(); if (component != null && component.PropUserRef != null) { Rig component2 = component.PropUserRef.GetComponent <Rig>(); parentPropAccessoryToTargetBone(component2); CameraCullingMaskHelper.SetLayerRecursive(component.transform, LayerMask.LayerToName(component.gameObject.layer)); } } isLoadingComplete = true; }
protected override void CreateGraph(Entity e, ref Rig rig, ref RigRemapRuntime setup) { var ecb = EcbSystem.CreateCommandBuffer(); var set = GraphSystem.Set; var data = new RigRemapKernelRuntime { ClipPlayerNode = set.Create <ClipPlayerNode>(), DeltaTimeNode = set.Create <ConvertDeltaTimeToFloatNode>(), EntityNode = set.CreateComponentNode(e), RemapperNode = set.Create <RigRemapperNode>() }; set.SetData(data.ClipPlayerNode, ClipPlayerNode.KernelPorts.Speed, 1.0f); set.Connect(data.EntityNode, data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Input); set.Connect(data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Float, data.ClipPlayerNode, ClipPlayerNode.KernelPorts.DeltaTime); set.Connect(data.ClipPlayerNode, ClipPlayerNode.KernelPorts.Output, data.RemapperNode, RigRemapperNode.KernelPorts.Input); set.Connect(data.RemapperNode, RigRemapperNode.KernelPorts.Output, data.EntityNode, NodeSetAPI.ConnectionType.Feedback); set.SendMessage(data.ClipPlayerNode, ClipPlayerNode.SimulationPorts.Configuration, new ClipConfiguration { Mask = ClipConfigurationMask.LoopTime }); //The playerClipNode Rig input will retrieve the srcRig that we want to copy since the animation clip is mapped to that rig. set.SendMessage(data.ClipPlayerNode, ClipPlayerNode.SimulationPorts.Rig, new Rig { Value = setup.SrcRig }); set.SendMessage(data.ClipPlayerNode, ClipPlayerNode.SimulationPorts.Clip, setup.SrcClip); //The Rig we want to remap to set.SendMessage(data.RemapperNode, RigRemapperNode.SimulationPorts.SourceRig, new Rig { Value = setup.SrcRig }); //The Rig that we are currently mapped to set.SendMessage(data.RemapperNode, RigRemapperNode.SimulationPorts.DestinationRig, rig); set.SendMessage(data.RemapperNode, RigRemapperNode.SimulationPorts.RemapTable, setup.RemapTable); ecb.AddComponent(e, data); }
void Update() { Texture2D texture = GetTexture2D(); if (texture == null) { return; } Mat imgmat = GetTextureMat(texture); JointPoint[] rigs = GetRigData(imgmat); UpdatePoseData(); Rig rig = new Rig(rigs, 30); Drawing(rig); UpdateUIInfo(rig); }
public void GenerateRig_CreatesEquipment_For_Every_EquipmentTemplate_In_RigTemplate() { RigTemplate rigTemplate = GetRigTemplate(); A.CallTo(() => m_rigTemplateRepo.GetRigTemplate("Jackup")).Returns(rigTemplate); Rig rig = new Rig() { Id = Guid.NewGuid().ToString() }; A.CallTo(() => m_rigRepo.Create("Jackup", string.Empty, string.Empty)).Returns(rig); m_testSubject.GenerateRig("Jackup", string.Empty, string.Empty); foreach (EquipmentTemplate equipmentTemplate in rigTemplate.EquipmentTemplates) { A.CallTo(() => m_equipmentRepo.Create(rig.Id, null, equipmentTemplate.Name, equipmentTemplate.Type, false)).MustHaveHappenedOnceExactly(); } }
// Update is called once per frame. void Update() { // If the rig, main camera, and character controller are valid. if (Rig != null && MainCamera != null && Character != null) { // Update the character controller's height. Character.height = MainCamera.transform.position.y - Rig.transform.position.y; // Update the character controller's center. Vector3 center = Character.center; center.y = -Character.height / 2.0f; Character.center = center; // Calculate the movement of the character controller based on the main camera (i.e., user's head). Vector3 movement = MainCamera.transform.position - Character.transform.position; if (movement.x != 0) { print(movement); } // Apply gravity if indicated. if (UseGravity) { movement.y = Physics.gravity.y * Time.deltaTime; } // Apply the movement. Character.Move(movement); // Begin locomotion. if (CanBeginLocomotion() && BeginLocomotion()) { // Determine the character controller's world location. Vector3 characterLocation = Character.transform.position; // Move the rig and camera to the character controller's world location. Rig.MoveCameraToWorldLocation(characterLocation); // End locomotion. EndLocomotion(); } } }
public void TestSetUp() { Logger.Debug($"Executing {TestContext.TestName}"); DevKit = new DevKit141Aspect(TestContext); DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value) .ToArray(); Well = new Well { Uid = DevKit.Uid(), Name = DevKit.Name("Well"), TimeZone = DevKit.TimeZone }; Wellbore = new Wellbore { Uid = DevKit.Uid(), Name = DevKit.Name("Wellbore"), UidWell = Well.Uid, NameWell = Well.Name, MD = new MeasuredDepthCoord(0, MeasuredDepthUom.ft) }; Rig = new Rig { Uid = DevKit.Uid(), Name = DevKit.Name("Rig"), UidWell = Well.Uid, NameWell = Well.Name, UidWellbore = Wellbore.Uid, NameWellbore = Wellbore.Name }; QueryEmptyList = DevKit.List(new Rig()); BeforeEachTest(); OnTestSetUp(); }
// Update is called once per frame. void Update() { // If the rig, main camera, and character controller are valid. if (Rig != null && MainCamera != null && Character != null) { // Update the character controller's height. Character.height = MainCamera.transform.position.y - Rig.transform.position.y + offset; // Update the character controller's center. Vector3 center = Character.center; center.y = -Character.height / 2.0f; Character.center = center; Vector3 newPos = MainCamera.transform.position; // Maintain Old RigidBody Y Position newPos.y = RigidBodyCharacter.position.y; RigidBodyCharacter.MovePosition(newPos); // Begin locomotion. if (CanBeginLocomotion() && BeginLocomotion()) { // Determine the character controller's world location. Vector3 characterLocation = Character.transform.position; characterLocation.y -= offset; if (!VirtualBodyScript.CollisionFlag) { characterLocation.x = MainCamera.transform.position.x; characterLocation.z = MainCamera.transform.position.z; } // Move the rig and camera to the character controller's world location. Rig.MoveCameraToWorldLocation(characterLocation); // End locomotion. EndLocomotion(); } } }
// Use this for initialization void Start() { currentMapController = FindObjectOfType <MapController>(); itemDatabase = FindObjectOfType <ItemDatabase>(); rigController = FindObjectOfType <RigController>(); miningController = FindObjectOfType <MiningController>(); mapDelegateHolder = FindObjectOfType <MapDelegateHolder>(); if (controllingRack) { // If this UI element controls a rack, then make the button call upgrade a rack function from the rig controller upgradeButton.onClick.AddListener(() => rigController.UpgradeARack(GetComponent <RackID>().myControlID)); myRackID = GetComponent <RackID>(); } else { upgradeButton.onClick.AddListener(() => rigController.UpgradeARig(GetComponent <RigID>().myControlID)); myRigID = GetComponent <RigID>(); myRig = FindObjectOfType <ItemDatabase>().rigTypes[0]; } // If the center activate button is ON then give it a function of buying a brand new rig if (activateButton && !controllingRack) { activateButton.onClick.AddListener(() => BuyARigFromScratch()); } else { activateButton.gameObject.SetActive(false); } if (!controllingRack) { mapDelegateHolder.upgradedRigActions += UpdateMyRigUI; } else { mapDelegateHolder.upgradedRackActions += UpdateMyRackUI; } InitizalizeTheUI(); }
public Rig Create(string rigType, string name, string description) { Rig createdRig = new Rig() { Id = Guid.NewGuid().ToString(), Name = name, Description = description, Type = rigType }; m_rigs.Add(createdRig); string rigData = m_serializer.SerializeObject(m_rigs); lock (m_rigStoreLock) { m_fileSystem.File.WriteAllText(m_rigStorePath, rigData); } return(createdRig); }
protected override ConfigurableClipData CreateGraph(Entity entity, ref Rig rig, ProcessDefaultAnimationGraph graphSystem, ref ConfigurableClipSetup setup) { var data = new ConfigurableClipData(); data.Graph = graphSystem.CreateGraph(); data.MotionID = setup.MotionID; data.UpdateConfiguration = true; data.ConfigurableClipNode = graphSystem.CreateNode <ConfigurableClipNode>(data.Graph); var entityNode = graphSystem.CreateNode(data.Graph, entity); var set = graphSystem.Set; set.Connect(data.ConfigurableClipNode, ConfigurableClipNode.KernelPorts.Output, entityNode); set.SendMessage(data.ConfigurableClipNode, ConfigurableClipNode.SimulationPorts.Rig, rig); set.SendMessage(data.ConfigurableClipNode, ConfigurableClipNode.SimulationPorts.Clip, setup.Clip); set.SetData(data.ConfigurableClipNode, ConfigurableClipNode.KernelPorts.Time, setup.ClipTime); return(data); }
public async Task Rig200_DeleteObject_Can_Delete_Rig() { AddParents(); await RequestSessionAndAssert(); var handler = _client.Handler <IStoreCustomer>(); var uri = Rig.GetUri(); var dataObject = CreateDataObject(uri, Rig); // Get Object var args = await GetAndAssert(handler, uri); // Check for message flag indicating No Data Assert.IsNotNull(args?.Header); Assert.AreEqual((int)MessageFlags.NoData, args.Header.MessageFlags); // Put Object await PutAndAssert(handler, dataObject); // Get Object args = await GetAndAssert(handler, uri); // Check Data Object XML Assert.IsNotNull(args?.Message.DataObject); var xml = args.Message.DataObject.GetString(); var result = Parse <Rig>(xml); Assert.IsNotNull(result); // Delete Object await DeleteAndAssert(handler, uri); // Get Object args = await GetAndAssert(handler, uri); // Check Data Object doesn't exist Assert.AreEqual(0, args?.Message?.DataObject?.Data?.Length ?? 0); }
private RotateCube_PlayStateRuntime CreateGraph(Entity entity, ref Rig rig, ref RotateCube_PlayClipRuntime animation) { //Retrieve node set from graph system. var set = _animationGraphSystem.Set; var data = new RotateCube_PlayStateRuntime { NodeHandle = set.Create <ClipPlayerNode>(), DeltaTimeNode = set.Create <ConvertDeltaTimeToFloatNode>(), EntityNode = set.CreateComponentNode(entity) }; //Connect kernel ports. //Connect the entityNode to the deltaNode and pass the DeltaTime Input (struct) to the deltaNode. set.Connect(data.EntityNode, data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Input); //Connect the deltaNode to the ClipPlayerNode and pass the DeltaTime output (float) to the ClipPlayerNode and assign it to the DeltaTime in the ClipPlayerNode. set.Connect(data.DeltaTimeNode, ConvertDeltaTimeToFloatNode.KernelPorts.Float, data.NodeHandle, ClipPlayerNode.KernelPorts.DeltaTime); //Connect the clipPlayer node to the EntityNode and passes the Output of the ClipPlayerNode //We must pass a enum under NodeSet API Connection type which allows feeding information back to an upstream node without forming a cycle set.Connect(data.NodeHandle, ClipPlayerNode.KernelPorts.Output, data.EntityNode, NodeSetAPI.ConnectionType.Feedback); //EntityNode -> ConvertDeltaTimeToFloatNode -> ClipPlayerNode -> Repeat. //Send message to set parameters on the CliPlayerNode //Set data for ClipPlayer Kernal Port set.SetData(data.NodeHandle, ClipPlayerNode.KernelPorts.Speed, 1.0f); //Send Message to ClipPlayer SimulationPort. set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Configuration, new ClipConfiguration { Mask = ClipConfigurationMask.LoopTime }); set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Rig, rig); set.SendMessage(data.NodeHandle, ClipPlayerNode.SimulationPorts.Clip, animation.clip); return(data); }
// finds the correct bones and maps them to the joints // returns true if register is succesful //(if not, check if your transforms have the correct names and are children of the riggedObject) public bool RegisterRig(GameObject riggedObject) { // initialize the new rig Rig rig = new Rig(); rig.riggedObject = riggedObject; // find all the body joint transforms rig.torsoCenter = riggedObject.transform.Find("Torso_Center"); rig.neck = riggedObject.transform.Find("Torso_Center/Neck"); rig.leftShoulder = riggedObject.transform.Find("Torso_Center/Left_Shoulder"); rig.leftElbow = riggedObject.transform.Find("Torso_Center/Left_Shoulder/Left_Elbow"); rig.rightShoulder = riggedObject.transform.Find("Torso_Center/Right_Shoulder"); rig.rightElbow = riggedObject.transform.Find("Torso_Center/Right_Shoulder/Right_Elbow"); rig.leftHip = riggedObject.transform.Find("Torso_Center/Left_Hip"); rig.leftKnee = riggedObject.transform.Find("Torso_Center/Left_Hip/Left_Knee"); rig.rightHip = riggedObject.transform.Find("Torso_Center/Right_Hip"); rig.rightKnee = riggedObject.transform.Find("Torso_Center/Right_Hip/Right_Knee"); // map the transforms to the Nite joints rig.jointMapping = new Dictionary<NiteWrapper.SkeletonJoint, Transform>(); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.NECK, rig.neck); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_SHOULDER, rig.leftShoulder); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_ELBOW, rig.leftElbow); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_SHOULDER, rig.rightShoulder); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_ELBOW, rig.rightElbow); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.TORSO_CENTER, rig.torsoCenter); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_HIP, rig.leftHip); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.LEFT_KNEE, rig.leftKnee); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_HIP, rig.rightHip); rig.jointMapping.Add(NiteWrapper.SkeletonJoint.RIGHT_KNEE, rig.rightKnee); // the orientation to take as origin for the joints rig.referenceOrientation = new Dictionary<NiteWrapper.SkeletonJoint, Quaternion>(); // check if all the transforms have been found and set their reference orientation bool succes = true; foreach (KeyValuePair<NiteWrapper.SkeletonJoint, Transform> pair in rig.jointMapping) { if (pair.Value == null) { succes = false; break; } else { rig.referenceOrientation.Add(pair.Key, pair.Value.rotation); } } if (succes) { registeredRigs.Add(rig); } return succes; }