Example #1
0
        protected PropertyPath GetPath(string path)
        {
            var p = new PropertyPath();

            p.AppendPath(path);
            return(p);
        }
Example #2
0
        protected PropertyPath GetListPath(string path, int index)
        {
            var p = new PropertyPath();

            p.AppendPath(path);
            p.PushIndex(index);
            return(p);
        }
Example #3
0
        protected PropertyPath GetDictionaryPath <TKey>(string path, TKey key)
        {
            var p = new PropertyPath();

            p.AppendPath(path);
            p.PushKey(key);
            p.PushName("Value");
            return(p);
        }
        void RegisterBindings(VisualElement content)
        {
            if (content is CustomInspectorElement && content != this)
            {
                return;
            }

            var popRelativePartCount = 0;

            if (content is BindableElement b && !string.IsNullOrEmpty(b.bindingPath))
            {
                if (b.bindingPath != ".")
                {
                    var previousCount = m_RelativePath.PartsCount;
                    m_RelativePath.AppendPath(b.bindingPath);
                    m_AbsolutePath.AppendPath(b.bindingPath);
                    popRelativePartCount = m_RelativePath.PartsCount - previousCount;
                }

                if (Inspector.IsPathValid(m_RelativePath))
                {
                    RegisterBindings(Inspector, m_RelativePath, content, m_Root);
                }
                else if (Inspector.IsPathValid(m_AbsolutePath))
                {
                    RegisterBindings(Inspector, m_AbsolutePath, content, m_Root);
                }
                m_AbsolutePath.Clear();
            }

            if (!(content is PropertyElement) && !(content is DefaultInspectorElement))
            {
                foreach (var child in content.Children())
                {
                    RegisterBindings(child);
                }
            }

            for (var i = 0; i < popRelativePartCount; ++i)
            {
                m_RelativePath.Pop();
            }
        }