| 963 | } |
| 964 | |
| 965 | std::shared_ptr<Material> ExternalManager::getMaterial(const QString& uuid) |
| 966 | { |
| 967 | connect(); |
| 968 | |
| 969 | Base::PyGILStateLocker lock; |
| 970 | try { |
| 971 | if (_managerObject.hasAttr("getMaterial")) { |
| 972 | Py::Callable libraries(_managerObject.getAttr("getMaterial")); |
| 973 | Py::Tuple args(1); |
| 974 | args.setItem(0, Py::String(uuid.toStdString())); |
| 975 | Py::Object result(libraries.apply(args)); |
| 976 | |
| 977 | auto shared = materialFromObject(result, uuid); |
| 978 | |
| 979 | return shared; |
| 980 | } |
| 981 | else { |
| 982 | Base::Console().log("\tgetMaterial() not found\n"); |
| 983 | throw ConnectionError(); |
| 984 | } |
| 985 | } |
| 986 | catch (Py::Exception& e) { |
| 987 | Base::PyException e1; // extract the Python error text |
| 988 | throw MaterialNotFound(e1.what()); |
| 989 | } |
| 990 | } |
| 991 | |
| 992 | void ExternalManager::addMaterial(const QString& libraryName, |
| 993 | const QString& path, |