do.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def light(self, en, scene, name):
        """
        en: dxf entity
        name: ignored; exists to make separate and merged objects methods universally callable from _call_types()
        Creates, links and returns a new light object depending on the type and color of the dxf entity.
        """
        # light_type : distant = 1; point = 2; spot = 3
        if self.import_light:
            type_map = ["NONE", "SUN", "POINT", "SPOT"]
            layer = self.dwg.layers[en.layer]
            lamp = bpy.data.lamps.new(en.name, type_map[en.light_type])
            if en.color != 256:
                aci = en.color
            else:
                aci = layer.color
            c = dxfgrabber.aci_to_true_color(aci)
            lamp.color = Color(c.rgb())
            if en.light_type == 3:
                lamp.spot_size = en.hotspot_angle
            o = bpy.data.objects.new(en.name, lamp)
            o.location = self.proj(en.position)
            dir = self.proj(en.target) - self.proj(en.position)
            o.rotation_quaternion = dir.rotation_difference(Vector((0, 0, -1)))
            scene.objects.link(o)
            return o
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号