editorscript project view selection

Hi!
Trying my hand at some basic editor scripting.

you can assign a keyboard shortcut to your functions, like
[MenuItem(“Edit/Dosomething %j”)], BUT in the case of there already being a keyboard shortcut defined in the Unity Engines own bowels, I am out of luck. Thru trial and error I have found some available shortcuts, but does anyone know if it is possible to override the generic unity keyboard shortcuts? If not, does anyone have a handly list of available keyboard shortcuts not claimed by Unity already?

There are all kinds of nifty filters and whatnot to get at the current selection in the sceneview. How would I go about figuring out what is actually selected in the project view? Assetdatabase is obviously at the core of this, but I can´t figure out a way to find what is actually selected in there.

Thanks

After having spent some more time with this, I can conclude that it is indeed possible to get the selection in the project view. Somehow the docs led me to believe this wouldn´t be possible. But it seems you can not have something selected in the scene view and something else selected in the project view.

This leads to a new problem, and I guess I´ll have to explain more in detail what I want to do.
I have a bunch of prefabs with similar properties. I want to, in the editor, be able to replace one prefab in the scene with another one from the project. Ideally I would like to just select the prefab in the scene, select another prefab in the project view and hit “replace”.

Any ideas how this could be implemented?

Thanks

OK
So I think I have nailed it now.
Key is to cmd-click, this way you can have stuff both in scene view and the project view selected at the same time. The way to figure out which prefab/transform is in the scene view and which one is in project view is kind of a hack. I just use t.renderer.isVisible on the transforms. If anyone has a cleaner way of doing this I would be happy to use it.

Well, this is coming a little late, but it seems like if you check gameObject.active, it’ll be true for objects in the scene, and false for objects in the project view. I’m guessing it may not always be true for objects in the scene though, but I’m not that familiar with it.

*Edit - Think I found a better one. AssetDatabase.IsMainAsset(Object object) returns true for base gameobjects in the project view, false for non-base gameobject there, or objects in the scene.