218 |
218 |
219 if (!obj->isColored ()) |
219 if (!obj->isColored ()) |
220 return; |
220 return; |
221 |
221 |
222 if (list == GL::PickList) { |
222 if (list == GL::PickList) { |
223 // Make the color by the object's index color if we're picking, so we can |
223 // Make the color by the object's ID if we're picking, so we can make the |
224 // make the index from the color we get from the picking results. Be sure |
224 // ID again from the color we get from the picking results. Be sure to use |
225 // to use the top level parent's index since inlinees don't have an index. |
225 // the top level parent's index since we want a subfile's children point |
226 long i = obj->topLevelParent ()->getIndex (file ()); |
226 // to the subfile itself. |
227 |
227 long i = obj->topLevelParent()->id(); |
228 // We should have the index now. |
|
229 assert (i != -1); |
|
230 |
228 |
231 // Calculate a color based from this index. This method caters for |
229 // Calculate a color based from this index. This method caters for |
232 // 16777216 objects. I don't think that'll be exceeded anytime soon. :) |
230 // 16777216 objects. I don't think that'll be exceeded anytime soon. :) |
233 // ATM biggest is 53588.dat with 12600 lines. |
231 // ATM biggest is 53588.dat with 12600 lines. |
234 double r = (i / (256 * 256)) % 256, |
232 double r = (i / (256 * 256)) % 256, |
1121 |
1119 |
1122 LDObject* removedObj = null; |
1120 LDObject* removedObj = null; |
1123 |
1121 |
1124 // Go through each pixel read and add them to the selection. |
1122 // Go through each pixel read and add them to the selection. |
1125 for (long i = 0; i < numpixels; ++i) { |
1123 for (long i = 0; i < numpixels; ++i) { |
1126 uint32 idx = |
1124 long idx = |
1127 (*(pixelptr) * 0x10000) + |
1125 (*(pixelptr + 0) * 0x10000) + |
1128 (*(pixelptr + 1) * 0x00100) + |
1126 (*(pixelptr + 1) * 0x00100) + |
1129 (*(pixelptr + 2) * 0x00001); |
1127 (*(pixelptr + 2) * 0x00001); |
1130 pixelptr += 4; |
1128 pixelptr += 4; |
1131 |
1129 |
1132 if (idx == 0xFFFFFF) |
1130 if (idx == 0xFFFFFF) |
1133 continue; // White is background; skip |
1131 continue; // White is background; skip |
1134 |
1132 |
1135 LDObject* obj = file ()->obj (idx); |
1133 LDObject* obj = LDObject::fromID( idx ); |
1136 |
1134 |
1137 // If this is an additive single pick and the object is currently selected, |
1135 // If this is an additive single pick and the object is currently selected, |
1138 // we remove it from selection instead. |
1136 // we remove it from selection instead. |
1139 if (!m_rangepick && m_addpick) { |
1137 if (!m_rangepick && m_addpick) { |
1140 bool removed = false; |
1138 bool removed = false; |