Exemple #1
0
        static Rect GetRectOfFieldInInspector(string fieldPathInClass, Type targetType, out bool found)
        {
            string viewName = nameof(InspectorWindow);
            var    allViews = new List <GUIView>();

            GUIViewDebuggerHelper.GetViews(allViews);

            var propertyInstructions = new List <IMGUIPropertyInstruction>(32);

            foreach (var view in allViews)
            {
                if (view.GetViewName() != viewName)
                {
                    continue;
                }                                                 //todo: we should have a way to reference the window without using its name

                GUIViewDebuggerHelper.DebugWindow(view);
                view.RepaintImmediately();
                GUIViewDebuggerHelper.GetPropertyInstructions(propertyInstructions);
                var targetTypeName = targetType.AssemblyQualifiedName;

                foreach (var instruction in propertyInstructions) //todo: we should have a way to reference hierarchy objects without using their names
                {
                    if (instruction.targetTypeName == targetTypeName &&
                        instruction.path == fieldPathInClass)
                    {
                        found = true;
                        return(instruction.rect);
                    }
                }
                var drawInstructions = new List <IMGUIDrawInstruction>(32);
                GUIViewDebuggerHelper.GetDrawInstructions(drawInstructions);

                // Property instruction not found
                // Let's see if we can find any of the ancestor instructions to allow the user to unfold
                Rect regionRect = new Rect();
                found = FindAncestorPropertyRegion(fieldPathInClass, targetTypeName, drawInstructions, propertyInstructions, ref regionRect);
                return(regionRect);
            }
            found = false;
            return(Rect.zero);
        }
Exemple #2
0
 public override void UpdateInstructions()
 {
     //TODO: find a better approach instead of getting the whole list everyframe.
     m_PropertyList.Clear();
     GUIViewDebuggerHelper.GetPropertyInstructions(m_PropertyList);
 }
 public override void UpdateInstructions()
 {
     this.m_PropertyList.Clear();
     GUIViewDebuggerHelper.GetPropertyInstructions(this.m_PropertyList);
 }