| 2052 | } |
| 2053 | |
| 2054 | QVariant SDObject2Variant(const SDObject *obj, bool inlineImportant) |
| 2055 | { |
| 2056 | QVariant param; |
| 2057 | |
| 2058 | // we don't identify via the type name as many types could be serialised as a ResourceId - |
| 2059 | // e.g. ID3D11Resource* or ID3D11Buffer* which would be the actual typename. We want to preserve |
| 2060 | // that for the best raw structured data representation instead of flattening those out to just |
| 2061 | // "ResourceId", and we also don't want to store two types ('fake' and 'real'), so instead we |
| 2062 | // check the custom string. |
| 2063 | if(obj->type.basetype == SDBasic::Resource) |
| 2064 | { |
| 2065 | param = QVariant::fromValue(obj->data.basic.id); |
| 2066 | } |
| 2067 | else if(obj->type.basetype == SDBasic::GPUAddress) |
| 2068 | { |
| 2069 | PointerVal p; |
| 2070 | p.pointerTypeID = ~0U; |
| 2071 | p.pointer = obj->data.basic.u; |
| 2072 | param = ToQStr(p); |
| 2073 | } |
| 2074 | else if(obj->type.flags & SDTypeFlags::NullString) |
| 2075 | { |
| 2076 | param = lit("NULL"); |
| 2077 | } |
| 2078 | else if(obj->type.flags & SDTypeFlags::HasCustomString) |
| 2079 | { |
| 2080 | param = obj->data.str; |
| 2081 | } |
| 2082 | else |
| 2083 | { |
| 2084 | Formatter::FormatterFlags flags = Formatter::NoFlags; |
| 2085 | if((obj->type.flags & SDTypeFlags::OffsetOrSize) || |
| 2086 | ((obj->GetParent() && obj->GetParent()->type.flags & SDTypeFlags::OffsetOrSize))) |
| 2087 | flags = Formatter::OffsetSize; |
| 2088 | |
| 2089 | switch(obj->type.basetype) |
| 2090 | { |
| 2091 | case SDBasic::Chunk: |
| 2092 | { |
| 2093 | if(inlineImportant) |
| 2094 | { |
| 2095 | QString name = obj->name; |
| 2096 | |
| 2097 | // don't display any "ClassName::" prefix by default here |
| 2098 | int nsSep = name.indexOf(lit("::")); |
| 2099 | if(nsSep > 0) |
| 2100 | name.remove(0, nsSep + 2); |
| 2101 | |
| 2102 | name += lit("("); |
| 2103 | |
| 2104 | bool onlyImportant(obj->type.flags & SDTypeFlags::ImportantChildren); |
| 2105 | |
| 2106 | bool first = true; |
| 2107 | for(const SDObject *child : *obj) |
| 2108 | { |
| 2109 | // never display hidden members |
| 2110 | if(child->type.flags & SDTypeFlags::Hidden) |
| 2111 | continue; |