// when current event is mouse click, this function pings the object, or
// if shift/control is pressed and object is a texture, pops up a large texture
// preview window
internal static void PingObjectOrShowPreviewOnClick(Object targetObject, Rect position)
{
if (targetObject == null)
{
return;
}
Event evt = Event.current;
// ping object
bool anyModifiersPressed = evt.shift || evt.control;
if (!anyModifiersPressed)
{
EditorGUIUtility.PingObject(targetObject);
return;
}
// show large object preview popup; right now only for textures
if (targetObject is Texture)
{
PopupWindowWithoutFocus.Show(
new RectOffset(6, 3, 0, 3).Add(position),
new ObjectPreviewPopup(targetObject),
new[] { PopupLocation.Left, PopupLocation.Below, PopupLocation.Right });
}
}