Exemple #1
0
        void TryDrawObjectButton(PropertyGridItem itm, ref Rect rect)
        {
            // We do not test against address==0 here, because if it is a static field its address might be 0
            if (itm.type.managedTypesArrayIndex < 0 || (itm is BaseClassPropertyGridItem))
            {
                return;
            }

            // If it is not a pointer, it does not point to another object
            //var type = m_snapshot.managedTypes[itm.typeIndex];
            if (!itm.type.isPointer)
            {
                return;
            }

            // If it points to null, it has no object
            var pointer = itm.myMemoryReader.ReadPointer(itm.address);

            if (pointer == 0)
            {
                return;
            }

            // Check if it is a managed object
            var managedObjIndex = m_Snapshot.FindManagedObjectOfAddress(itm.type.isArray ? itm.address : pointer);

            if (managedObjIndex != -1)
            {
                if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichManagedObject(m_Snapshot, managedObjIndex)));
                }
            }

            // Check if it is a native object
            var nativeObjIndex = m_Snapshot.FindNativeObjectOfAddress(pointer);

            if (nativeObjIndex != -1)
            {
                if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichNativeObject(m_Snapshot, nativeObjIndex)));
                }
            }
        }