Advertisement
Guest User

Untitled

a guest
Mar 18th, 2021
1,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 63.63 KB | None | 0 0
  1. # ##### BEGIN LICENSE BLOCK #####
  2. #
  3. #  Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
  4. #
  5. #  This work is licensed under the Creative Commons
  6. #  Attribution-NonCommercial-NoDerivatives 4.0 International License.
  7. #
  8. #  To view a copy of this license,
  9. #  visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10. #
  11. # ##### END LICENSE BLOCK #####
  12.  
  13. bl_info = {
  14.     "name": "Shader Library",
  15.     "author": "Darkfall",
  16.     "version": (1, 8),
  17.     "blender": (2, 90, 1),
  18.     "location": "View3D > Toolshelf",
  19.     "description": "Select from the Various Different Shaders, and they will be addded to your selected object",
  20.     "warning": "",
  21.     "wiki_url": "",
  22.     "category": "Add Shader",
  23. }
  24.  
  25. import bpy
  26. from bpy.types import (Panel, Operator, Menu, PropertyGroup)
  27. from bpy.props import (PointerProperty, FloatProperty, FloatVectorProperty, BoolProperty, IntProperty, EnumProperty)
  28.  
  29. class ShaderLibraryProperties(PropertyGroup):
  30.    
  31.     planet_type: EnumProperty(
  32.         name="Planet Type:",
  33.         description="Select A Planet Type.",
  34.         items=[ ('OP2', "Continental World", "An Earth-like Planet"),
  35.                 ('OP3', "Dust Planet", "A Barren Planet"),
  36.                 ('OP6', "Star Sphere", "Uhm, Stars!"),
  37.                ]
  38.         )
  39.  
  40. class ShaderMainPanel(Panel):
  41.     bl_label = " "
  42.     bl_idname = "SHADER_PT_MAINPANEL"
  43.     bl_space_type = 'VIEW_3D'
  44.     bl_region_type = 'UI'
  45.     bl_category = 'Shader Library'
  46.  
  47.     def draw_header(self, context):
  48.         layout = self.layout
  49.         row = layout.row()
  50.         row.label(text="The Shader Library", icon= 'NODE_MATERIAL')
  51.        
  52.     def draw(self, context):
  53.         layout = self.layout
  54.         row = layout.row()
  55.         row = layout.row()
  56.         row.label(text= "Select a Shader to be added.")
  57.         row = layout.row()
  58.         #row.label(text= "(Press Shift F - for Shortcut)")
  59.         row.label(text= "                                           (ver 1.08)")
  60.  
  61. class SubPanelCosmic(Panel):
  62.     bl_label = "Cosmic Shaders"
  63.     bl_idname = "SHADER_PT_COSMICSHADERS"
  64.     bl_space_type = 'VIEW_3D'
  65.     bl_region_type = 'UI'
  66.     bl_category = 'Shader Library'
  67.     bl_parent_id = 'SHADER_PT_MAINPANEL'
  68.     bl_options = {'DEFAULT_CLOSED'}
  69.  
  70.     def draw(self, context):
  71.         layout = self.layout
  72.         scene = context.scene
  73.         mytool = scene.my_tool
  74.        
  75.         layout.scale_y = 1.1
  76.         row = layout.row()
  77.         row.label(text= "Select a Cosmic Shader.")
  78.         row = layout.row()
  79.         row.prop(mytool, "planet_type")
  80.         row = layout.row()
  81.         row.operator("wm.cosmicop", icon= 'WORLD', text= "Add Cosmic Shader")
  82.         row = layout.row()
  83.  
  84. class SubPanelPreciousMetals(Panel):
  85.     bl_label = "Gemstones"
  86.     bl_idname = "SHADER_PT_PRECIOUSMETALS"
  87.     bl_space_type = 'VIEW_3D'
  88.     bl_region_type = 'UI'
  89.     bl_category = 'Shader Library'
  90.     bl_parent_id = 'SHADER_PT_MAINPANEL'
  91.     bl_options = {'DEFAULT_CLOSED'}
  92.  
  93.     def draw(self, context):
  94.         layout = self.layout
  95.         layout.scale_y = 1.1
  96.         row = layout.row()
  97.         row.label(text= "Select a Gemstone Shader.")
  98.         row = layout.row()
  99.         row.operator("wm.diamondop", icon= 'DECORATE_ANIMATE', text= "Diamond")
  100.         row = layout.row()
  101.  
  102. class SubPanelMaterials(Panel):
  103.     bl_label = "Materials"
  104.     bl_idname = "SHADER_PT_MATERIALS"
  105.     bl_space_type = 'VIEW_3D'
  106.     bl_region_type = 'UI'
  107.     bl_category = 'Shader Library'
  108.     bl_parent_id = 'SHADER_PT_MAINPANEL'
  109.     bl_options = {'DEFAULT_CLOSED'}
  110.  
  111.     def draw(self, context):
  112.         layout = self.layout
  113.         layout.scale_y = 1.1
  114.         row = layout.row()
  115.         row.label(text= "Select a Basic Material Shader.")
  116.         row = layout.row()
  117.         row = layout.row()
  118.         row.operator("wm.leatherop", icon= 'OUTLINER_OB_SURFACE', text= "Leather")
  119.         row = layout.row()
  120.         row.operator("shader.brick_operator", icon= 'MOD_BUILD', text= "Brick")
  121.  
  122. class SubPanelMetals(Panel):
  123.     bl_label = "Metallics"
  124.     bl_idname = "SHADER_PT_METALS"
  125.     bl_space_type = 'VIEW_3D'
  126.     bl_region_type = 'UI'
  127.     bl_category = 'Shader Library'
  128.     bl_parent_id = 'SHADER_PT_MAINPANEL'
  129.     bl_options = {'DEFAULT_CLOSED'}
  130.  
  131.     def draw(self, context):
  132.         layout = self.layout
  133.         layout.scale_y = 1.1
  134.         row = layout.row()
  135.         row.label(text= "Select a Basic Metallic Shader.")
  136.         row = layout.row()
  137.         row = layout.row()
  138.         row.operator('shader.gold_operator', icon= 'KEYTYPE_KEYFRAME_VEC')
  139.         row.operator('shader.silver_operator', icon= 'HANDLETYPE_FREE_VEC')
  140.         row.operator('shader.copper_operator', icon= 'KEYTYPE_EXTREME_VEC')
  141.         row = layout.row()
  142.         row.operator('shader.scifigold_operator', icon= 'COLORSET_09_VEC')
  143.  
  144. class SubPanelStylized(Panel):
  145.     bl_label = "Stylized"
  146.     bl_idname = "SHADER_PT_STYLIZED"
  147.     bl_space_type = 'VIEW_3D'
  148.     bl_region_type = 'UI'
  149.     bl_category = 'Shader Library'
  150.     bl_parent_id = 'SHADER_PT_MAINPANEL'
  151.     bl_options = {'DEFAULT_CLOSED'}
  152.  
  153.     def draw(self, context):
  154.         layout = self.layout
  155.         layout.scale_y = 1.1
  156.         row = layout.row()
  157.         row.label(text= "Select a Stylized Shader.")
  158.         row = layout.row()
  159.         row.operator("shader.cloud_operator", icon= 'OUTLINER_DATA_VOLUME', text= "Clouds")
  160.         row = layout.row()
  161.         row.operator("wm.ghostop", icon= 'GHOST_ENABLED', text= "Ghost")
  162.         row.operator("wm.hologramop", icon= 'USER', text= "Hologram")
  163.         row = layout.row()
  164.         row.operator("wm.neonop", icon= 'PARTICLE_PATH', text= "Neon")
  165.         row = layout.row()
  166.         row.operator("wm.potionop", icon= 'SORTTIME', text= "Stylized Potion")
  167.         row = layout.row()
  168.  
  169. class SHADER_OT_COSMIC(Operator):
  170.     """Open the Cosmic Shader Dialog box"""
  171.     bl_label = "             Cosmic Operator"
  172.     bl_idname = "wm.cosmicop"
  173.     bl_options = {'REGISTER', 'UNDO'}
  174.    
  175.     col1 : FloatVectorProperty(name='Color Tint',subtype='COLOR_GAMMA',size=4,default=(1,1,1,1), min= 0, max= 1)
  176.     atmos : BoolProperty(default= False, name= "Enable Atmospheric Glow")
  177.     land_scale : FloatProperty(default= 4.160)
  178.     land_hue : FloatProperty(default= 0.5, min= 0, max= 1)
  179.     d_hue : FloatProperty(default= 0.5, min= 0, max= 1)
  180.     cloud_bool : BoolProperty(default= False, name= "Enable Clouds")
  181.     cloud_scale : FloatProperty(default= 55.400, name= "Cloud Size")
  182.     cloud_vis : FloatProperty(default= 1, name= "Cloud Visibility", min= 0, max= 1)
  183.     atmos_glow : FloatProperty(default= 6.500)
  184.     atmos_col : FloatVectorProperty(default= (0, 0.141263, 0.904661, 1), name='Atmos Color',subtype='COLOR_GAMMA',size=4)
  185.     d_atmos_col : FloatVectorProperty(default= (0.552012, 0.130136, 0.0451862, 1), name='Atmos Color',subtype='COLOR_GAMMA',size=4)
  186.     d_atmos_glow : FloatProperty(default= 6.500)
  187.     star_scale : FloatProperty(default= 614)
  188.     star_coverage : FloatProperty(default= 0.674, min=0.628, max= 1)
  189.     water_lvl : FloatProperty(default= 0.492, min= 0.35, max= 0.515)
  190.     stripe_amount : FloatProperty(default= 3.500, min= 0, max= 30)
  191.    
  192.     def draw(self, context):
  193.         layout = self.layout
  194.         scene = context.scene
  195.         mytool = scene.my_tool
  196.        
  197.         if mytool.planet_type == 'OP2':
  198.             layout.prop(self, "land_hue", slider= True, text= "Land Hue")
  199.             layout.prop(self, "land_scale", text= "Land Scale")
  200.             layout.prop(self, "water_lvl", slider= True, text= "Water Level")
  201.             layout.prop(self, "atmos")
  202.             if self.atmos == True:
  203.                 layout.prop(self, "atmos_col", text= "Atmos Color")
  204.                 layout.prop(self, "atmos_glow", text= "Glow Amount")
  205.             layout.prop(self, "cloud_bool")    
  206.             if self.cloud_bool == True:
  207.                 layout.prop(self, "cloud_scale")
  208.                 layout.prop(self, "cloud_vis", slider= True)
  209.        
  210.         if mytool.planet_type == 'OP3':
  211.             layout.prop(self, "d_hue", text= "Planet Hue", slider= True)
  212.             layout.prop(self, "stripe_amount", text= "Stripe Amount", slider= True)
  213.             layout.prop(self, "atmos")
  214.             if self.atmos == True:
  215.                 layout.prop(self, "d_atmos_col", text= "Atmos Color")
  216.                 layout.prop(self, "d_atmos_glow", text= "Glow Amount")    
  217.        
  218.         if mytool.planet_type == 'OP6':
  219.             layout.prop(self, "star_scale", text= "Star Scale")
  220.             layout.prop(self, "star_coverage", slider= True, text= "Star Density")      
  221.    
  222.     def execute(self, context):
  223.         c = self.col1
  224.         cv = self.cloud_vis
  225.         scene = context.scene
  226.         mytool = scene.my_tool
  227.        
  228.         if mytool.planet_type == 'OP1':
  229.             material_cosmic = bpy.data.materials.new(name= "Coming Soon")
  230.             material_cosmic.use_nodes = True
  231.             material_cosmic.node_tree.nodes.remove(material_cosmic.node_tree.nodes.get('Principled BSDF'))
  232.             material_output = material_cosmic.node_tree.nodes.get('Material Output')
  233.             material_output.location = (1000,0)
  234.             glass1_node = material_cosmic.node_tree.nodes.new('ShaderNodeBsdfGlass')
  235.             glass1_node.location = (-600,0)
  236.             glass1_node.inputs[0].default_value = (1, 0, 0, 1)
  237.             glass1_node.inputs[2].default_value = 1.446
  238.             #material_cosmic.node_tree.links.new(glass1_node.outputs[0], add1_node.inputs[0])
  239.             #material_cosmic.node_tree.links.new(mix1_node.outputs[0], material_output.inputs[0])
  240.             bpy.context.object.active_material = material_cosmic
  241.             bpy.context.object.active_material.diffuse_color = c
  242.             bpy.context.object.active_material.metallic = 0.3
  243.        
  244.         if mytool.planet_type == 'OP2':
  245.             material_cosmic2 = bpy.data.materials.new(name= "Continental")
  246.             material_cosmic2.use_nodes = True
  247.             material_cosmic2.node_tree.nodes.remove(material_cosmic2.node_tree.nodes.get('Principled BSDF'))
  248.             material_output = material_cosmic2.node_tree.nodes.get('Material Output')
  249.             material_output.location = (1400,0)
  250.             noise1_node = material_cosmic2.node_tree.nodes.new('ShaderNodeTexNoise')
  251.             noise1_node.location = (-1000,0)
  252.             noise1_node.inputs[2].default_value = self.land_scale
  253.             noise1_node.inputs[3].default_value = 16
  254.             noise1_node.inputs[4].default_value = 0.848
  255.             noise1_node.inputs[5].default_value = 0
  256.             noise2_node = material_cosmic2.node_tree.nodes.new('ShaderNodeTexNoise')
  257.             noise2_node.location = (-800, 0)
  258.             noise2_node.inputs[2].default_value = 12.5
  259.             noise2_node.inputs[3].default_value = 2
  260.             noise2_node.inputs[4].default_value = 0.890
  261.             noise2_node.inputs[5].default_value = 0
  262.             cr1_node = material_cosmic2.node_tree.nodes.new('ShaderNodeValToRGB')
  263.             cr1_node.location = (-900, -200)
  264.             cr1_node.color_ramp.elements[0].position= 0.133
  265.             cr1_node.color_ramp.elements[1].position= self.water_lvl
  266.             cr1_node.color_ramp.elements.new(position= 0.516)
  267.             cr2_node = material_cosmic2.node_tree.nodes.new('ShaderNodeValToRGB')
  268.             cr2_node.location = (-650, -200)
  269.             cr2_node.color_ramp.elements[0].position= 0.505
  270.             cr2_node.color_ramp.elements[1].position= 0.650
  271.             mixrgb_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMixRGB')
  272.             mixrgb_node.location = (-600, 0)
  273.             mixrgb_node.inputs[2].default_value = (0, 0.0202886, 0.502886, 1)
  274.             multiply_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMixRGB')
  275.             multiply_node.location = (-400, 200)
  276.             multiply_node.blend_type = 'BURN'
  277.             multiply_node.inputs[2].default_value = (0.391573, 0.799103, 0, 1)
  278.             hue_node = material_cosmic2.node_tree.nodes.new('ShaderNodeHueSaturation')
  279.             hue_node.location = (-200, 100)
  280.             hue_node.inputs[0].default_value = self.land_hue
  281.             cr3_node = material_cosmic2.node_tree.nodes.new('ShaderNodeValToRGB')
  282.             cr3_node.location = (-400, -200)
  283.             cr3_node.color_ramp.elements[0].position= 0.402
  284.             cr3_node.color_ramp.elements[1].position= 0.418
  285.             overlay_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMixRGB')
  286.             overlay_node.location = (0, 0)
  287.             overlay_node.blend_type = 'LIGHTEN'
  288.             overlay_node.inputs[2].default_value = (0, 0.0152085, 0.0528607, 1)
  289.             emiss1_node = material_cosmic2.node_tree.nodes.new('ShaderNodeEmission')
  290.             emiss1_node.location = (200, 200)
  291.             emiss1_node.inputs[1].default_value = 2.800
  292.             emiss2_node = material_cosmic2.node_tree.nodes.new('ShaderNodeEmission')
  293.             emiss2_node.location = (400, -200)
  294.             emiss2_node.inputs[0].default_value = self.atmos_col
  295.             emiss2_node.inputs[1].default_value = self.atmos_glow
  296.             emiss3_node = material_cosmic2.node_tree.nodes.new('ShaderNodeEmission')
  297.             emiss3_node.location = (400, 0)
  298.             emiss3_node.inputs[0].default_value = (1, 1, 1, 1)
  299.             emiss3_node.inputs[1].default_value = 6.500
  300.             mixs2_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMixShader')
  301.             mixs2_node.location = (600, 0)
  302.             if self.cloud_bool == False:
  303.                 mixs2_node.mute= True
  304.             lweight_node = material_cosmic2.node_tree.nodes.new('ShaderNodeLayerWeight')
  305.             lweight_node.location = (400, 400)
  306.             lweight_node.inputs[0].default_value = 0.370
  307.             cr4_node = material_cosmic2.node_tree.nodes.new('ShaderNodeValToRGB')
  308.             cr4_node.location = (600, 400)
  309.             cr4_node.color_ramp.elements[0].position= 0.056739
  310.             mixs_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMixShader')
  311.             mixs_node.location = (800, 0)
  312.             if self.atmos == False:
  313.                 mixs_node.mute= True
  314.             cr5_node = material_cosmic2.node_tree.nodes.new('ShaderNodeValToRGB')
  315.             cr5_node.location = (-400, -500)
  316.             cr5_node.color_ramp.elements[0].position= 0.540761
  317.             cr5_node.color_ramp.elements[1].position= 0.769022
  318.             cr5_node.color_ramp.elements[1].color = (cv, cv, cv, cv)
  319.             noise3_node = material_cosmic2.node_tree.nodes.new('ShaderNodeTexNoise')
  320.             noise3_node.location = (-600, -500)
  321.             noise3_node.inputs[2].default_value = self.cloud_scale
  322.             noise3_node.inputs[3].default_value = 7.100
  323.             noise3_node.inputs[4].default_value = 0.995
  324.             noise3_node.inputs[5].default_value = 0.8
  325.             mapping_node = material_cosmic2.node_tree.nodes.new('ShaderNodeMapping')
  326.             mapping_node.location = (-800, -500)
  327.             mapping_node.inputs[3].default_value[0] = 0.18
  328.             mapping_node.inputs[3].default_value[1] = 0.18
  329.             mapping_node.inputs[3].default_value[2] = 0.18
  330.             coord_node = material_cosmic2.node_tree.nodes.new('ShaderNodeTexCoord')
  331.             coord_node.location = (-1000, -500)
  332.             link = material_cosmic2.node_tree.links.new
  333.             link(emiss1_node.outputs[0], mixs2_node.inputs[1])
  334.             link(emiss3_node.outputs[0], mixs2_node.inputs[2])
  335.             link(mixs2_node.outputs[0], mixs_node.inputs[1])
  336.             link(emiss2_node.outputs[0], mixs_node.inputs[2])
  337.             link(cr5_node.outputs[0], mixs2_node.inputs[0])
  338.             link(noise3_node.outputs[0], cr5_node.inputs[0])
  339.             link(mapping_node.outputs[0], noise3_node.inputs[0])
  340.             link(coord_node.outputs[0], mapping_node.inputs[0])
  341.             link(cr4_node.outputs[0], mixs_node.inputs[0])
  342.             link(lweight_node.outputs[0], cr4_node.inputs[0])
  343.             link(overlay_node.outputs[0], emiss1_node.inputs[0])
  344.             link(multiply_node.outputs[0], hue_node.inputs[4])
  345.             link(hue_node.outputs[0], overlay_node.inputs[1])
  346.             link(cr3_node.outputs[0], overlay_node.inputs[0])
  347.             link(mixrgb_node.outputs[0], multiply_node.inputs[1])
  348.             link(noise2_node.outputs[0], multiply_node.inputs[0])
  349.             link(cr2_node.outputs[0], mixrgb_node.inputs[1])
  350.             link(noise1_node.outputs[0], mixrgb_node.inputs[0])
  351.             link(noise2_node.outputs[0], cr2_node.inputs[0])
  352.             link(noise2_node.outputs[0], cr3_node.inputs[0])
  353.             link(cr1_node.outputs[0], noise2_node.inputs[0])
  354.             link(noise1_node.outputs[0], cr1_node.inputs[0])
  355.             link(mixs_node.outputs[0], material_output.inputs[0])
  356.             bpy.context.object.active_material = material_cosmic2
  357.             bpy.context.object.active_material.diffuse_color = (0, 1, 0, 1)
  358.             bpy.context.object.active_material.metallic = 0.3
  359.            
  360.         if mytool.planet_type == 'OP3':
  361.             material_cosmic3 = bpy.data.materials.new(name= "Dust World")
  362.             material_cosmic3.use_nodes = True
  363.             material_cosmic3.node_tree.nodes.remove(material_cosmic3.node_tree.nodes.get('Principled BSDF'))
  364.             material_output = material_cosmic3.node_tree.nodes.get('Material Output')
  365.             material_output.location = (1000,0)
  366.             cr1_node = material_cosmic3.node_tree.nodes.new('ShaderNodeValToRGB')
  367.             cr1_node.location = (-300, 500)
  368.             cr1_node.color_ramp.elements[0].position= 0.858544
  369.             cr1_node.color_ramp.elements[1].position= 0.970109
  370.             magic_node = material_cosmic3.node_tree.nodes.new('ShaderNodeTexMagic')
  371.             magic_node.location = (-500, 500)
  372.             magic_node.inputs[1].default_value = self.stripe_amount
  373.             magic_node.inputs[2].default_value = 0.130
  374.             magic_node.turbulence_depth = 1
  375.             mapping_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMapping')
  376.             mapping_node.location = (-700, 500)
  377.             mapping_node.inputs[2].default_value[0] = -42.4
  378.             mapping_node.inputs[2].default_value[1] = 47.6
  379.             mapping_node.inputs[2].default_value[2] = 0
  380.             mapping_node.inputs[3].default_value[0] = 0.6
  381.             coord_node = material_cosmic3.node_tree.nodes.new('ShaderNodeTexCoord')
  382.             coord_node.location = (-900, 500)
  383.             voronoi_node = material_cosmic3.node_tree.nodes.new('ShaderNodeTexVoronoi')
  384.             voronoi_node.location = (-700, 0)
  385.             voronoi_node.feature = 'SMOOTH_F1'
  386.             voronoi_node.distance = 'CHEBYCHEV'
  387.             voronoi_node.inputs[2].default_value = 21.690
  388.             voronoi_node.inputs[3].default_value = 1
  389.             voronoi_node.inputs[4].default_value = 1
  390.             mapping2_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMapping')
  391.             mapping2_node.location = (-900, 0)
  392.             mapping2_node.inputs[3].default_value[0] = 0.140
  393.             coord2_node = material_cosmic3.node_tree.nodes.new('ShaderNodeTexCoord')
  394.             coord2_node.location = (-1100, 0)
  395.             bw_node = material_cosmic3.node_tree.nodes.new('ShaderNodeRGBToBW')
  396.             bw_node.location = (-550, 0)
  397.             multiply1_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixRGB')
  398.             multiply1_node.location = (-400, 200)
  399.             multiply1_node.inputs[0].default_value = 1
  400.             multiply1_node.inputs[2].default_value = (0.552012, 0.130136, 0.0451862, 1)
  401.             multiply1_node.blend_type= 'MULTIPLY'
  402.             multiply2_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixRGB')
  403.             multiply2_node.location = (-400, -200)
  404.             multiply2_node.inputs[0].default_value = 1
  405.             multiply2_node.inputs[2].default_value = (0.187821, 0.0684782, 0, 1)
  406.             multiply2_node.blend_type= 'MULTIPLY'
  407.             mixrgb_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixRGB')
  408.             mixrgb_node.location = (-200, 0)
  409.             overlay_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixRGB')
  410.             overlay_node.location = (0, 0)
  411.             overlay_node.inputs[0].default_value = 0.595
  412.             overlay_node.blend_type= 'OVERLAY'
  413.             darken_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixRGB')
  414.             darken_node.location = (200, 0)
  415.             darken_node.inputs[2].default_value = (0.035037, 0.0133497, 0.00550307, 1)
  416.             darken_node.blend_type= 'MULTIPLY'
  417.             noise1_node = material_cosmic3.node_tree.nodes.new('ShaderNodeTexNoise')
  418.             noise1_node.location = (0, -200)
  419.             noise1_node.inputs[2].default_value = 8.600
  420.             noise1_node.inputs[3].default_value = 16
  421.             noise1_node.inputs[4].default_value = 0.830
  422.             noise1_node.inputs[5].default_value = 0
  423.             cr3_node = material_cosmic3.node_tree.nodes.new('ShaderNodeValToRGB')
  424.             cr3_node.location = (200, -200)
  425.             cr3_node.color_ramp.elements[0].position= 0.366848
  426.             cr3_node.color_ramp.elements[1].position= 0.608695
  427.             hue_node = material_cosmic3.node_tree.nodes.new('ShaderNodeHueSaturation')
  428.             hue_node.location = (400, 200)
  429.             hue_node.inputs[0].default_value = self.d_hue
  430.             emiss1_node = material_cosmic3.node_tree.nodes.new('ShaderNodeEmission')
  431.             emiss1_node.location = (600, 200)
  432.             emiss1_node.inputs[1].default_value = 2.800
  433.             emiss2_node = material_cosmic3.node_tree.nodes.new('ShaderNodeEmission')
  434.             emiss2_node.location = (600, -200)
  435.             emiss2_node.inputs[0].default_value = self.d_atmos_col
  436.             emiss2_node.inputs[1].default_value = self.d_atmos_glow
  437.             lweight_node = material_cosmic3.node_tree.nodes.new('ShaderNodeLayerWeight')
  438.             lweight_node.location = (200, 400)
  439.             lweight_node.inputs[0].default_value= 0.160
  440.             mixs_node = material_cosmic3.node_tree.nodes.new('ShaderNodeMixShader')
  441.             mixs_node.location = (800, 0)
  442.             if self.atmos == False:
  443.                 mixs_node.mute= True
  444.             cr2_node = material_cosmic3.node_tree.nodes.new('ShaderNodeValToRGB')
  445.             cr2_node.location = (500, 400)
  446.             cr2_node.color_ramp.elements[0].position= 0.013587
  447.             cr2_node.color_ramp.elements[1].position= 1
  448.             link = material_cosmic3.node_tree.links.new
  449.             link(voronoi_node.outputs[0], mixrgb_node.inputs[0])
  450.             link(mixrgb_node.outputs[0], overlay_node.inputs[1])
  451.             link(voronoi_node.outputs[0], mapping_node.inputs[0])
  452.             link(mapping2_node.outputs[0], voronoi_node.inputs[0])
  453.             link(coord2_node.outputs[0], mapping2_node.inputs[0])
  454.             link(bw_node.outputs[0], multiply2_node.inputs[1])
  455.             link(bw_node.outputs[0], multiply1_node.inputs[1])
  456.             link(voronoi_node.outputs[1], bw_node.inputs[0])
  457.             link(coord_node.outputs[0], mapping_node.inputs[0])
  458.             link(mapping_node.outputs[0], magic_node.inputs[0])
  459.             link(magic_node.outputs[0], cr1_node.inputs[0])
  460.             link(cr1_node.outputs[0], overlay_node.inputs[2])
  461.             link(multiply2_node.outputs[0], mixrgb_node.inputs[2])
  462.             link(multiply1_node.outputs[0], mixrgb_node.inputs[1])
  463.             link(overlay_node.outputs[0], darken_node.inputs[1])
  464.             link(cr3_node.outputs[0], darken_node.inputs[0])
  465.             link(darken_node.outputs[0], hue_node.inputs[4])
  466.             link(hue_node.outputs[0], emiss1_node.inputs[0])
  467.             link(noise1_node.outputs[0], cr3_node.inputs[0])
  468.             link(lweight_node.outputs[0], cr2_node.inputs[0])
  469.             link(cr2_node.outputs[0], mixs_node.inputs[0])
  470.             link(emiss2_node.outputs[0], mixs_node.inputs[2])
  471.             link(emiss1_node.outputs[0], mixs_node.inputs[1])
  472.             link(mixs_node.outputs[0], material_output.inputs[0])
  473.             bpy.context.object.active_material = material_cosmic3
  474.             bpy.context.object.active_material.diffuse_color = (1, 0.3, 0.004, 1)
  475.             bpy.context.object.active_material.metallic = 0.3
  476.        
  477.         if mytool.planet_type == 'OP6':
  478.             material_cosmic6 = bpy.data.materials.new(name= "Star Sphere")
  479.             material_cosmic6.use_nodes = True
  480.             material_cosmic6.node_tree.nodes.remove(material_cosmic6.node_tree.nodes.get('Principled BSDF'))
  481.             material_output = material_cosmic6.node_tree.nodes.get('Material Output')
  482.             material_output.location = (0,0)
  483.             emiss_node = material_cosmic6.node_tree.nodes.new('ShaderNodeEmission')
  484.             emiss_node.location = (-200,0)
  485.             emiss_node.inputs[0].default_value = (1, 0, 0, 1)
  486.             cr_node = material_cosmic6.node_tree.nodes.new('ShaderNodeValToRGB')
  487.             cr_node.location = (-400,0)
  488.             cr_node.color_ramp.elements[0].position = 0.624
  489.             cr_node.color_ramp.elements[1].position = self.star_coverage
  490.             noise_node = material_cosmic6.node_tree.nodes.new('ShaderNodeTexNoise')
  491.             noise_node.location = (-600, 0)
  492.             noise_node.inputs[2].default_value = self.star_scale
  493.             noise_node.inputs[3].default_value = 16
  494.             noise_node.inputs[4].default_value = 0.740
  495.             noise_node.inputs[5].default_value = 0
  496.             link = material_cosmic6.node_tree.links.new
  497.             link(cr_node.outputs[0], emiss_node.inputs[0])
  498.             link(noise_node.outputs[0], cr_node.inputs[0])
  499.             link(emiss_node.outputs[0], material_output.inputs[0])
  500.             bpy.context.object.active_material = material_cosmic6
  501.             bpy.context.object.active_material.diffuse_color = (0, 0, 0, 1)
  502.             bpy.context.object.active_material.metallic = 0.3
  503.         return {'FINISHED'}
  504.    
  505.     def invoke(self, context, event):
  506.         return context.window_manager.invoke_props_dialog(self, width= 210)
  507.  
  508. class SHADER_OT_DIAMOND(Operator):
  509.     """Open the Diamond Dialog box"""
  510.     bl_label = "             Diamond Operator"
  511.     bl_idname = "wm.diamondop"
  512.     bl_options = {'REGISTER', 'UNDO'}
  513.    
  514.     col : FloatVectorProperty(name='Color Tint',subtype='COLOR_GAMMA',size=4,default=(1,1,1,1), min= 0, max= 1)
  515.    
  516.     def execute(self, context):
  517.         c = self.col
  518.         material_diamond = bpy.data.materials.new(name= "Diamond")
  519.         material_diamond.use_nodes = True
  520.         material_diamond.node_tree.nodes.remove(material_diamond.node_tree.nodes.get('Principled BSDF'))
  521.         material_output = material_diamond.node_tree.nodes.get('Material Output')
  522.         material_output.location = (400,0)
  523.         glass1_node = material_diamond.node_tree.nodes.new('ShaderNodeBsdfGlass')
  524.         glass1_node.location = (-600,0)
  525.         glass1_node.inputs[0].default_value = (1, 0, 0, 1)
  526.         glass1_node.inputs[2].default_value = 1.446
  527.         glass2_node = material_diamond.node_tree.nodes.new('ShaderNodeBsdfGlass')
  528.         glass2_node.location = (-600,-150)
  529.         glass2_node.inputs[0].default_value = (0, 1, 0, 1)
  530.         glass2_node.inputs[2].default_value = 1.450
  531.         glass3_node = material_diamond.node_tree.nodes.new('ShaderNodeBsdfGlass')
  532.         glass3_node.location = (-600,-300)
  533.         glass3_node.inputs[0].default_value = (0, 0, 1, 1)
  534.         glass3_node.inputs[2].default_value = 1.545        
  535.         add1_node = material_diamond.node_tree.nodes.new('ShaderNodeAddShader')
  536.         add1_node.location = (-400,-50)
  537.         add1_node.label = "Add 1"
  538.         add1_node.hide = True
  539.         add1_node.select = False      
  540.         add2_node = material_diamond.node_tree.nodes.new('ShaderNodeAddShader')
  541.         add2_node.location = (-100,0)
  542.         add2_node.label = "Add 2"
  543.         add2_node.hide = True
  544.         add2_node.select = False      
  545.         glass4_node = material_diamond.node_tree.nodes.new('ShaderNodeBsdfGlass')
  546.         glass4_node.location = (-150,-150)
  547.         glass4_node.inputs[2].default_value = 1.450
  548.         glass4_node.select = False      
  549.         mix1_node = material_diamond.node_tree.nodes.new('ShaderNodeMixShader')
  550.         mix1_node.location = (200,0)
  551.         mix1_node.select = False
  552.         material_diamond.node_tree.links.new(glass1_node.outputs[0], add1_node.inputs[0])
  553.         material_diamond.node_tree.links.new(glass2_node.outputs[0], add1_node.inputs[1])
  554.         material_diamond.node_tree.links.new(add1_node.outputs[0], add2_node.inputs[0])
  555.         material_diamond.node_tree.links.new(glass3_node.outputs[0], add2_node.inputs[1])
  556.         material_diamond.node_tree.links.new(add2_node.outputs[0], mix1_node.inputs[1])
  557.         material_diamond.node_tree.links.new(glass4_node.outputs[0], mix1_node.inputs[2])
  558.         material_diamond.node_tree.links.new(mix1_node.outputs[0], material_output.inputs[0])
  559.         bpy.context.object.active_material = material_diamond
  560.         bpy.context.object.active_material.diffuse_color = c
  561.         bpy.context.object.active_material.metallic = 0.3
  562.         if context.scene.render.engine == 'BLENDER_EEVEE':
  563.             context.object.active_material.blend_method = 'HASHED'
  564.         return {'FINISHED'}
  565.    
  566.     def invoke(self, context, event):
  567.         return context.window_manager.invoke_props_dialog(self, width= 210)
  568.  
  569.  
  570. class SHADER_OT_GOLD(Operator):
  571.     """Add the Basic Gold Shader to your selected Object."""
  572.     bl_label = "Gold"
  573.     bl_idname = 'shader.gold_operator'
  574.     bl_options = {'REGISTER', 'UNDO'}
  575.    
  576.     roughness : FloatProperty(name='Roughness', default= 0.5, min= 0, max= 1)
  577.     preset_bool : BoolProperty(name= "Set Roughness", default= False)
  578.    
  579.     def draw(self, context):
  580.         layout= self.layout
  581.         layout.separator(factor= 0.1)
  582.         box = layout.box()
  583.         box.prop(self, "preset_bool")
  584.         if self.preset_bool == True:
  585.             box.label(text= "0 - Glossy                              1 - Rough")
  586.             box.prop(self, "roughness", slider= True)
  587.         layout.separator(factor= 1)    
  588.    
  589.     def execute(self, context):
  590.         r = self.roughness
  591.         material_gold = bpy.data.materials.new(name= "Gold")
  592.         material_gold.use_nodes = True
  593.         material_output = material_gold.node_tree.nodes.get('Material Output')
  594.         material_output.location = (600,0)
  595.         material_output.select = False    
  596.         rgb_node = material_gold.node_tree.nodes.new('ShaderNodeRGB')
  597.         rgb_node.location = (0,-100)
  598.         rgb_node.outputs[0].default_value = (1, 0.766, 0.336, 1)
  599.         rgb_node.select = False
  600.         rgb_node.hide = True
  601.         principled = material_gold.node_tree.nodes.get('Principled BSDF')
  602.         principled.location = (200,0)
  603.         principled.select = False
  604.         principled.inputs[4].default_value = 1
  605.         principled.inputs[7].default_value = r
  606.         material_gold.node_tree.links.new(rgb_node.outputs[0], principled.inputs[0])
  607.         bpy.context.object.active_material = material_gold
  608.         bpy.context.object.active_material.diffuse_color = (1, 0.766, 0.336, 1)
  609.         bpy.context.object.active_material.metallic = 0.45082
  610.         return {'FINISHED'}
  611.    
  612.     def invoke(self, context, event):
  613.         return context.window_manager.invoke_props_dialog(self, width= 210)
  614.  
  615.  
  616. class SHADER_OT_SILVER(Operator):
  617.     """Add the Basic Silver Shader to your selected Object."""
  618.     bl_label = "Silver"
  619.     bl_idname = 'shader.silver_operator'
  620.     bl_options = {'REGISTER', 'UNDO'}
  621.    
  622.     roughness : FloatProperty(name='Roughness', default= 0.5, min= 0, max= 1)
  623.     preset_bool : BoolProperty(name= "Set Roughness", default= False)
  624.    
  625.     def draw(self, context):
  626.         layout= self.layout
  627.         layout.separator(factor= 0.1)
  628.         box = layout.box()
  629.         box.prop(self, "preset_bool")
  630.         if self.preset_bool == True:
  631.             box.label(text= "0 - Glossy                              1 - Rough")
  632.             box.prop(self, "roughness", slider= True)
  633.         layout.separator(factor= 1)    
  634.    
  635.     def execute(self, context):
  636.         r = self.roughness
  637.         material_silver = bpy.data.materials.new(name= "Silver")
  638.         material_silver.use_nodes = True
  639.         material_output = material_silver.node_tree.nodes.get('Material Output')
  640.         material_output.location = (600,0)
  641.         material_output.select = False      
  642.         rgb_node = material_silver.node_tree.nodes.new('ShaderNodeRGB')
  643.         rgb_node.location = (0,-100)
  644.         rgb_node.outputs[0].default_value = (0.972, 0.960, 0.915, 1)
  645.         rgb_node.select = False
  646.         rgb_node.hide = True
  647.         principled = material_silver.node_tree.nodes.get('Principled BSDF')
  648.         principled.location = (200,0)
  649.         principled.select = False
  650.         principled.inputs[4].default_value = 1.0
  651.         principled.inputs[7].default_value = r
  652.         material_silver.node_tree.links.new(rgb_node.outputs[0], principled.inputs[0])
  653.         bpy.context.object.active_material = material_silver
  654.         bpy.context.object.active_material.diffuse_color = (0.972, 0.960, 0.915, 1)
  655.         bpy.context.object.active_material.metallic = 0.45082
  656.         return {'FINISHED'}
  657.    
  658.     def invoke(self, context, event):
  659.         return context.window_manager.invoke_props_dialog(self, width= 210)
  660.  
  661.  
  662. class SHADER_OT_COPPER(Operator):
  663.     """Add the Basic Copper Shader to your selected Object."""
  664.     bl_label = "Copper"
  665.     bl_idname = 'shader.copper_operator'
  666.     bl_options = {'REGISTER', 'UNDO'}
  667.    
  668.     roughness : FloatProperty(name='Roughness', default= 0.5, min= 0, max= 1)
  669.     preset_bool : BoolProperty(name= "Set Roughness", default= False)
  670.    
  671.     def draw(self, context):
  672.         layout= self.layout
  673.         layout.separator(factor= 0.1)
  674.         box = layout.box()
  675.         box.prop(self, "preset_bool")
  676.         if self.preset_bool == True:
  677.             box.label(text= "0 - Glossy                              1 - Rough")
  678.             box.prop(self, "roughness", slider= True)
  679.         layout.separator(factor= 1)    
  680.    
  681.     def execute(self, context):
  682.         r = self.roughness
  683.         material_copper = bpy.data.materials.new(name= "Copper")
  684.         material_copper.use_nodes = True
  685.         material_output = material_copper.node_tree.nodes.get('Material Output')
  686.         material_output.location = (600,0)
  687.         material_output.select = False    
  688.         rgb_node = material_copper.node_tree.nodes.new('ShaderNodeRGB')
  689.         rgb_node.location = (0,-100)
  690.         rgb_node.outputs[0].default_value = (0.955, 0.637, 0.538, 1)
  691.         rgb_node.select = False
  692.         rgb_node.hide = True
  693.         principled = material_copper.node_tree.nodes.get('Principled BSDF')
  694.         principled.location = (200,0)
  695.         principled.select = False
  696.         principled.inputs[4].default_value = 1.0
  697.         principled.inputs[7].default_value = r
  698.         material_copper.node_tree.links.new(rgb_node.outputs[0], principled.inputs[0])
  699.         bpy.context.object.active_material = material_copper
  700.         bpy.context.object.active_material.diffuse_color = (0.955, 0.637, 0.538, 1)
  701.         bpy.context.object.active_material.metallic = 0.45082
  702.         return {'FINISHED'}
  703.    
  704.     def invoke(self, context, event):
  705.         return context.window_manager.invoke_props_dialog(self, width= 210)
  706.  
  707.  
  708. class WM_OT_ghostOp(Operator):
  709.     """Open the Ghost Dialog box"""
  710.     bl_label = "                  Ghost Operator"
  711.     bl_idname = "wm.ghostop"
  712.     bl_options = {'REGISTER', 'UNDO'}
  713.    
  714.     col1 : FloatVectorProperty(name='Outer Color',subtype='COLOR_GAMMA',size=4,default=(0.224322, 0.812741, 1, 1), min= 0, max= 1)
  715.     col2 : FloatVectorProperty(name='Inner Color',subtype='COLOR_GAMMA',size=4,default=(0.137478, 0.345533, 1, 1), min= 0, max= 1)
  716.     trans : FloatProperty(min= 0, max= 1, default= 0.5, description= "Transparancy Value. At 0 the Shader will still have some transparancy but at 1 the Shader will fully Transparent")
  717.     enable_bool : BoolProperty(default= False, description= "This Option will add a subtle effect to the shader. The Whole Object will be Visible through itself.")
  718.    
  719.     def draw(self, context):
  720.         layout = self.layout
  721.         layout.separator(factor=2)
  722.         layout.prop(self, "col1")
  723.         layout.prop(self, "col2")
  724.         layout.prop(self, "trans", text= "Transparency:", slider= True)
  725.         if context.scene.render.engine == 'CYCLES':
  726.             layout.separator(factor=0.5)
  727.             box = layout.box()
  728.             box.prop(self, "enable_bool", text= "Variant")
  729.             if self.enable_bool == True:
  730.                 box.label(text= "This Option will add a subtle effect")
  731.                 box.label(text= "to the shader. ")
  732.                 box.label(text= "The Whole Object will be Visible.")
  733.         layout.separator(factor=1)
  734.    
  735.     def execute(self, context):
  736.         c1 = self.col1
  737.         c2 = self.col2
  738.         a = self.trans
  739.         material_ghost = bpy.data.materials.new(name= "Ghost")
  740.         material_ghost.use_nodes = True
  741.         material_output = material_ghost.node_tree.nodes.get('Material Output')
  742.         material_output.location = (1000,0)
  743.         material_output.select = False
  744.         material_ghost.node_tree.nodes.remove(material_ghost.node_tree.nodes.get('Principled BSDF'))      
  745.         emiss_node = material_ghost.node_tree.nodes.new('ShaderNodeEmission')
  746.         emiss_node.location = (-200,-90)
  747.         emiss_node.inputs[0].default_value = c1
  748.         emiss_node.inputs[1].default_value = 2
  749.         emiss_node.select = False        
  750.         trans_node = material_ghost.node_tree.nodes.new('ShaderNodeBsdfTransparent')
  751.         trans_node.location = (-200,10)
  752.         trans_node.inputs[0].default_value = c2
  753.         trans_node.select = False      
  754.         mix_node = material_ghost.node_tree.nodes.new('ShaderNodeMixShader')
  755.         mix_node.location = (400,50)
  756.         mix_node.select = False      
  757.         layerw_node = material_ghost.node_tree.nodes.new('ShaderNodeLayerWeight')
  758.         layerw_node.location = (0,150)
  759.         layerw_node.inputs[0].default_value = 0.1
  760.         layerw_node.select = False      
  761.         math_node = material_ghost.node_tree.nodes.new('ShaderNodeMath')
  762.         math_node.location = (200,100)
  763.         math_node.inputs[0].default_value = 0.1
  764.         math_node.select = False
  765.         math_node.hide = True      
  766.         mix2_node = material_ghost.node_tree.nodes.new('ShaderNodeMixShader')
  767.         mix2_node.location = (800,50)
  768.         mix2_node.select = False      
  769.         trans2_node = material_ghost.node_tree.nodes.new('ShaderNodeBsdfTransparent')
  770.         trans2_node.location = (500,-100)
  771.         trans2_node.inputs[0].default_value = (1, 1, 1, 1)
  772.         trans2_node.select = False      
  773.         light_node = material_ghost.node_tree.nodes.new('ShaderNodeLightPath')
  774.         light_node.location = (500,500)
  775.         light_node.select = False
  776.         colramp_node = material_ghost.node_tree.nodes.new('ShaderNodeValToRGB')
  777.         colramp_node.location = (700, 200)
  778.         colramp_node.select = False
  779.         colramp_node.color_ramp.elements[0].color = (a, a, a, 1)
  780.         if self.enable_bool == True:
  781.             colramp_node.color_ramp.elements[1].color = (0.85, 0.85, 0.85, 1)
  782.         material_ghost.node_tree.links.new(trans_node.outputs[0], mix_node.inputs[1])
  783.         material_ghost.node_tree.links.new(emiss_node.outputs[0], mix_node.inputs[2])
  784.         material_ghost.node_tree.links.new(layerw_node.outputs[0], math_node.inputs[0])
  785.         material_ghost.node_tree.links.new(layerw_node.outputs[1], math_node.inputs[1])
  786.         material_ghost.node_tree.links.new(math_node.outputs[0], mix_node.inputs[0])
  787.         material_ghost.node_tree.links.new(mix_node.outputs[0], mix2_node.inputs[1])
  788.         material_ghost.node_tree.links.new(trans2_node.outputs[0], mix2_node.inputs[2])
  789.         material_ghost.node_tree.links.new(light_node.outputs[11], colramp_node.inputs[0])
  790.         material_ghost.node_tree.links.new(colramp_node.outputs[0], mix2_node.inputs[0])
  791.         material_ghost.node_tree.links.new(mix2_node.outputs[0], material_output.inputs[0])
  792.         bpy.context.object.active_material = material_ghost
  793.         bpy.context.object.active_material.diffuse_color = c1
  794.         if context.scene.render.engine == 'BLENDER_EEVEE':
  795.             context.object.active_material.blend_method = 'HASHED'
  796.         return {'FINISHED'}
  797.    
  798.     def invoke(self, context, event):
  799.         return context.window_manager.invoke_props_dialog(self, width= 200)
  800.  
  801.  
  802. class WM_OT_hologramOp(Operator):
  803.     """Open the Hologram Dialog box"""
  804.     bl_label = "       Hologram Operator"
  805.     bl_idname = "wm.hologramop"
  806.     bl_options = {'REGISTER', 'UNDO'}
  807.    
  808.     col1 : FloatVectorProperty(name='Color 1',subtype='COLOR_GAMMA',size=4,default=(0.0927682, 1, 0.566671, 1), min= 0, max= 1)
  809.     col2 : FloatVectorProperty(name='Color 2',subtype='COLOR_GAMMA',size=4,default=(0.381055, 1, 0.697353, 1), min= 0, max= 1)
  810.     wire_amount : FloatProperty(default= 0.050, min= 0, soft_max= 1)
  811.    
  812.     def draw(self, context):
  813.         layout = self.layout
  814.         layout.separator(factor=2)
  815.         layout.prop(self, "col1")
  816.         layout.prop(self, "col2")
  817.         layout.prop(self, "wire_amount", slider= True, text= "Wireframe Size:")
  818.         layout.separator(factor=1)
  819.    
  820.     def execute(self, context):
  821.         c1 = self.col1
  822.         c2 = self.col2
  823.         material_hologram = bpy.data.materials.new(name= "Hologram")
  824.         material_hologram.use_nodes = True
  825.         material_output = material_hologram.node_tree.nodes.get('Material Output')
  826.         material_output.location = (1000,0)
  827.         material_output.select = False
  828.         material_hologram.node_tree.nodes.remove(material_hologram.node_tree.nodes.get('Principled BSDF'))    
  829.         emiss_node = material_hologram.node_tree.nodes.new('ShaderNodeEmission')
  830.         emiss_node.location = (-200,-90)
  831.         emiss_node.inputs[0].default_value = c1        
  832.         emiss_node.inputs[1].default_value = 2
  833.         emiss_node.select = False  
  834.         trans1_node = material_hologram.node_tree.nodes.new('ShaderNodeBsdfTransparent')
  835.         trans1_node.location = (-200,10)
  836.         trans1_node.inputs[0].default_value = c2
  837.         trans1_node.select = False      
  838.         mix1_node = material_hologram.node_tree.nodes.new('ShaderNodeMixShader')
  839.         mix1_node.location = (400,50)
  840.         mix1_node.select = False        
  841.         layerw_node = material_hologram.node_tree.nodes.new('ShaderNodeLayerWeight')
  842.         layerw_node.location = (0,150)
  843.         layerw_node.inputs[0].default_value = 0.1
  844.         layerw_node.select = False      
  845.         math_node = material_hologram.node_tree.nodes.new('ShaderNodeMath')
  846.         math_node.location = (200,100)
  847.         math_node.inputs[0].default_value = 0.1
  848.         math_node.select = False
  849.         math_node.hide = True      
  850.         mix2_node = material_hologram.node_tree.nodes.new('ShaderNodeMixShader')
  851.         mix2_node.location = (600,50)
  852.         mix2_node.select = False      
  853.         wire_node = material_hologram.node_tree.nodes.new('ShaderNodeWireframe')
  854.         wire_node.location = (100,200)
  855.         wire_node.select = False
  856.         wire_node.use_pixel_size = True
  857.         wire_node.inputs[0].default_value = self.wire_amount
  858.         reroute = material_hologram.node_tree.nodes.new('NodeReroute')
  859.         reroute.location = (-150,-90)
  860.         material_hologram.node_tree.links.new(trans1_node.outputs[0], mix1_node.inputs[1])
  861.         material_hologram.node_tree.links.new(emiss_node.outputs[0], reroute.inputs[0])
  862.         material_hologram.node_tree.links.new(reroute.outputs[0], mix1_node.inputs[2])
  863.         material_hologram.node_tree.links.new(reroute.outputs[0], mix2_node.inputs[2])
  864.         material_hologram.node_tree.links.new(layerw_node.outputs[0], math_node.inputs[0])
  865.         material_hologram.node_tree.links.new(layerw_node.outputs[1], math_node.inputs[1])
  866.         material_hologram.node_tree.links.new(math_node.outputs[0], mix1_node.inputs[0])
  867.         material_hologram.node_tree.links.new(mix1_node.outputs[0], mix2_node.inputs[1])
  868.         material_hologram.node_tree.links.new(wire_node.outputs[0], mix2_node.inputs[0])
  869.         material_hologram.node_tree.links.new(mix2_node.outputs[0], material_output.inputs[0])
  870.         bpy.context.object.active_material = material_hologram
  871.         bpy.context.object.active_material.diffuse_color = c1
  872.         if context.scene.render.engine == 'BLENDER_EEVEE':
  873.             context.object.active_material.blend_method = 'HASHED'
  874.         return {'FINISHED'}
  875.    
  876.     def invoke(self, context, event):
  877.         return context.window_manager.invoke_props_dialog(self, width= 180)
  878.  
  879.  
  880. class WM_OT_neonOp(Operator):
  881.     """Open the Neon Dialog box"""
  882.     bl_label = "         Neon Operator"
  883.     bl_idname = "wm.neonop"
  884.     bl_options = {'REGISTER', 'UNDO'}
  885.    
  886.     col : FloatVectorProperty(name='Color',subtype='COLOR_GAMMA',size=4,default=(0.269619, 0.601632, 0.8, 1), min= 0, max= 1)
  887.    
  888.     def execute(self, context):
  889.         c = self.col
  890.         cur_frame = bpy.context.scene.frame_current
  891.         material_neon = bpy.data.materials.new(name= "Neon")
  892.         material_neon.use_nodes = True
  893.         tree = material_neon.node_tree
  894.         material_neon.node_tree.nodes.remove(material_neon.node_tree.nodes.get('Principled BSDF'))
  895.         material_output = material_neon.node_tree.nodes.get('Material Output')
  896.         material_output.location = (400,0)
  897.         emiss_node = material_neon.node_tree.nodes.new('ShaderNodeEmission')
  898.         emiss_node.location = (200,0)
  899.         emiss_node.inputs[0].default_value = c
  900.         emiss_node.inputs[1].default_value = 1.5
  901.         emiss_node.inputs[1].keyframe_insert("default_value", frame= cur_frame)
  902.         data_path = f'nodes["{emiss_node.name}"].inputs[1].default_value'
  903.         fcurves = tree.animation_data.action.fcurves
  904.         fc = fcurves.find(data_path)
  905.         if fc:
  906.             new_mod = fc.modifiers.new('NOISE')
  907.             new_mod.strength = 10
  908.             new_mod.depth = 1
  909.         material_neon.node_tree.links.new(emiss_node.outputs[0], material_output.inputs[0])
  910.         bpy.context.object.active_material = material_neon
  911.         bpy.context.object.active_material.diffuse_color = c
  912.         return {'FINISHED'}
  913.    
  914.     def invoke(self, context, event):
  915.         return context.window_manager.invoke_props_dialog(self, width= 150)
  916.  
  917.  
  918. class WM_OT_potionOp(Operator):
  919.     """Open the Stylized Potion Dialog box"""
  920.     bl_label = "                       Stylized Potion Operator"
  921.     bl_idname = "wm.potionop"
  922.     bl_options = {'REGISTER', 'UNDO'}
  923.    
  924.     col1 : FloatVectorProperty(name='',subtype='COLOR_GAMMA',size=4,default=(1, 0, 0.0018755, 1), min= 0, max= 1, description= "Select the First Color")
  925.     col2 : FloatVectorProperty(name='',subtype='COLOR_GAMMA',size=4,default=(0.255103, 0, 0.000564289, 1), min= 0, max= 1, description= "Select the Second Color")
  926.     animate : BoolProperty(name= "Animate Shader", default= False, description= "Enable the Animation for the Shader")
  927.     start : IntProperty(name= "Start Frame", default = 0, description= "Set the Start Frame for your animation")
  928.     end : IntProperty(name= "End Frame", default = 250, description= "Set the End Frame for your Animation")
  929.    
  930.     def invoke(self, context, event):
  931.         return context.window_manager.invoke_props_dialog(self)
  932.    
  933.     def draw(self, context):
  934.         layout = self.layout
  935.         layout.separator(factor= 2)
  936.         row= layout.row()
  937.         split = row.split(factor= 0.7)
  938.         split.label(text= "                                             Color 1: ")
  939.         split.prop(self, "col1")
  940.         row= layout.row()
  941.         split = row.split(factor= 0.7)
  942.         split.label(text= "                                             Color 2:" )
  943.         split.prop(self, "col2")  
  944.         row= layout.row()
  945.         row.separator(factor= 2)
  946.         box = layout.box()
  947.         row = box.row()
  948.         row.prop(self, "animate")
  949.         if self.animate == False:
  950.             row.label(text= "(Shader is Not Animated)")
  951.         if self.animate == True:
  952.             row.label(text= "(Shader is Animated)")  
  953.             row = box.row()  
  954.             box.prop(self, "start")
  955.             box.prop(self, "end")
  956.         layout.separator(factor= 1)
  957.    
  958.     def execute(self, context):
  959.         s = self.start
  960.         e = self.end
  961.         c1 = self.col1
  962.         c2 = self.col2
  963.         a = self.animate
  964.         m1 = " : (animated)"
  965.         if a == True:    
  966.             material_potion = bpy.data.materials.new(name= "Stylized Potion" + m1)
  967.         else:
  968.             material_potion = bpy.data.materials.new(name= "Stylized Potion")    
  969.         material_potion.use_nodes = True
  970.         tree = material_potion.node_tree
  971.         prin_node = material_potion.node_tree.nodes.get('Principled BSDF')
  972.         prin_node.location = (200,0)
  973.         prin_node.inputs[0].default_value = (0.8, 0.000897912, 0, 1)
  974.         prin_node.inputs[3].default_value = (0.8, 0.1332, 0.0936454, 1)
  975.         prin_node.inputs[7].default_value = 0.076
  976.         prin_node.inputs[15].default_value = 0.947
  977.         material_output = material_potion.node_tree.nodes.get('Material Output')
  978.         material_output.location = (500,0)
  979.         rgb1_node = material_potion.node_tree.nodes.new('ShaderNodeRGB')
  980.         rgb1_node.location = (-200,0)
  981.         rgb1_node.outputs[0].default_value = c1  
  982.         rgb2_node = material_potion.node_tree.nodes.new('ShaderNodeRGB')
  983.         rgb2_node.location = (-200,-200)
  984.         rgb2_node.outputs[0].default_value = c2
  985.         mix_node = material_potion.node_tree.nodes.new('ShaderNodeMixRGB')
  986.         mix_node.location = (0,0)
  987.         noise_node = material_potion.node_tree.nodes.new('ShaderNodeTexNoise')
  988.         noise_node.location = (-500, 200)
  989.         noise_node.inputs[2].default_value = 5
  990.         noise_node.inputs[3].default_value = 5
  991.         noise_node.inputs[5].default_value = 0.2
  992.         if a == True:
  993.             noise_node.inputs[5].keyframe_insert("default_value", frame= s-150)
  994.             noise_node.inputs[5].default_value = 1.2
  995.             noise_node.inputs[5].keyframe_insert("default_value", frame= e+50)
  996.         ramp_node = material_potion.node_tree.nodes.new('ShaderNodeValToRGB')
  997.         ramp_node.location = (-300, 200)
  998.         ramp_node.color_ramp.elements[0].position = 0.454
  999.         ramp_node.color_ramp.elements[1].position = 0.522
  1000.         link = material_potion.node_tree.links.new
  1001.         link(rgb1_node.outputs[0], mix_node.inputs[1])
  1002.         link(rgb2_node.outputs[0], mix_node.inputs[2])
  1003.         link(noise_node.outputs[0], ramp_node.inputs[0])
  1004.         link(ramp_node.outputs[0], mix_node.inputs[0])
  1005.         link(mix_node.outputs[0], prin_node.inputs[0])
  1006.         link(prin_node.outputs[0], material_output.inputs[0])
  1007.         bpy.context.object.active_material = material_potion
  1008.         bpy.context.object.active_material.diffuse_color = c1
  1009.         return {'FINISHED'}
  1010.  
  1011.  
  1012. class SHADER_OT_LEATHER(Operator):
  1013.     """Open the Leather Shader Dialog box"""
  1014.     bl_label = "             Leather Operator"
  1015.     bl_idname = "wm.leatherop"
  1016.     bl_options = {'REGISTER', 'UNDO'}
  1017.    
  1018.     col : FloatVectorProperty(name='Color',subtype='COLOR_GAMMA',size=4,default=(0.123239, 0.071147, 0.0570714, 1), min= 0, max= 1)
  1019.    
  1020.     def execute(self, context):
  1021.         c = self.col
  1022.         material_leather = bpy.data.materials.new(name= "Leather")
  1023.         material_leather.use_nodes = True
  1024.         principled = material_leather.node_tree.nodes.get('Principled BSDF')
  1025.         principled.inputs[0].default_value = c
  1026.         principled.inputs[5].default_value = 0.161
  1027.         principled.inputs[7].default_value = 0.367
  1028.         material_output = material_leather.node_tree.nodes.get('Material Output')
  1029.         material_output.location = (400,0)
  1030.         mus_node = material_leather.node_tree.nodes.new('ShaderNodeTexMusgrave')
  1031.         mus_node.location = (-600,0)
  1032.         mus_node.musgrave_type = 'MULTIFRACTAL'
  1033.         mus_node.inputs[2].default_value = 148
  1034.         mus_node.inputs[3].default_value = 12.6
  1035.         mus_node.inputs[4].default_value = 92
  1036.         mus_node.inputs[5].default_value = 2.3
  1037.         disp_node = material_leather.node_tree.nodes.new('ShaderNodeDisplacement')
  1038.         disp_node.location = (-400,0)
  1039.         disp_node.inputs[2].default_value= 0.190
  1040.         material_leather.node_tree.links.new(mus_node.outputs[0], disp_node.inputs[0])
  1041.         material_leather.node_tree.links.new(disp_node.outputs[0], material_output.inputs[2])
  1042.         bpy.context.object.active_material = material_leather
  1043.         bpy.context.object.active_material.diffuse_color = c
  1044.         bpy.context.object.active_material.metallic = 0.3
  1045.         return {'FINISHED'}
  1046.    
  1047.     def invoke(self, context, event):
  1048.         return context.window_manager.invoke_props_dialog(self, width= 210)
  1049.  
  1050.  
  1051. class SHADER_OT_CLOUD(Operator):
  1052.     """Add the Basic Cloud Shader to your selected Object."""
  1053.     bl_label = "Cloud"
  1054.     bl_idname = 'shader.cloud_operator'
  1055.     bl_options = {'REGISTER', 'UNDO'}
  1056.    
  1057.     def execute(self, context):
  1058.         material_cloud = bpy.data.materials.new(name= "Clouds")
  1059.         material_cloud.use_nodes = True
  1060.         material_output = material_cloud.node_tree.nodes.get('Material Output')
  1061.         material_output.location = (100,0)
  1062.         material_output.select = False
  1063.         material_cloud.node_tree.nodes.remove(material_cloud.node_tree.nodes.get('Principled BSDF'))
  1064.         volume_node = material_cloud.node_tree.nodes.new('ShaderNodeVolumePrincipled')
  1065.         volume_node.location = (-200,0)
  1066.         volume_node.select = False
  1067.         colramp_node = material_cloud.node_tree.nodes.new('ShaderNodeValToRGB')
  1068.         colramp_node.location = (-500,0)
  1069.         colramp_node.color_ramp.elements[0].position = 0.503798
  1070.         colramp_node.color_ramp.elements[1].position = 0.58481
  1071.         noise_node = material_cloud.node_tree.nodes.new('ShaderNodeTexNoise')
  1072.         noise_node.location = (-700,0)
  1073.         noise_node.inputs[2].default_value = 1
  1074.         noise_node.inputs[3].default_value = 20
  1075.         mapping_node = material_cloud.node_tree.nodes.new('ShaderNodeMapping')
  1076.         mapping_node.location = (-900, 0)
  1077.         coord_node = material_cloud.node_tree.nodes.new('ShaderNodeTexCoord')
  1078.         coord_node.location = (-1100,0)
  1079.         material_cloud.node_tree.links.new(colramp_node.outputs[0], volume_node.inputs[2])
  1080.         material_cloud.node_tree.links.new(noise_node.outputs[1], colramp_node.inputs[0])
  1081.         material_cloud.node_tree.links.new(mapping_node.outputs[0], noise_node.inputs[0])
  1082.         material_cloud.node_tree.links.new(coord_node.outputs[3], mapping_node.inputs[0])
  1083.         material_cloud.node_tree.links.new(volume_node.outputs[0], material_output.inputs[1])
  1084.         bpy.context.object.active_material = material_cloud
  1085.         return {'FINISHED'}
  1086.  
  1087.  
  1088. class SHADER_OT_SCIFIGOLD(Operator):
  1089.     """Add the Basic Scifi Gold Shader to your selected Object."""
  1090.     bl_label = "Sci-fi Gold"
  1091.     bl_idname = 'shader.scifigold_operator'
  1092.     bl_options = {'REGISTER', 'UNDO'}
  1093.    
  1094.     def execute(self, context):
  1095.         material_scifigold = bpy.data.materials.new(name= "Sci-fi Gold")
  1096.         material_scifigold.use_nodes = True
  1097.         material_output = material_scifigold.node_tree.nodes.get('Material Output')
  1098.         material_output.location = (600,0)
  1099.         material_output.select = False      
  1100.         rgb_node = material_scifigold.node_tree.nodes.new('ShaderNodeRGB')
  1101.         rgb_node.location = (-200,0)
  1102.         rgb_node.outputs[0].default_value = (1, 0.766, 0.336, 1)
  1103.         rgb_node.select = False
  1104.         rgb_node.hide = True
  1105.         principled = material_scifigold.node_tree.nodes.get('Principled BSDF')
  1106.         principled.location = (200,0)
  1107.         principled.select = False
  1108.         principled.inputs[4].default_value = 1.0
  1109.         bump_node = material_scifigold.node_tree.nodes.new('ShaderNodeBump')
  1110.         bump_node.location = (0, -600)
  1111.         bump_node.inputs[0].default_value = 0.270
  1112.         brick_node = material_scifigold.node_tree.nodes.new('ShaderNodeTexBrick')
  1113.         brick_node.location = (-400, -600)
  1114.         noise_node = material_scifigold.node_tree.nodes.new('ShaderNodeTexNoise')
  1115.         noise_node.location = (-600, -800)
  1116.         colramp_node = material_scifigold.node_tree.nodes.new('ShaderNodeValToRGB')
  1117.         colramp_node.location = (-100, -300)
  1118.         colramp_node.color_ramp.elements[0].color = (0.293851, 0.293851, 0.293851, 1)
  1119.         colramp_node.color_ramp.elements[1].color = (0.373086, 0.373086, 0.373086, 1)
  1120.         mix_node = material_scifigold.node_tree.nodes.new('ShaderNodeMixRGB')
  1121.         mix_node.location = (0, 0)
  1122.         mix_node.blend_type = 'MULTIPLY'
  1123.         mix_node.inputs[2].default_value = (0.412679, 0.412679, 0.412679, 1)
  1124.         mix_node.use_clamp = True
  1125.         link = material_scifigold.node_tree.links.new
  1126.         link(mix_node.outputs[0], principled.inputs[0])
  1127.         link(rgb_node.outputs[0], mix_node.inputs[1])
  1128.         link(colramp_node.outputs[0], principled.inputs[7])
  1129.         link(bump_node.outputs[0], principled.inputs[19])
  1130.         link(brick_node.outputs[0], bump_node.inputs[2])
  1131.         link(brick_node.outputs[1], colramp_node.inputs[0])
  1132.         link(brick_node.outputs[1], mix_node.inputs[0])
  1133.         link(noise_node.outputs[0], brick_node.inputs[0])
  1134.         bpy.context.object.active_material = material_scifigold
  1135.         return {'FINISHED'}
  1136.  
  1137.  
  1138. class SHADER_OT_BRICK(Operator):
  1139.     """Add the Basic Brick Shader to your selected Object."""
  1140.     bl_label = "Brick"
  1141.     bl_idname = 'shader.brick_operator'
  1142.     bl_options = {'REGISTER', 'UNDO'}
  1143.    
  1144.     def execute(self, context):
  1145.         material_brick = bpy.data.materials.new(name= "Brick")
  1146.         material_brick.use_nodes = True
  1147.         material_output = material_brick.node_tree.nodes.get('Material Output')
  1148.         material_output.location = (600,0)
  1149.         material_output.select = False      
  1150.         rgb_node = material_brick.node_tree.nodes.new('ShaderNodeRGB')
  1151.         rgb_node.location = (-400,0)
  1152.         rgb_node.outputs[0].default_value = (1, 0.90445, 0.70086, 1)
  1153.         rgb_node.select = False
  1154.         rgb_node.hide = True
  1155.         principled = material_brick.node_tree.nodes.get('Principled BSDF')
  1156.         principled.location = (200,0)
  1157.         principled.select = False
  1158.         principled.inputs[7].default_value = 0.796203
  1159.         bump_node = material_brick.node_tree.nodes.new('ShaderNodeBump')
  1160.         bump_node.location = (0, -600)
  1161.         bump_node.inputs[0].default_value = 0.5
  1162.         brick_node = material_brick.node_tree.nodes.new('ShaderNodeTexBrick')
  1163.         brick_node.location = (-400, -600)
  1164.         brick_node.inputs[4].default_value = 2.9
  1165.         brick_node.inputs[5].default_value = 0.01
  1166.         noise_node = material_brick.node_tree.nodes.new('ShaderNodeTexNoise')
  1167.         noise_node.location = (-400, -200)
  1168.         noise_node.inputs[1].default_value = -9.740
  1169.         noise_node.inputs[2].default_value = 4.5
  1170.         noise_node.inputs[3].default_value = 0
  1171.         mix_node = material_brick.node_tree.nodes.new('ShaderNodeMixRGB')
  1172.         mix_node.location = (0, 0)
  1173.         mix_node.blend_type = 'MULTIPLY'
  1174.         mix_node.inputs[2].default_value = (0.440389, 0.440389, 0.440389, 1)
  1175.         mix_node.use_clamp = True
  1176.         mix2_node = material_brick.node_tree.nodes.new('ShaderNodeMixRGB')
  1177.         mix2_node.location = (-200, 0)
  1178.         mix_node.use_clamp = True
  1179.         mix_node.inputs[0].default_value = 0.4
  1180.         coord_node = material_brick.node_tree.nodes.new('ShaderNodeTexCoord')
  1181.         coord_node.location = (-1000,-600)
  1182.         mapping_node = material_brick.node_tree.nodes.new('ShaderNodeMapping')
  1183.         mapping_node.location = (-800,-600)
  1184.         mapping_node.inputs[3].default_value[0] = 2.5
  1185.         mapping_node.inputs[3].default_value[1] = 2.5
  1186.         mapping_node.inputs[3].default_value[2] = 2.5
  1187.         link = material_brick.node_tree.links.new
  1188.         link(mix_node.outputs[0], principled.inputs[0])
  1189.         link(bump_node.outputs[0], principled.inputs[19])
  1190.         link(brick_node.outputs[0], bump_node.inputs[2])
  1191.         link(brick_node.outputs[1], mix_node.inputs[0])
  1192.         link(mapping_node.outputs[0], brick_node.inputs[0])
  1193.         link(coord_node.outputs[2], mapping_node.inputs[0])
  1194.         link(mix2_node.outputs[0], mix_node.inputs[1])
  1195.         link(rgb_node.outputs[0], mix2_node.inputs[1])
  1196.         link(noise_node.outputs[0], mix2_node.inputs[2])
  1197.         bpy.context.object.active_material = material_brick
  1198.         return {'FINISHED'}
  1199.  
  1200.  
  1201. class NODE_MT_materials(Menu):
  1202.     """The Materials section contains: Leather."""
  1203.     bl_label = "Materials"
  1204.     bl_idname = "node.mat_MT_menu"
  1205.  
  1206.     def draw(self, context):
  1207.         layout = self.layout
  1208.         layout.operator("wm.leatherop", text= "Leather Shader", icon= 'OUTLINER_OB_SURFACE')
  1209.  
  1210.  
  1211. class NODE_MT_metallics(Menu):
  1212.     """The Metallics section contains: Gold, Silver and Copper."""
  1213.     bl_label = "Metallics"
  1214.     bl_idname = "node.met_MT_menu"
  1215.  
  1216.     def draw(self, context):
  1217.         layout = self.layout
  1218.         layout.operator("shader.gold_operator", text= "Gold Shader", icon= 'KEYTYPE_KEYFRAME_VEC')
  1219.         layout.operator("shader.silver_operator", text= "Silver Shader", icon= 'HANDLETYPE_FREE_VEC')
  1220.         layout.operator("shader.copper_operator", text= "Copper Shader", icon= 'KEYTYPE_EXTREME_VEC')
  1221.  
  1222.  
  1223. class NODE_MT_gems(Menu):
  1224.     """The Gemstones section contains: The Diamond Shader."""
  1225.     bl_label = "Gemstones"
  1226.     bl_idname = "node.gem_MT_menu"
  1227.  
  1228.     def draw(self, context):
  1229.         layout = self.layout
  1230.         layout.operator("wm.diamondop", text= "Diamond Shader", icon= 'DECORATE_ANIMATE')
  1231.  
  1232.  
  1233. class NODE_MT_stylized(Menu):
  1234.     """The Stylized section contains: The Ghost Shader, The Hologram Shader, The Neon Shader and the Stylized Potion Shader."""
  1235.     bl_label = "Stylized"
  1236.     bl_idname = "node.stylized_MT_menu"
  1237.  
  1238.     def draw(self, context):
  1239.         layout = self.layout
  1240.         layout.operator("wm.ghostop", text= "Ghost Shader", icon= 'GHOST_ENABLED')  
  1241.         layout.operator("wm.hologramop", text= "Hologram Shader", icon= 'USER')
  1242.         layout.operator("wm.neonop", text= "Neon Shader", icon= 'MOD_SMOOTH')
  1243.         layout.operator("wm.potionop", text= "Potion Shader", icon= 'SORTTIME')      
  1244.  
  1245.  
  1246. class WM_OT_Shortcut(Operator):
  1247.     """Custom Operator"""
  1248.     bl_label = "Add Shader Menu"
  1249.     bl_idname = "wm.call_shader_menu"
  1250.     bl_options = {'REGISTER', 'UNDO'}
  1251.  
  1252.     def draw(self, context):
  1253.         layout = self.layout
  1254.         box = layout.box()
  1255.         box.menu("node.gem_MT_menu")
  1256.         box.menu("node.mat_MT_menu")
  1257.         box.menu("node.met_MT_menu")
  1258.         box.menu("node.stylized_MT_menu")
  1259.        
  1260.     def execute(self, context):
  1261.         return {'FINISHED'}
  1262.    
  1263.     def invoke(self, context, event):
  1264.         wm = context.window_manager
  1265.         return wm.invoke_props_dialog(self)
  1266.  
  1267.  
  1268. addon_keymaps = []
  1269.  
  1270. classes = [ShaderLibraryProperties, WM_OT_Shortcut, NODE_MT_gems, NODE_MT_materials, NODE_MT_metallics, NODE_MT_stylized, ShaderMainPanel, SubPanelCosmic, SubPanelMaterials, SubPanelMetals, SubPanelPreciousMetals, SubPanelStylized, SHADER_OT_LEATHER, SHADER_OT_DIAMOND, SHADER_OT_GOLD, SHADER_OT_SILVER, SHADER_OT_COPPER, SHADER_OT_CLOUD, SHADER_OT_SCIFIGOLD, SHADER_OT_BRICK, WM_OT_ghostOp, WM_OT_hologramOp, WM_OT_neonOp, WM_OT_potionOp, SHADER_OT_COSMIC]
  1271.  
  1272.  
  1273. def register():
  1274.     for cls in classes:
  1275.         bpy.utils.register_class(cls)
  1276.     wm = bpy.context.window_manager
  1277.     kc = wm.keyconfigs.addon
  1278.     if kc:
  1279.         km = kc.keymaps.new(name='3D View', space_type= 'VIEW_3D')
  1280.         kmi = km.keymap_items.new("wm.call_shader_menu", type= 'F', value= 'PRESS', shift= True)
  1281.         addon_keymaps.append((km, kmi))
  1282.     bpy.types.Scene.my_tool = PointerProperty(type= ShaderLibraryProperties)    
  1283.    
  1284.  
  1285.  
  1286. def unregister():
  1287.     del bpy.types.Scene.my_tool
  1288.     for km,kmi in addon_keymaps:
  1289.         km.keymap_items.remove(kmi)
  1290.     addon_keymaps.clear()
  1291.     for cls in classes:
  1292.         bpy.utils.unregister_class(cls)
  1293.        
  1294.  
  1295. if __name__ == "__main__":
  1296.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement