|
21 | 21 | bl_info = { |
22 | 22 | 'name': 'Blender Pyrogenesis Importer', |
23 | 23 | 'author': 'Stanislas Daniel Claude Dolcini', |
24 | | - 'version': (1, 3, 5), |
| 24 | + 'version': (1, 3, 6), |
25 | 25 | 'blender': (2, 80, 0), |
26 | 26 | 'location': 'File > Import-Export', |
27 | 27 | 'description': 'Import ', |
@@ -445,9 +445,13 @@ def parse_actor(self, root, proppoint="root", parentprops=[], rootObj=None, prop |
445 | 445 | # Import the new objects |
446 | 446 | if child.tag == "mesh": |
447 | 447 | mesh_path = self.currentPath + 'meshes/' + child.text |
448 | | - fixer = MaxColladaFixer(mesh_path) |
449 | | - fixer.execute() |
450 | | - bpy.ops.wm.collada_import(filepath=mesh_path, import_units=True) |
| 448 | + try: |
| 449 | + |
| 450 | + fixer = MaxColladaFixer(mesh_path) |
| 451 | + fixer.execute() |
| 452 | + bpy.ops.wm.collada_import(filepath=mesh_path, import_units=True) |
| 453 | + except: |
| 454 | + print('Could not load' + mesh_path) |
451 | 455 | else: |
452 | 456 | bpy.ops.object.select_all(action='DESELECT') |
453 | 457 | if material_type == 'default.xml' or 'terrain' in material_type: |
@@ -595,16 +599,21 @@ def parse_actor(self, root, proppoint="root", parentprops=[], rootObj=None, prop |
595 | 599 | print("============== Gathering Props ========================") |
596 | 600 | print("=======================================================") |
597 | 601 | if prop.attrib['actor'] is "": |
598 | | - continue; |
| 602 | + continue |
599 | 603 |
|
600 | | - print('Loading ' + self.currentPath + 'actors/' + prop.attrib['actor'] + '.') |
601 | | - proproot = ET.parse(self.currentPath + 'actors/' + prop.attrib['actor']).getroot() |
| 604 | + try: |
| 605 | + prop_path = self.currentPath + 'actors/' + prop.attrib['actor'] |
| 606 | + print('Loading ' + prop_path + '.') |
| 607 | + proproot = ET.parse(prop_path).getroot() |
602 | 608 |
|
603 | | - propRootObj = self.find_prop_root_object(finalprops, prop.attrib['attachpoint']) |
604 | | - if propRootObj is not None and prop.attrib['attachpoint'] is not 'root' and rootObject is None: |
605 | | - rootObject = propRootObj |
| 609 | + propRootObj = self.find_prop_root_object(finalprops, prop.attrib['attachpoint']) |
| 610 | + if propRootObj is not None and prop.attrib['attachpoint'] is not 'root' and rootObject is None: |
| 611 | + rootObject = propRootObj |
| 612 | + |
| 613 | + self.parse_actor(proproot, prop.attrib['attachpoint'], meshprops if finalprops is None or len(finalprops) <= 0 else finalprops, rootObject, propDepth + 1) |
| 614 | + except: |
| 615 | + print('Could not load' + mesh_path) |
606 | 616 |
|
607 | | - self.parse_actor(proproot, prop.attrib['attachpoint'], meshprops if finalprops is None or len(finalprops) <= 0 else finalprops, rootObject, propDepth + 1) |
608 | 617 |
|
609 | 618 | def find_prop_root_object(self, imported_objects, proppoint): |
610 | 619 | for imported_object in imported_objects: |
@@ -641,7 +650,7 @@ def __init__(self, file_path=None): |
641 | 650 | def execute(self): |
642 | 651 | import xml.etree.ElementTree as ET |
643 | 652 | from datetime import date |
644 | | - |
| 653 | + |
645 | 654 | tree = ET.parse(self.file_path) |
646 | 655 | ET.register_namespace("", "http://www.collada.org/2005/11/COLLADASchema") |
647 | 656 | root = tree.getroot() |
|
0 commit comments