mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-29 09:56:39 +00:00
Hide hidden/internal parameters in resource inspector
This commit is contained in:
@@ -3311,6 +3311,24 @@ QModelIndex StructuredDataItemModel::index(int row, int column, const QModelInde
|
||||
}
|
||||
else
|
||||
{
|
||||
if(par->type.flags & SDTypeFlags::HiddenChildren)
|
||||
{
|
||||
// if this node has hidden children, get the index relative to only visible children
|
||||
int idx = 0;
|
||||
for(size_t i = 0; i < par->NumChildren(); i++)
|
||||
{
|
||||
SDObject *ch = par->GetChild(i);
|
||||
|
||||
if(ch->type.flags & SDTypeFlags::Hidden)
|
||||
continue;
|
||||
|
||||
if(idx == row)
|
||||
return createIndex(row, column, encodeIndex({Direct, ch, 0}));
|
||||
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
return createIndex(row, column, encodeIndex({Direct, par->GetChild(row), 0}));
|
||||
}
|
||||
}
|
||||
@@ -3379,9 +3397,21 @@ QModelIndex StructuredDataItemModel::parent(const QModelIndex &index) const
|
||||
}
|
||||
|
||||
// search our parent to find out our child index
|
||||
int idx = 0;
|
||||
bool largeArray = isLargeArray(parent);
|
||||
for(size_t i = 0; i < parent->NumChildren(); i++)
|
||||
if(parent->GetChild(i) == obj)
|
||||
return createIndex((int)i, 0, obj);
|
||||
{
|
||||
const SDObject *ch = parent->GetChild(i);
|
||||
if(ch == obj)
|
||||
return createIndex(idx, 0, obj);
|
||||
|
||||
// for non-large arrays, we account for hidden children. Large arrays should not have any
|
||||
// hidden children anyway
|
||||
if(!largeArray && (ch->type.flags & SDTypeFlags::Hidden))
|
||||
continue;
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
@@ -3418,9 +3448,30 @@ int StructuredDataItemModel::rowCount(const QModelIndex &parent) const
|
||||
if(obj)
|
||||
{
|
||||
if(isLargeArray(obj))
|
||||
{
|
||||
return (int(obj->NumChildren()) + ArrayPageSize - 1) / ArrayPageSize;
|
||||
}
|
||||
else
|
||||
return (int)obj->NumChildren();
|
||||
{
|
||||
if(obj->type.flags & SDTypeFlags::HiddenChildren)
|
||||
{
|
||||
// if this node has hidden children, count the *actual* number of children
|
||||
int numChildren = 0;
|
||||
for(size_t i = 0; i < obj->NumChildren(); i++)
|
||||
{
|
||||
if(obj->GetChild(i)->type.flags & SDTypeFlags::Hidden)
|
||||
continue;
|
||||
|
||||
numChildren++;
|
||||
}
|
||||
|
||||
return numChildren;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)obj->NumChildren();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -159,6 +159,11 @@ DOCUMENT(R"(Bitfield flags that could be applied to a type.
|
||||
Indicates that only important children should be processed, as noted in :data:`Important`. This
|
||||
may appear on an object which has no important children - which indicates explicitly that there
|
||||
are no important children so when summarising no parameters should be shown.
|
||||
|
||||
.. data:: HiddenChildren
|
||||
|
||||
Indicates that some children are marked as hidden. This can be important for cases where the
|
||||
number of children is important.
|
||||
)");
|
||||
enum class SDTypeFlags : uint32_t
|
||||
{
|
||||
@@ -171,6 +176,7 @@ enum class SDTypeFlags : uint32_t
|
||||
Union = 0x20,
|
||||
Important = 0x40,
|
||||
ImportantChildren = 0x80,
|
||||
HiddenChildren = 0x100,
|
||||
};
|
||||
|
||||
BITMASK_OPERATORS(SDTypeFlags);
|
||||
|
||||
@@ -221,6 +221,15 @@ static void Obj2XML(pugi::xml_node &parent, SDObject &child)
|
||||
if(child.type.flags & SDTypeFlags::Union)
|
||||
obj.append_attribute("union") = true;
|
||||
|
||||
if(child.type.flags & SDTypeFlags::Important)
|
||||
obj.append_attribute("important") = true;
|
||||
|
||||
if(child.type.flags & SDTypeFlags::ImportantChildren)
|
||||
obj.append_attribute("importantchildren") = true;
|
||||
|
||||
if(child.type.flags & SDTypeFlags::HiddenChildren)
|
||||
obj.append_attribute("hiddenchildren") = true;
|
||||
|
||||
if(child.type.basetype == SDBasic::Chunk)
|
||||
{
|
||||
RDCFATAL("Nested chunks!");
|
||||
@@ -500,6 +509,15 @@ static SDObject *XML2Obj(pugi::xml_node &obj)
|
||||
if(obj.attribute("union"))
|
||||
ret->type.flags |= SDTypeFlags::Union;
|
||||
|
||||
if(obj.attribute("important"))
|
||||
ret->type.flags |= SDTypeFlags::Important;
|
||||
|
||||
if(obj.attribute("importantchildren"))
|
||||
ret->type.flags |= SDTypeFlags::ImportantChildren;
|
||||
|
||||
if(obj.attribute("hiddenchildren"))
|
||||
ret->type.flags |= SDTypeFlags::HiddenChildren;
|
||||
|
||||
if(obj.attribute("typename"))
|
||||
ret->type.name = obj.attribute("typename").as_string();
|
||||
|
||||
|
||||
@@ -1142,6 +1142,8 @@ public:
|
||||
{
|
||||
SDObject ¤t = *m_StructureStack.back();
|
||||
|
||||
current.type.flags |= SDTypeFlags::HiddenChildren;
|
||||
|
||||
if(current.NumChildren() > 0)
|
||||
current.GetChild(current.NumChildren() - 1)->type.flags |= SDTypeFlags::Hidden;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user