AssetList AssetOperations.IAssetSelection.GetSelectedAssets()
        {
            AssetList result = new AssetList();

            // We filter for assets because it is possible for user
            // to select things in both project and scene views at the same time
            UnityEngine.Object[] selectedObjects =
                Selection.GetFiltered <UnityEngine.Object>(SelectionMode.Assets);

            foreach (UnityEngine.Object obj in selectedObjects)
            {
                result.Add(new Asset(AssetsPath.GetFullPath(obj)));
            }

            return(result);
        }
Exemple #2
0
        void OnEnable()
        {
            processor.AssetModificationProcessor.ForceCheckout = EditorPrefs.GetBool("forceCheckoutPlasticSCM");
            wantsMouseMove = true;

            if (mException != null)
            {
                return;
            }

            minSize = new Vector2(
                UnityConstants.PLASTIC_WINDOW_MIN_SIZE_WIDTH,
                UnityConstants.PLASTIC_WINDOW_MIN_SIZE_HEIGHT);

            SetupWindowTitle();

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            PlasticApp.InitializeIfNeeded();

            RegisterApplicationFocusHandlers(this);

            PlasticMethodExceptionHandling.InitializeAskCredentialsUi(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));

            mPlasticAPI        = new PlasticAPI();
            mPlasticWebRestApi = new PlasticWebRestApi();

            mEventSenderScheduler = EventTracking.Configure(
                mPlasticWebRestApi,
                AssetsPath.IsRunningAsUPMPackage() ?
                ApplicationIdentifier.UnityPackage : ApplicationIdentifier.UnityAssetStorePlugin,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop = new PingEventLoop();
                mPingEventLoop.Start();
                mPingEventLoop.SetUnityVersion(Application.unityVersion);

                CollabPlugin.GetVersion(pluginVersion => mPingEventLoop.SetPluginVersion(pluginVersion));
            }

            InitializePlastic();
        }
    public Entry_Components AddObserver()
    {
        Entry_Components componentEntry = ScriptableObject.CreateInstance <Entry_Components>();

        AssetsPath.CreateAsset(componentEntry, AssetsPath.AssetName_TemplateEntryObserver);

        //add observer components
        ComponentTemplatesList.ForEach(x => componentEntry.Componets.Add(x.AddObserver()));

        //set observer settings
        componentEntry.ShowAddButton             = componentEntry.ShowRemoveButton
                                                 = componentEntry.ShowDraggableButton = componentEntry.ShowEditModeOption = false;

        //add observer to list
        ObserversList.Add(componentEntry);


        return(componentEntry);
    }
        internal static void LoadLayout(
            this VisualElement element,
            string className)
        {
            string uxmlRelativePath = Path.Combine(
                AssetsPath.GetLayoutsFolderRelativePath(),
                string.Format("{0}.uxml", className));

            VisualTreeAsset visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(
                uxmlRelativePath);

            if (visualTree == null)
            {
                UnityEngine.Debug.LogErrorFormat(
                    "Layout {0} not found at path {1}",
                    className,
                    uxmlRelativePath);
                return;
            }

            visualTree.CloneTree(element);
        }
Exemple #5
0
        static AssetList GetInspectorAssets(UnityEditor.Editor inspector)
        {
            AssetList result = new AssetList();

            if (inspector == null)
            {
                return(result);
            }

            foreach (UnityEngine.Object obj in inspector.targets)
            {
                string assetPath = AssetsPath.GetFullPath(obj);

                if (string.IsNullOrEmpty(assetPath))
                {
                    continue;
                }

                result.Add(new Asset(assetPath));
            }

            return(result);
        }
Exemple #6
0
 static string GetImageFileRelativePath(string imageFileName)
 {
     return(Path.Combine(
                AssetsPath.GetImagesFolderRelativePath(),
                imageFileName));
 }
Exemple #7
0
 internal virtual void OnRemove(IList <EntryComponent> entryComponents, int i)
 {
     AssetsPath.DestroyAsset(entryComponents[i]);
     entryComponents.RemoveAt(i);
     EntryData.OnComponentChanged(ListChangeType.Remove, i, -1);
 }
Exemple #8
0
 protected override void OnCreateInstance()
 {
     AssetsPath.CreateAsset(this, AssetsPath.AssetName_Entries);
 }
Exemple #9
0
 public void RemoveObserver(EntryComponent other)
 {
     AssetsPath.DestroyAsset(other);
     ObserversList.Remove(other);
 }
Exemple #10
0
 public void RemoveObserver(int index)
 {
     AssetsPath.DestroyAsset(ObserversList[index]);
     ObserversList.RemoveAt(index);
 }