|
40 | 40 | 'author': 'Sketchfab',
|
41 | 41 | 'license': 'APACHE2',
|
42 | 42 | 'deps': '',
|
43 |
| - 'version': (1, 6, 0), |
| 43 | + 'version': (1, 6, 1), |
44 | 44 | "blender": (2, 80, 0),
|
45 | 45 | 'location': 'View3D > Tools > Sketchfab',
|
46 | 46 | 'warning': '',
|
@@ -647,6 +647,9 @@ def download_model(self, uid):
|
647 | 647 | if "/orgs/" in skfb.manualImportPath:
|
648 | 648 | try:
|
649 | 649 | orgName = skfb.manualImportPath.split("/orgs/")[1].split("/")[0]
|
| 650 | + if skfb.skfb_api.user_has_orgs and not skfb.skfb_api.active_org: |
| 651 | + skfb.skfb_api.request_user_orgs() |
| 652 | + |
650 | 653 | user_orgs = skfb.skfb_api.user_orgs
|
651 | 654 | orgUid = ""
|
652 | 655 | for org in user_orgs:
|
@@ -680,13 +683,12 @@ def handle_download(self, r, *args, **kwargs):
|
680 | 683 |
|
681 | 684 | gltf = r.json()['gltf']
|
682 | 685 | skfb_model = get_sketchfab_model(uid)
|
683 |
| - if skfb_model is not None: |
684 |
| - skfb_model.download_url = gltf['url'] |
685 |
| - skfb_model.time_url_requested = time.time() |
686 |
| - skfb_model.url_expires = gltf['expires'] |
687 |
| - self.get_archive(gltf['url'], skfb_model.title) |
688 |
| - else: |
689 |
| - ShowMessage("ERROR", "Cannot retrieve information for this model", "") |
| 686 | + |
| 687 | + # If the model name is not known at this step, we could try to do an additional API call to get it |
| 688 | + # This can happen when the user chose to import a model from its url |
| 689 | + # However this adds an additional call and a bit of complexity for org models (need additional parsing), |
| 690 | + # so for a simple hotfix models imported this way will be called "Sketchfab model" |
| 691 | + self.get_archive(gltf['url'], skfb_model.title if skfb_model else "Sketchfab Model") |
690 | 692 |
|
691 | 693 | def get_archive(self, url, title):
|
692 | 694 | if url is None:
|
|
0 commit comments