Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Project Window Interface Fixes #911

Merged
merged 7 commits into from
Oct 3, 2018

Conversation

StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Sep 17, 2018

How did this ever work?

Correcting statement to check status of initialization

private static bool IsInitialized { get { return Repository != null && Repository.CurrentRemote.HasValue; } }

if (IsInitialized)
{
Repository.StatusEntriesChanged += RepositoryOnStatusEntriesChanged;
Repository.LocksChanged += RepositoryOnLocksChanged;
ValidateCachedData();
}

private static bool ContextMenu_CanLock()
{
if (!EnsureInitialized())
return false;

This issue occurs because IsInitialized is being used to hook up events and control data validation.
And is also being used to control the display of LFS menu items. So this logic needed to be separated out.

Fixes #910

Refreshing Asset database on Repository.StatusEntriesChanged

private static void RepositoryOnStatusEntriesChanged(CacheUpdateEvent cacheUpdateEvent)
{
if (!lastRepositoryStatusChangedEvent.Equals(cacheUpdateEvent))
{
lastRepositoryStatusChangedEvent = cacheUpdateEvent;
AssetDatabase.Refresh();

Calling refresh here is needed to refresh the asset explorer window. Thanks to a hint from @oboka in #907.

Fixes #900
Fixes #882
Fixes #907

@StanleyGoldman StanleyGoldman changed the title Correcting statement to check status of initialization Project Window Interface Fixes Sep 17, 2018
shana
shana previously requested changes Sep 19, 2018
@@ -26,7 +26,7 @@ class ProjectWindowInterface : AssetPostprocessor
private static CacheUpdateEvent lastRepositoryStatusChangedEvent;
private static CacheUpdateEvent lastLocksChangedEvent;
private static IRepository Repository { get { return manager != null ? manager.Environment.Repository : null; } }
private static bool IsInitialized { get { return Repository != null && Repository.CurrentRemote.HasValue; } }
private static bool IsInitialized { get { return Repository != null; } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is used to determine whether to show lock/unlock menus. If you're going to change this logic, you need to also fix how we enable those menus, because we can't lock/unlock if there's no remote.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@StanleyGoldman StanleyGoldman force-pushed the fixes/project-window-interface-initialized branch from 94824b1 to 7b7c5e5 Compare October 3, 2018 14:05
Copy link

@daviwil daviwil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this should fix the comment @shana had! 👍 :shipit:

@StanleyGoldman StanleyGoldman merged commit d6fcd33 into master Oct 3, 2018
@StanleyGoldman StanleyGoldman deleted the fixes/project-window-interface-initialized branch October 3, 2018 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants