| 141 | } |
| 142 | |
| 143 | void AnnotationDisplay::addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj) |
| 144 | { |
| 145 | QCollator collator; |
| 146 | collator.setNumericMode(true); |
| 147 | collator.setCaseSensitivity(Qt::CaseInsensitive); |
| 148 | |
| 149 | rdcarray<const SDObject *> children; |
| 150 | children.reserve(parentObj.NumChildren()); |
| 151 | for(const SDObject *obj : parentObj) |
| 152 | children.push_back(obj); |
| 153 | |
| 154 | if(parentObj.type.basetype != SDBasic::Array) |
| 155 | std::sort(children.begin(), children.end(), [&collator](const SDObject *a, const SDObject *b) { |
| 156 | return collator.compare(QString(a->name), QString(b->name)) < 0; |
| 157 | }); |
| 158 | |
| 159 | for(const SDObject *obj : children) |
| 160 | { |
| 161 | if(!shouldBeDisplayed(*obj)) |
| 162 | continue; |
| 163 | |
| 164 | QVariant name; |
| 165 | |
| 166 | if(parentObj.type.basetype == SDBasic::Array) |
| 167 | name = QFormatStr("[%1]").arg(parent->childCount()); |
| 168 | else |
| 169 | name = obj->name; |
| 170 | |
| 171 | RDTreeWidgetItem *item; |
| 172 | if(m_HasGoColumn) |
| 173 | item = new RDTreeWidgetItem({name, QString(), QString()}); |
| 174 | else |
| 175 | item = new RDTreeWidgetItem({name, QString()}); |
| 176 | |
| 177 | m_Items[obj] = item; |
| 178 | |
| 179 | // Check if this is a viewable resource (buffer, texture, or shader) |
| 180 | if(obj->type.basetype == SDBasic::Resource) |
| 181 | { |
| 182 | ResourceId id = obj->data.basic.id; |
| 183 | const ResourceDescription *resDesc = m_Ctx.GetResource(id); |
| 184 | |
| 185 | if(resDesc && (resDesc->type == ResourceType::Buffer || |
| 186 | resDesc->type == ResourceType::Texture || resDesc->type == ResourceType::Shader)) |
| 187 | { |
| 188 | AnnotationResourceTag tag; |
| 189 | tag.resourceId = id; |
| 190 | tag.resourceType = resDesc->type; |
| 191 | |
| 192 | if(resDesc->type == ResourceType::Buffer) |
| 193 | { |
| 194 | // Look for special child annotations for buffer viewer parameters |
| 195 | const SDObject *offsetChild = obj->FindChildByKeyPath("__offset"); |
| 196 | const SDObject *sizeChild = obj->FindChildByKeyPath("__size"); |
| 197 | const SDObject *formatChild = obj->FindChildByKeyPath("__rd_format"); |
| 198 | |
| 199 | if(offsetChild && (offsetChild->type.basetype == SDBasic::UnsignedInteger || |
| 200 | offsetChild->type.basetype == SDBasic::SignedInteger)) |
nothing calls this directly
no test coverage detected