public UnityUsagesFinderConsumer(AssetHierarchyProcessor assetHierarchyProcessor, [NotNull] AnimatorScriptUsagesElementContainer animatorContainer, IPersistentIndexManager persistentIndexManager, FileSystemPath solutionDirectoryPath, [NotNull] IDeclaredElement declaredElement) { myAssetHierarchyProcessor = assetHierarchyProcessor; myPersistentIndexManager = persistentIndexManager; mySolutionDirectoryPath = solutionDirectoryPath; myAnimatorContainer = animatorContainer; myDeclaredElement = declaredElement; }
public UnityEditorFindUsageResultCreator(Lifetime lifetime, ISolution solution, SearchDomainFactory searchDomainFactory, IShellLocks locks, AssetHierarchyProcessor assetHierarchyProcessor, BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost, UnityExternalFilesModuleFactory externalFilesModuleFactory, IPersistentIndexManager persistentIndexManager, [NotNull] AnimatorScriptUsagesElementContainer animatorContainer, [CanBeNull] RiderBackgroundTaskHost backgroundTaskHost = null) { myLifetime = lifetime; mySolution = solution; myLocks = locks; myAssetHierarchyProcessor = assetHierarchyProcessor; myBackendUnityHost = backendUnityHost; myBackgroundTaskHost = backgroundTaskHost; myYamlSearchDomain = searchDomainFactory.CreateSearchDomain(externalFilesModuleFactory.PsiModule); myFrontendBackendHost = frontendBackendHost; myAnimatorContainer = animatorContainer; myPersistentIndexManager = persistentIndexManager; mySolutionDirectoryPath = solution.SolutionDirectory; }
private static AssetFindUsagesResultBase CreateRequest(FileSystemPath solutionDirPath, AssetHierarchyProcessor assetDocumentHierarchy, [NotNull] AnimatorScriptUsagesElementContainer animatorContainer, LocalReference location, IPsiSourceFile sourceFile, [NotNull] IDeclaredElement declaredElement, bool needExpand = false) { if (!GetPathFromAssetFolder(solutionDirPath, sourceFile, out var pathFromAsset, out var fileName, out var extension)) { return(null); } var path = sourceFile.GetLocation(); if (path.IsControllerFile() && animatorContainer.GetElementsNames(location, declaredElement, out var names, out var isStateMachine) && names != null) { return(new AnimatorFindUsagesResult(names, isStateMachine ? AnimatorUsageType.StateMachine : AnimatorUsageType.State, needExpand, pathFromAsset, fileName, extension)); } if (path.ExtensionWithDot.EndsWith(UnityYamlFileExtensions.AssetFileExtensionWithDot)) { return(new AssetFindUsagesResult(needExpand, pathFromAsset, fileName, extension)); } if (path.IsAnimFile()) { return(new AnimationFindUsagesResult(needExpand, pathFromAsset, fileName, extension)); } var consumer = new UnityScenePathGameObjectConsumer(); assetDocumentHierarchy.ProcessSceneHierarchyFromComponentToRoot(location, consumer, true, true); return(new HierarchyFindUsagesResult(consumer.NameParts.ToArray(), consumer.RootIndexes.ToArray(), needExpand, pathFromAsset, fileName, extension)); }
public UnityAnimatorScriptOccurence([NotNull] IPsiSourceFile sourceFile, [NotNull] IDeclaredElementPointer <IDeclaredElement> declaredElement, [NotNull] IAnimatorScriptUsage usage) : base(sourceFile, declaredElement, usage.Location, false) { Usage = usage; var container = GetSolution() .NotNull("occurrence.GetSolution() != null") .GetComponent <AnimatorScriptUsagesElementContainer>(); Container = container; var element = declaredElement.FindDeclaredElement(); if (element is null) { return; } var location = Usage.Location; container.GetElementsNames(location, element, out _, out var isStateMachine); IconId = isStateMachine ? UnityObjectTypeThemedIcons.UsageAnimatorStateMachine.Id : UnityObjectTypeThemedIcons.UsageAnimatorState.Id; }