osm_georeferencing.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:blender-tools 作者: vvoovv 项目源码 文件源码
def execute(self, context):
        wm = context.window_manager
        scene = context.scene
        o = scene.objects.active
        # calculationg the new position of the active object center
        v = -Vector((wm["_x"], wm["_y"], o.location.z))
        p = o.matrix_world * v
        projection = TransverseMercator(lat=scene["lat"], lon=scene["lon"])
        (lat, lon) = projection.toGeographic(p[0], p[1])
        scene["lat"] = lat
        scene["lon"] = lon
        scene["heading"] = (o.rotation_euler[2]-wm["_h"])*180/math.pi

        # restoring original objects location and orientation
        bpy.ops.transform.rotate(value=-(o.rotation_euler[2]-wm["_h"]), axis=(0,0,1))
        bpy.ops.transform.translate(value=-(o.location+v))
        # cleaning up
        del wm["_x"], wm["_y"], wm["_h"]
        return {"FINISHED"}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号