void ShowOrHideAssetDirtyWarning(bool inOrEnteringPlayMode) { if (inOrEnteringPlayMode) { var binary = target as Kinematica; if (binary != null) { SerializableGuid guid = binary.resource.assetGuid; // TODO - 2020.1 supports faster search pattern // var assetGuids = AssetDatabase.FindAssets("glob:Assets/**/*.{asset|Asset}"); var assetGuids = AssetDatabase.FindAssets("t:Asset"); foreach (string assetGuid in assetGuids) { Asset asset = AssetDatabase.LoadAssetAtPath <Asset>(AssetDatabase.GUIDToAssetPath(assetGuid)); if (asset == null) { continue; } SerializableGuid binaryGuid = asset.GetBinaryReference().assetGuid; if (binaryGuid == guid) { m_Warning.style.display = asset.BinaryUpToDate ? DisplayStyle.None : DisplayStyle.Flex; return; } } } } m_Warning.style.display = DisplayStyle.None; }
public CopyPasteGraph(Guid sourceGraphGuid, IEnumerable <GroupData> groups, IEnumerable <INode> nodes, IEnumerable <IEdge> edges, IEnumerable <IShaderProperty> properties, IEnumerable <IShaderProperty> metaProperties) { m_SourceGraphGuid = new SerializableGuid(sourceGraphGuid); foreach (var groupData in groups) { AddGroup(groupData); } foreach (var node in nodes) { AddNode(node); foreach (var edge in NodeUtils.GetAllEdges(node)) { AddEdge(edge); } } foreach (var edge in edges) { AddEdge(edge); } foreach (var property in properties) { AddProperty(property); } foreach (var metaProperty in metaProperties) { AddMetaProperty(metaProperty); } }
public void ObjectBind(int layer) { if (ObjectManager.instance.currentObjectModel == null) { return; } if (_awaitConfirmOnLayer != layer) { if (_awaitConfirmOnLayer != -1) { onFinishAwaitConfirm.Invoke(_awaitConfirmOnLayer); } _awaitConfirmOnLayer = layer; onStartAwaitConfirm.Invoke(layer); return; } ; if (!_bind.ContainsKey(layer)) { StartListening(layer); } var newBeatObject = new BeatObjectData(ObjectManager.instance.currentObjectModel.objectTag, SerializableGuid.NewGuid(), _awaitConfirmOnLayer, ModelInput.CloneInputs(ObjectManager.instance.currentObjectModel.modelInput)); ObjectBind(layer, newBeatObject); _awaitConfirmOnLayer = -1; onFinishAwaitConfirm.Invoke(layer); }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { s_GlobalCallbackSet.OnImport(); s_GlobalCallbackSet.OnDelete(); foreach (string path in importedAssets) { SerializableGuid guid = SerializableGuidUtility.GetSerializableGuidFromAssetPath(path); CallbackSet callbacks; if (s_CallbackSetsPerClip.TryGetValue(guid, out callbacks)) { callbacks.OnImport(); } } foreach (string path in deletedAssets) { SerializableGuid guid = SerializableGuidUtility.GetSerializableGuidFromAssetPath(path); CallbackSet callbacks; if (s_CallbackSetsPerClip.TryGetValue(guid, out callbacks)) { callbacks.OnDelete(); } } }
public Item(int id, string itemName, int maxStack, string description) { _guid = System.Guid.NewGuid(); _id = id; _itemName = itemName; _maxStack = maxStack; _description = description; }
public static SerializableGuid GetSerializableGuidFromAssetPath(string assetPath) { string assetGuidStr = AssetDatabase.AssetPathToGUID(assetPath); SerializableGuid assetGuid = new SerializableGuid(); assetGuid.SetGuidStr(assetGuidStr); return(assetGuid); }
public void Select(SerializableGuid selection) { TaggedAnimationClip found = m_Clips.FirstOrDefault(tc => tc.AnimationClipGuid == selection); if (m_Selection != found) { m_Selection = found; UpdateLabel(); } }
private IEnumerator AddImageJob() { yield return(null); Logger.Log("Adding image\n"); Logger.Log("Job Starting..."); var firstGuid = new SerializableGuid(0, 0); var secondGuid = new SerializableGuid(0, 0); // XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), Guid.NewGuid().ToString(), texture2D); addedImageCount++; XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), addedImageCount.ToString(), currentTexture); try { // loadingGameObj.SetActive(true); // Debug.Log("new image naame"+newImage.ToString()) ; MutableRuntimeReferenceImageLibrary mutableRuntimeReferenceImageLibrary = trackedImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary; var jobHandle = mutableRuntimeReferenceImageLibrary.ScheduleAddImageJob(currentTexture, addedImageCount.ToString(), 0.1f); while (!jobHandle.IsCompleted) { Logger.Log("Job Running..."); } Logger.Log("job finsihed added to dictionary"); //remove things from memory currentTexture = null; Resources.UnloadUnusedAssets(); GC.Collect(); //logging Logger.Log("image downloaded and added to library"); Logger.Log("image count" + mutableRuntimeReferenceImageLibrary.count); //trigger event to convey success message Eventbus.Instance.TriggerEvent(SystemStatus.ImageAddedToLibrary); //tell the controller that you had added image to library and send this id to controller imageTargetController.OnImageAddedToLibrary(newImage.name); } catch (Exception e) { Eventbus.Instance.TriggerEvent(SystemStatus.FailedToAddToLibrary); Logger.Log(e.ToString()); } }
public static SerializableGuid GetSerializableGuidFromAsset(Object asset) { string assetPath = AssetDatabase.GetAssetPath(asset); if (string.IsNullOrEmpty(assetPath)) { return(SerializableGuid.CreateInvalid()); } return(GetSerializableGuidFromAssetPath(assetPath)); }
void Awake() { Debug.Log("DialogDefinition Awake"); if (rootNodeId.IsNullOrEmpty()) { DialogNode rootNode = new DialogNode(this, "DialogRoot", "Default Text", DIALOGNODETYPE.STATEMENT, 110, 110); rootNodeId = rootNode.id; nodes[rootNode.id] = rootNode; } }
/// <summary> /// this addes images target runtime to the xrreference library through unity job system /// </summary> /// <param name="texture2D"></param> /// <returns></returns> public IEnumerator AddImageJob(ImageTargetVideoUrlTemplate t) { yield return(null); print("Adding image\n"); print("Job Starting..."); var firstGuid = new SerializableGuid(0, 0); var secondGuid = new SerializableGuid(0, 0); // XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), Guid.NewGuid().ToString(), texture2D); addedImageCount++; XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), addedImageCount.ToString(), currentDownloadedTexture); try { loadingGameObj.SetActive(true); Debug.Log("new image naame" + newImage.ToString()); MutableRuntimeReferenceImageLibrary mutableRuntimeReferenceImageLibrary = trackImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary; var jobHandle = mutableRuntimeReferenceImageLibrary.ScheduleAddImageJob(currentDownloadedTexture, addedImageCount.ToString(), 0.1f); while (!jobHandle.IsCompleted) { print("Job Running..."); } loadingGameObj.SetActive(false); Debug.Log("job finsihed added to dictionary"); // referenceImageAddedEvent?.Invoke(newImage,t); GetComponent <DynamicImgVideoSpawner>().OnReferenceImageAdded(newImage, t); currentDownloadedTexture = null; Resources.UnloadUnusedAssets(); GC.Collect(); //image downloaded and added to library // imageTargetUrlGetter.OnUnityEntered(); print("image downloaded and added to library"); print("image count" + mutableRuntimeReferenceImageLibrary.count); //print("name da mame " + newImage.name); } catch (Exception e) { print(e.ToString()); } }
public BeatObjectData(PropertyName objectTag, SerializableGuid id, int editorLayer, ModelInput[] modelInputsData) { this.objectTag = objectTag; this.id = id; this.editorLayer = editorLayer; this.modelInputsData = modelInputsData; modelInputs = new Dictionary <Type, ModelInput>(); foreach (var m in modelInputsData) { modelInputs.Add(m.GetType(), m); } }
static AnimationClip LoadAnimationClipFromGuid(SerializableGuid guid) { if (guid.IsSet()) { string path = AssetDatabase.GUIDToAssetPath(guid.GetGuidStr()); if (!string.IsNullOrEmpty(path)) { return(AssetDatabase.LoadAssetAtPath <AnimationClip>(path)); } } return(null); }
public IEnumerator AddImageJob(Texture2D texture2D) { yield return(null); debugLog.text = string.Empty; debugLog.text += "Adding image\n"; jobLog.text = "Job Starting..."; var firstGuid = new SerializableGuid(0, 0); var secondGuid = new SerializableGuid(0, 0); XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), Guid.NewGuid().ToString(), texture2D); try { MutableRuntimeReferenceImageLibrary mutableRuntimeReferenceImageLibrary = trackImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary; debugLog.text += $"TextureFormat.RGBA32 supported: {mutableRuntimeReferenceImageLibrary.IsTextureFormatSupported(TextureFormat.RGBA32)}\n"; debugLog.text += $"TextureFormat size: {texture2D.width}px width {texture2D.height}px height\n"; var jobHandle = mutableRuntimeReferenceImageLibrary.ScheduleAddImageJob(texture2D, Guid.NewGuid().ToString(), 0.1f); while (!jobHandle.IsCompleted) { jobLog.text = "Job Running..."; } jobLog.text = "Job Completed..."; debugLog.text += $"Job Completed ({mutableRuntimeReferenceImageLibrary.count})\n"; debugLog.text += $"Supported Texture Count ({mutableRuntimeReferenceImageLibrary.supportedTextureFormatCount})\n"; debugLog.text += $"trackImageManager.trackables.count ({trackImageManager.trackables.count})\n"; debugLog.text += $"trackImageManager.trackedImagePrefab.name ({trackImageManager.trackedImagePrefab.name})\n"; debugLog.text += $"trackImageManager.maxNumberOfMovingImages ({trackImageManager.maxNumberOfMovingImages})\n"; debugLog.text += $"trackImageManager.supportsMutableLibrary ({trackImageManager.subsystem.SubsystemDescriptor.supportsMutableLibrary})\n"; debugLog.text += $"trackImageManager.requiresPhysicalImageDimensions ({trackImageManager.subsystem.SubsystemDescriptor.requiresPhysicalImageDimensions})\n"; } catch (Exception e) { if (texture2D == null) { debugLog.text += "texture2D is null"; } debugLog.text += $"Error: {e.ToString()}"; } }
public override bool Equals(object obj) { if (!(obj is SerializableGuid)) { return(false); } SerializableGuid otherGuid = obj as SerializableGuid; for (int i = 0; i < m_GuidBytes.Length; ++i) { if (m_GuidBytes[i] != otherGuid.m_GuidBytes[i]) { return(false); } } return(true); }
static void ChangeCallbackSet(SerializableGuid clipGuid, Action <CallbackSet> modification) { if (!clipGuid.IsSet()) { return; } CallbackSet callbackSet; if (!s_CallbackSetsPerClip.TryGetValue(clipGuid, out callbackSet)) { callbackSet = new CallbackSet(); s_CallbackSetsPerClip.Add(clipGuid, callbackSet); } modification?.Invoke(callbackSet); }
public BeatObjectData Clone() { BeatObjectData other = new BeatObjectData { objectTag = objectTag, id = SerializableGuid.NewGuid(), modelInputsData = ModelInput.CloneInputs(modelInputsData) }; other.modelInputs = new Dictionary <Type, ModelInput>(); for (int i = 0; i < other.modelInputsData.Length; i++) { ModelInput m = other.modelInputsData[i]; other.modelInputs.Add(m.GetType(), m); } return(other); }
public IEnumerator AddImageJob(Texture2D texture2D) { yield return(null); Debug.Log("tex name " + texture2D.name); var firstGuid = new SerializableGuid(0, 0); var secondGuid = new SerializableGuid(0, 0); // XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), Guid.NewGuid().ToString(), texture2D); addedImageCount++; XRReferenceImage newImage = new XRReferenceImage(firstGuid, secondGuid, new Vector2(0.1f, 0.1f), addedImageCount.ToString(), texture2D); // loadingCanvas.SetActive(true); try { Debug.Log(newImage.ToString()); MutableRuntimeReferenceImageLibrary mutableRuntimeReferenceImageLibrary = trackImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary; var jobHandle = mutableRuntimeReferenceImageLibrary.ScheduleAddImageJob(texture2D, addedImageCount.ToString(), 0.1f); while (!jobHandle.IsCompleted) { print("Job Running..."); } //loadingCanvas.SetActive(false); Debug.Log("job finsihed added to dictionary"); // referenceImageAddedEvent?.Invoke(newImage, t); //image downloaded and added to library // imageTargetUrlGetter.OnUnityEntered(); print("image downloaded and added to library"); //print("name da mame " + newImage.name); Destroy(texture2D); GC.Collect(); } catch (Exception e) { print(e.ToString()); } }
public DialogNode(DialogDefinition definition, string p_title, string p_text, DIALOGNODETYPE p_type, float p_x, float p_y) { isCollapsed = false; title = p_title; speakerName = ""; question = ""; action = ""; isDialogAction = false; friendState = ""; id = Guid.NewGuid(); text = p_text; isThought = false; animTrigger = ""; type = p_type; responses = new List <DialogResponse>(); x = p_x; y = p_y; window = new Rect(x, y, defaultWindowWidth, 0); }
/// <summary> /// Removes the TaggedAnimationClip that corresponds to the supplied AnimationClip from the asset /// </summary> /// <param name=clip>AnimationClip to use</param> /// <returns>true if the clip was found and removed, false otherwise</returns> public bool RemoveAnimationClip(AnimationClip clip) { if (clip == null) { throw new ArgumentNullException("clip"); } SerializableGuid clipGuid = SerializableGuidUtility.GetSerializableGuidFromAsset(clip); Undo.RecordObject(this, string.Format("Remove Animation Clip {0}", clip.name)); int removed = AnimationLibrary.RemoveAll((TaggedAnimationClip tagged) => { return(tagged.AnimationClipGuid == clipGuid); }); if (removed > 0) { MarkDirty(); } return(removed > 0); }
void SerializeGuidStr(AnimationClip clip, ref SerializableGuid guid) { if (clip == null) { guid = new SerializableGuid(); return; } string guidStr = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(clip)); if (string.IsNullOrEmpty(guidStr)) { throw new InvalidOperationException(); } if (!guidStr.Equals(guid.ToString())) { guid.SetGuidStr(guidStr); Asset.MarkDirty(); } }
public void OnAfterDeserialize() { m_SourceGraphGuid = SerializationHelper.Deserialize <SerializableGuid>(m_SerializeableSourceGraphGuid, GraphUtil.GetLegacyTypeRemapping()); var nodes = SerializationHelper.Deserialize <INode>(m_SerializableNodes, GraphUtil.GetLegacyTypeRemapping()); m_Nodes.Clear(); foreach (var node in nodes) { m_Nodes.Add(node); } m_SerializableNodes = null; var edges = SerializationHelper.Deserialize <IEdge>(m_SerializableEdges, GraphUtil.GetLegacyTypeRemapping()); m_Edges.Clear(); foreach (var edge in edges) { m_Edges.Add(edge); } m_SerializableEdges = null; var properties = SerializationHelper.Deserialize <IShaderProperty>(m_SerilaizeableProperties, GraphUtil.GetLegacyTypeRemapping()); m_Properties.Clear(); foreach (var property in properties) { m_Properties.Add(property); } m_SerilaizeableProperties = null; var metaProperties = SerializationHelper.Deserialize <IShaderProperty>(m_SerializableMetaProperties, GraphUtil.GetLegacyTypeRemapping()); m_MetaProperties.Clear(); foreach (var metaProperty in metaProperties) { m_MetaProperties.Add(metaProperty); } m_SerializableMetaProperties = null; }
/* * Object controll */ public BeatObjectData NewBeatObject(ObjectModel objectModel, float time = 0.0f, int layer = 0, bool history = true) { BeatObjectData data = new BeatObjectData { objectTag = objectModel.objectTag, id = SerializableGuid.NewGuid(), time = time, editorLayer = layer, modelInputsData = ModelInput.CloneInputs(objectModel.modelInput), }; if (history) { BackupInfo(); } levelInfo.beatObjectDatas.Add(data); onNewObject.Invoke(data); SortBeatObjects(); return(data); }
void SetClip(AnimationClip clip) { if (clip == null) { m_Clip = null; return; } AnimationClipPostprocessor.RemoveOnImport(m_AnimationClipGuid, ReloadClipAndMarkDirty); AnimationClipPostprocessor.RemoveOnDelete(m_AnimationClipGuid, OnDeleteClip); m_AnimationClipGuid = SerializableGuidUtility.GetSerializableGuidFromAsset(clip); AnimationClipPostprocessor.AddOnImport(m_AnimationClipGuid, ReloadClipAndMarkDirty); AnimationClipPostprocessor.AddOnDelete(m_AnimationClipGuid, OnDeleteClip); m_Clip = clip; m_CachedClipVersion = AnimationClipPostprocessor.GetClipVersion(clip); m_CachedClipName = clip.name; m_CachedClipDuration = Utility.ComputeAccurateClipDuration(clip); m_CachedSampleRate = clip.frameRate; }
/// <summary> /// Creates and adds a new TaggedAnimationClip in the asset from an AnimationClip /// </summary> /// <completionlist cref=""/> /// <param name=clip>AnimationClip to use. Must be an asset on disk</param> /// <exception cref="System.ArgumentNullException">Thrown if argument clip is null</exception> /// <exception cref="System.ArgumentException">Thrown if argument clip no an asset on disk</exception> /// <returns>Returns the TaggedAnimationClip created from the supplied AnimationClip</returns> internal TaggedAnimationClip AddAnimationClip(AnimationClip clip) { if (clip == null) { throw new ArgumentNullException("clip"); } TaggedAnimationClip taggedAnimationClip = null; SerializableGuid clipGuid = SerializableGuidUtility.GetSerializableGuidFromAsset(clip); if (!clipGuid.IsSet()) { throw new ArgumentException("argument \"clip\" must be an asset on the disk"); } //Don't add existing AnimationClip to library if (AnimationLibrary.Any((TaggedAnimationClip taggedClip) => { return(taggedClip.AnimationClipGuid == clipGuid); })) { return(null); } try { taggedAnimationClip = TaggedAnimationClip.BuildFromClip(clip, this, ETagImportOption.Import); } catch (InvalidOperationException) { throw new ArgumentException("argument \"clip\" must be an asset on disk"); } Undo.RecordObject(this, string.Format("Add Animation Clip {0}", clip.name)); AnimationLibrary.Add(taggedAnimationClip); taggedAnimationClip.DataChanged += MarkDirty; MarkDirty(); return(taggedAnimationClip); }
public void ReturnFromChoice(SerializableGuid link) { Debug.Log("Return From Choice activated"); currentlySpeakingIcon.SlideBack(); canContinueDialog = true; CamManager.Instance.mainCamPostProcessor.profile = dialogBlur; textBox.SetActive(true); dialogOptions.transform.localPosition = new Vector2(-22f, -204f); //reset choice position so it slides on screen next time. dialogOptions.SetActive(false); currentNode = myDialogDefiniton.nodes[link]; if (currentlySpeakingIcon.GetType() == typeof(MultipleDialogIconsManager) && characterName.text != currentNode.speakerName && currentNode.speakerName.Length > 1)//>2 check os for if the field is blank, which it is if the speaker is the same as previous { Debug.Log("NAMES DONT MATCHx-x-x-x--x-x-x-x-x-x-"); ((MultipleDialogIconsManager)currentlySpeakingIcon).ChangeSpeaker(currentNode.speakerName); characterName.text = currentNode.speakerName; } StartDisplay(); }
/// <summary> /// Converts the <see cref="Guid"/> to its JSON string representation. /// </summary> /// <param name="value">The value to convert.</param> /// <returns>A JSON string representation of the <see cref="Guid"/>.</returns> public static string ToString(SerializableGuid value) { return('"' + value.GetString() + '"'); }
/// <summary> /// Finds the TaggedAnimationClip that corresponds to the supplied AnimationClip /// </summary> /// <param name=clip>AnimationClip to use</param> /// <returns>Returns the TaggedAnimationClip associated with the supplied AnimationClip</returns> internal TaggedAnimationClip FindTaggedAnimationClip(AnimationClip clip) { SerializableGuid clipGuid = SerializableGuidUtility.GetSerializableGuidFromAsset(clip); return(AnimationLibrary.FirstOrDefault((TaggedAnimationClip taggedClip) => { return taggedClip.AnimationClipGuid == clipGuid; })); }
/// <summary> /// Writes a <see cref="Guid"/> value. /// </summary> /// <param name="value">The <see cref="Guid"/> value to write.</param> public override void WriteValue(SerializableGuid value) { base.WriteValue(value); AddToken(new BsonString(value.ToString(), true)); }
public static SerializableGuid NewGuid() { SerializableGuid guid = new SerializableGuid(Guid.NewGuid()); return guid; }
/// <summary> /// Writes a <see cref="Guid"/> value. /// </summary> /// <param name="value">The <see cref="Guid"/> value to write.</param> public override void WriteValue(SerializableGuid value) { base.WriteValue(value); WriteValueInternal(JsonConvert.ToString(value), JsonToken.String); }
public static void RemoveOnDelete(SerializableGuid clipGuid, Action onDelete) { ChangeCallbackSet(clipGuid, set => set.RemoveOnDelete(onDelete)); }
public static void RemoveOnImport(SerializableGuid clipGuid, Action onImport) { ChangeCallbackSet(clipGuid, set => set.RemoveOnImport(onImport)); }
/// <summary> /// Writes a <see cref="SerializableGuid"/> value. /// </summary> /// <param name="value">The <see cref="SerializableGuid"/> value to write.</param> public override void WriteValue(SerializableGuid value) { base.WriteValue(value); AddValue(value, JsonToken.String); }
/// <summary> /// Writes a <see cref="SerializableGuid"/> value. /// </summary> /// <param name="value">The <see cref="Guid"/> value to write.</param> public virtual void WriteValue(SerializableGuid value) { AutoComplete(JsonToken.String); }