python blender-display-opengl-lights-on-custom-panel.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python blender-display-opengl-lights-on-custom-panel.py相关的知识,希望对你有一定的参考价值。

# for http://blender.stackexchange.com/q/74766/3710

import bpy

def opengl_lamp_display(column, lamp):
    split = column.split(percentage=0.1)
    split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')

    col = split.column()
    col.active = lamp.use
    row = col.row()
    row.label(text="Diffuse:")
    row.prop(lamp, "diffuse_color", text="")
    row = col.row()
    row.label(text="Specular:")
    row.prop(lamp, "specular_color", text="")

    col = split.column()
    col.active = lamp.use
    col.prop(lamp, "direction", text="")
    
    
class MyOpenGlLightPanel(bpy.types.Panel):
    bl_idname = "MyOpenGlLightPanel"
    bl_label = "Solid OpenGL Lights"
    bl_space_type = "VIEW_3D"   
    bl_region_type = "TOOLS"    
    bl_category = "Tools"
    bl_context = "objectmode"   

    @classmethod
    def poll(self,context):
        return context.object is not None
    
    def draw(self, context):
        layout = self.layout
        
        layout = self.layout

        userpref = context.user_preferences
        system = userpref.system

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

        split = column.split(percentage=0.1)
        split.label()
        split.label(text="Colors:")
        split.label(text="Direction:")
        
        lamp = system.solid_lights[0]
        opengl_lamp_display(column, lamp)

        lamp = system.solid_lights[1]
        opengl_lamp_display(column, lamp)

        lamp = system.solid_lights[2]
        opengl_lamp_display(column, lamp)


# ------------------------------------------------------------------------
# register and unregister
# ------------------------------------------------------------------------

def register():
    bpy.utils.register_class(MyOpenGlLightPanel)

def unregister():
    bpy.utils.unregister_class(MyOpenGlLightPanel)

if __name__ == "__main__":
    register()

以上是关于python blender-display-opengl-lights-on-custom-panel.py的主要内容,如果未能解决你的问题,请参考以下文章

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍

Python学习之认识python

python初识