Yeah ,but nothing is different than your original script you posted like 4-5 threads ago. The only changes is what other people have posted.
import bpy
def confirm_testmat_group():
#reference to the nodegroup instance
for mat in bpy.data.materials:
#This gets only 'TestMat' material
if mat.name == 'TestMat':
node_ref = mat.node_tree.nodes['Group']
return node_ref
class TestMaterial_PT_layout_panel(bpy.types.Panel):
bl_label = "Test Material Node"
bl_category = "Test Material"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
#replacement for the draw function of your panel:
def draw(self, context):
layout = self.layout
#layout.operator("test_material.add_material", icon='IMPORT')
#if node group found, draw all input properties
if confirm_testmat_group():
node_ref = confirm_testmat_group()
for i in node_ref.inputs:
layout.prop(i, 'default_value', text=i.name)
classes = (TestMaterial_PT_layout_panel,)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()