def draw(self, context):
        layout = self.layout

        ob = context.object
        lamp = context.lamp
        space = context.space_data

        if ob:
            layout.template_ID(ob, 'data')
        elif lamp:
            layout.template_ID(space, 'pin_id')

        VRayLight = lamp.vray

        layout.separator()
        layout.prop(lamp, 'type', expand=True)

        lightSubTypeAttr = LibUtils.LampSubType[lamp.type]
        if lightSubTypeAttr is not None:
            layout.prop(VRayLight, lightSubTypeAttr, expand=True)

        lightPluginName = LibUtils.GetLightPluginName(lamp)
        lightPropGroup = getattr(VRayLight, lightPluginName)

        layout.separator()
        classes.NtreeWidget(layout, VRayLight, "Lamp Tree",
                            "vray.add_nodetree_light", 'LAMP')

        layout.separator()
        classes.DrawPluginUI(context, layout, VRayLight, lightPropGroup,
                             lightPluginName,
                             PLUGINS['LIGHT'][lightPluginName])

        layout.separator()

        if lamp.type == 'AREA':
            layout.prop(VRayLight.LightRectangle, 'is_disc')
            if VRayLight.LightRectangle.is_disc:
                split = layout.split()
                col = split.column()
                col.prop(lamp, 'size')
            else:
                layout.prop(lamp, 'shape', expand=True)
                split = layout.split()
                if lamp.shape == 'SQUARE':
                    col = split.column()
                    col.prop(lamp, 'size')
                else:
                    row = split.row(align=True)
                    row.prop(lamp, 'size', text="X")
                    row.prop(lamp, 'size_y', text="Y")

        elif lamp.type == 'SPOT':
            split = layout.split()
            col = split.column()
            col.prop(lamp, "show_cone")
            if VRayLight.spot_type == 'SPOT':
                col.prop(lamp, 'spot_size', text="Size")
                col.prop(lamp, 'spot_blend', text="Blend")
Exemple #2
0
def AddLampNodeTree(lamp):
    VRayLight = lamp.vray

    nt = bpy.data.node_groups.new(lamp.name, type='VRayNodeTreeLight')
    nt.use_fake_user = True

    lightPluginName = LibUtils.GetLightPluginName(lamp)

    nt.nodes.new('VRayNode%s' % lightPluginName)
    NodesTools.deselectNodes(nt)

    VRayLight.ntree = nt
Exemple #3
0
    def draw(self, context):
        wide_ui = context.region.width > classes.narrowui

        layout = self.layout

        split = layout.split()
        col = split.column()

        if bpy.data.lamps:
            for lamp in bpy.data.lamps:
                VRayLight = lamp.vray
                VRayScene = context.scene.vray

                lightPluginName = LibUtils.GetLightPluginName(lamp)

                lightPropGroup = getattr(VRayLight, lightPluginName)

                sub_t = col.row()
                sub_t.label(text=" %s" % lamp.name, icon='LAMP_%s' % lamp.type)

                if lightPluginName == 'SunLight':
                    sub = col.row()
                    sub.prop(lightPropGroup, 'enabled', text="")

                    r = sub.row()
                    r.scale_x = 0.4
                    r.prop(lightPropGroup, 'filter_color', text="")

                    sub.prop(lightPropGroup, 'intensity_multiplier', text="")
                    sub.prop(lightPropGroup, 'shadow_subdivs', text="")

                else:
                    sub = col.row()
                    sub.prop(lightPropGroup, 'enabled', text="")
                    sub.prop(lightPropGroup, 'color', text="")

                    if hasattr(lightPropGroup, 'intensity'):
                        sub.prop(lightPropGroup, 'intensity', text="")
                    if hasattr(lightPropGroup, 'power'):
                        sub.prop(lightPropGroup, 'power', text="")
                    if hasattr(lightPropGroup, 'subdivs'):
                        sub.prop(lightPropGroup, 'subdivs', text="")
                    if hasattr(lightPropGroup, 'shadowSubdivs'):
                        sub.prop(lightPropGroup, 'shadowSubdivs', text="")
        else:
            col.label(text="Nothing in bpy.data.lamps...")
def LightIsAmbient(lamp):
    if LibUtils.GetLightPluginName(lamp) in {'LightAmbientMax'}:
        return True
    return False