| 1410 | } |
| 1411 | |
| 1412 | void ObjectIdentifier::String::checkImport(const App::DocumentObject* owner, |
| 1413 | const App::DocumentObject* obj, |
| 1414 | const String* objName) |
| 1415 | { |
| 1416 | if (owner && owner->getDocument() && !str.empty() |
| 1417 | && ExpressionParser::ExpressionImporter::reader()) { |
| 1418 | auto reader = ExpressionParser::ExpressionImporter::reader(); |
| 1419 | if (obj || objName) { |
| 1420 | bool restoreLabel = false; |
| 1421 | str = PropertyLinkBase::importSubName(*reader, str.c_str(), restoreLabel); |
| 1422 | if (restoreLabel) { |
| 1423 | if (!obj) { |
| 1424 | std::bitset<32> flags; |
| 1425 | obj = getDocumentObject(owner->getDocument(), *objName, flags); |
| 1426 | if (!obj) { |
| 1427 | FC_ERR("Cannot find object " << objName->toString()); |
| 1428 | } |
| 1429 | } |
| 1430 | |
| 1431 | if (obj) { |
| 1432 | PropertyLinkBase::restoreLabelReference(obj, str); |
| 1433 | } |
| 1434 | } |
| 1435 | } |
| 1436 | else if (str.back() != '@') { |
| 1437 | str = reader->getName(str.c_str()); |
| 1438 | } |
| 1439 | else { |
| 1440 | str.resize(str.size() - 1); |
| 1441 | auto mapped = reader->getName(str.c_str()); |
| 1442 | auto objForMapped = owner->getDocument()->getObject(mapped); |
| 1443 | if (!objForMapped) { |
| 1444 | FC_ERR("Cannot find object " << str); |
| 1445 | } |
| 1446 | else { |
| 1447 | isString = true; |
| 1448 | forceIdentifier = false; |
| 1449 | str = objForMapped->Label.getValue(); |
| 1450 | } |
| 1451 | } |
| 1452 | } |
| 1453 | } |
| 1454 | |
| 1455 | Py::Object |
| 1456 | ObjectIdentifier::access(const ResolveResults& result, const Py::Object* value, Dependencies* deps) const |