"""Apply the satellite-estimated marker location in the authored plateau scene.""" import bpy, json from pathlib import Path ROOT = Path('D:/project/sunrise') spec = json.loads((ROOT/'scripts/constants/marker-location.json').read_text()) root = bpy.data.objects['summit-marker'] baseline = bpy.data.meshes['Slab before marker seating'] x, south = spec['offsetFromStartMeters'] def ground(x, y): return min(baseline.vertices, key=lambda v:(v.co.x-x)**2+(v.co.y-y)**2).co.z root.location.z += ground(x, -south)-ground(root.location.x, root.location.y) root.location.x, root.location.y = x, -south root['locationSource'] = spec['source'] root['locationUncertaintyMeters'] = spec['estimatedUncertaintyMeters'] # Restore the original ground, then seat the existing stone at its new location. exec(compile((ROOT/'scripts/sculpt-asymmetric-marker.py').read_text(), 'sculpt-asymmetric-marker.py', 'exec')) exec(compile((ROOT/'scripts/export-summit-plateau.py').read_text(), 'export-summit-plateau.py', 'exec'))