Skip to main content
added 194 characters in body
Source Link
X Y
  • 6.8k
  • 1
  • 10
  • 26
md = context.object.modifiers["GeometryNodes"]
name = next(rna.name for rna in md.node_group.interface.items_tree if rna.identifier == "Socket_2")

layout.prop(data=md, property='["Socket_2"]', text=name)

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()

For Pointer Properties: Collection, Material, Texture, Image, Please visit Unable to Access exposed Material Input in Addon from Geometry Nodes Modifier

md = context.object.modifiers["GeometryNodes"]
name = next(rna.name for rna in md.node_group.interface.items_tree if rna.identifier == "Socket_2")

layout.prop(data=md, property='["Socket_2"]', text=name)

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()
md = context.object.modifiers["GeometryNodes"]
name = next(rna.name for rna in md.node_group.interface.items_tree if rna.identifier == "Socket_2")

layout.prop(data=md, property='["Socket_2"]', text=name)

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()

For Pointer Properties: Collection, Material, Texture, Image, Please visit Unable to Access exposed Material Input in Addon from Geometry Nodes Modifier

added 112 characters in body
Source Link
X Y
  • 6.8k
  • 1
  • 10
  • 26

layout.prop(data=context.object.modifiers["GeometryNodes"], property='["Socket_2"]', text="My Attribute")

md = context.object.modifiers["GeometryNodes"]
name = next(rna.name for rna in md.node_group.interface.items_tree if rna.identifier == "Socket_2")

layout.prop(data=md, property='["Socket_2"]', text=name)

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()

layout.prop(data=context.object.modifiers["GeometryNodes"], property='["Socket_2"]', text="My Attribute")

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()
md = context.object.modifiers["GeometryNodes"]
name = next(rna.name for rna in md.node_group.interface.items_tree if rna.identifier == "Socket_2")

layout.prop(data=md, property='["Socket_2"]', text=name)

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()
Source Link
X Y
  • 6.8k
  • 1
  • 10
  • 26

layout.prop(data=context.object.modifiers["GeometryNodes"], property='["Socket_2"]', text="My Attribute")

enter image description here

import bpy

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "Custom Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"
    
    def draw(self, context):
        layout = self.layout
        layout.prop(data=bpy.context.scene.render,property="fps",text="Frame Rate")
        obj_name = "Cube"
        md_name = "GeometryNodes"
        
        try:
            layout.prop(data=bpy.data.objects[obj_name].modifiers[md_name], property='["Socket_2"]')
        except:
            pass


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

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

if __name__ == "__main__":
    register()