private void ProcessHierarchy(AssetDocumentHierarchyElement owner, IHierarchyElement element, IGameObjectConsumer consumer, bool prefabImport, HashSet <ulong> visited) { if (element == null) { return; } if (visited.Contains(element.Location.LocalDocumentAnchor)) { return; } if (element is IGameObjectHierarchy gameObjectHierarchy) { ProcessGameObject(owner, gameObjectHierarchy, consumer, prefabImport, visited); } else if (element is IComponentHierarchy componentHierarchy) { var gameObjectReference = componentHierarchy.OwningGameObject; var gameObject = myAssetDocumentHierarchyElementContainer.GetHierarchyElement(gameObjectReference, prefabImport) as IGameObjectHierarchy; ProcessGameObject(owner, gameObject, consumer, prefabImport, visited); } else { Assertion.Fail($"Unsupported type: {element.GetType().Name}"); } }
public AssetDocumentHierarchyElement(IHierarchyElement hierarchyElements) { myLocalAnchorToHierarchyElement[hierarchyElements.Location.LocalDocumentAnchor] = hierarchyElements; if (hierarchyElements is ITransformHierarchy transformHierarchy) { myTransformHierarchies.Add(transformHierarchy); } if (hierarchyElements is IPrefabInstanceHierarchy prefabInstanceHierarchy) { myPrefabInstanceHierarchies.Add(prefabInstanceHierarchy); } }
public void ProcessSceneHierarchyFromComponentToRoot(IHierarchyElement hierarchyElement, IGameObjectConsumer consumer, bool forcePrefabImport) { myLocks.AssertReadAccessAllowed(); if (hierarchyElement == null) { return; } Assertion.Assert(!hierarchyElement.IsStripped, "!hierarchyElement.IsStripped"); // stripped elements should be never returned, Assertion.Assert(!(hierarchyElement is IPrefabInstanceHierarchy), "Process should not be started from prefab instance, use corresponding GO"); var owner = myAssetDocumentHierarchyElementContainer.GetAssetHierarchyFor(hierarchyElement.Location, out _); ProcessHierarchy(owner, hierarchyElement, consumer, forcePrefabImport, new HashSet <ulong>()); }
private static void WriteHierarchyElement(UnsafeWriter writer, IHierarchyElement hierarchyElement) { switch (hierarchyElement) { case GameObjectHierarchy gameObjectHierarchy: writer.Write(0); GameObjectHierarchy.Write(writer, gameObjectHierarchy); break; case ComponentHierarchy componentHierarchy: writer.Write(1); ComponentHierarchy.Write(writer, componentHierarchy); break; case PrefabInstanceHierarchy prefabInstanceHierarchy: writer.Write(2); PrefabInstanceHierarchy.Write(writer, prefabInstanceHierarchy); break; case ScriptComponentHierarchy scriptComponentHierarchy: writer.Write(3); ScriptComponentHierarchy.Write(writer, scriptComponentHierarchy); break; case StrippedHierarchyElement strippedHierarchyElement: writer.Write(4); StrippedHierarchyElement.Write(writer, strippedHierarchyElement); break; case TransformHierarchy transformHierarchy: writer.Write(5); TransformHierarchy.Write(writer, transformHierarchy); break; } }
public UnityInspectorFindResults(IPsiSourceFile sourceFile, IDeclaredElement declaredElement, InspectorVariableUsage inspectorVariableUsage, IHierarchyElement attachedElement) : base(sourceFile, declaredElement, attachedElement) { InspectorVariableUsage = inspectorVariableUsage; }
public UnityScriptsFindResults(IPsiSourceFile sourceFile, IDeclaredElement declaredElement, AssetUsage assetUsage, IHierarchyElement attachedElement) : base(sourceFile, declaredElement, attachedElement) { AssetUsage = assetUsage; }
public AssetDocument WithHiererchyElement(IHierarchyElement hierarchyElement) { return(new AssetDocument(StartOffset, Buffer, hierarchyElement)); }
public AssetDocument(int startOffset, IBuffer buffer, IHierarchyElement hierarchyElement) { StartOffset = startOffset; Buffer = buffer; HierarchyElement = hierarchyElement; }
public UnityMethodsFindResult(IPsiSourceFile sourceFile, IDeclaredElement declaredElement, AssetMethodData assetMethodData, IHierarchyElement attachedElement) : base(sourceFile, declaredElement, attachedElement) { AssetMethodData = assetMethodData; }
protected UnityAssetFindResult(IPsiSourceFile sourceFile, IDeclaredElement declaredElement, IHierarchyElement attachedElement) { SourceFile = sourceFile; AttachedElement = attachedElement; DeclaredElementPointer = new SourceElementPointer <IDeclaredElement>(declaredElement); }
public UnityScriptsOccurrence(IPsiSourceFile sourceFile, IDeclaredElementPointer <IDeclaredElement> declaredElement, IHierarchyElement attachedElement, string guid) : base(sourceFile, declaredElement, attachedElement) { myGuid = guid; }
protected UnityAssetOccurrence(IPsiSourceFile sourceFile, IDeclaredElementPointer <IDeclaredElement> declaredElement, IHierarchyElement attachedElement) { SourceFile = sourceFile; AttachedElementLocation = attachedElement.Location; PresentationOptions = OccurrencePresentationOptions.DefaultOptions; DeclaredElementPointer = declaredElement; }
public UnityMethodsOccurrence(IPsiSourceFile sourceFile, IDeclaredElementPointer <IDeclaredElement> declaredElement, IHierarchyElement attachedElement, AssetMethodData methodData) : base(sourceFile, declaredElement, attachedElement) { MethodData = methodData; }
public UnityInspectorValuesOccurrence(IPsiSourceFile sourceFile, InspectorVariableUsage inspectorVariableUsage, IDeclaredElementPointer <IDeclaredElement> declaredElement, IHierarchyElement attachedElement) : base(sourceFile, declaredElement, attachedElement) { InspectorVariableUsage = inspectorVariableUsage; }