Created
October 22, 2016 11:52
-
-
Save mireq/ba8e48607e40248b3bc9884306dcd5cb to your computer and use it in GitHub Desktop.
Blender material preview in node editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class PreviewPanel(bpy.types.Panel): | |
bl_label = "Material preview" | |
bl_space_type = "NODE_EDITOR" | |
bl_region_type = "UI" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object is not None and context.object.active_material is not None | |
def draw(self, context): | |
ob = context.active_object | |
self.layout.template_ID_preview(ob, "active_material") | |
#self.layout.template_preview(ob.active_material) | |
def register(): | |
bpy.utils.register_class(PreviewPanel) | |
def unregister(): | |
bpy.utils.unregister_class(PreviewPanel) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment