0
$\begingroup$

I have problem with making image opener in custom menu. I need to link image to texture node later (something like node.image = image). Any sugesstion how to make it would help.

For now i have this: (part of the code)

class VTA_panel(bpy.types.Panel):
    bl_label = 'VTA'
    bl_idname = 'vta'
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = 'material'

    # cycles renderer is required
    @classmethod
    def poll(cls, context):
        return context.scene.render.engine == 'CYCLES'

    def draw(self, context):
        layout = self.layout
        object = context.active_object
        material = object.active_material
        settings = object.settings

        # check if snow cover is not active for object
        if not settings.vta_active:
            layout.operator('add.vta')

        # adding editable properties and remove button
        elif material.name.startswith('VTA'):
            tree = material.node_tree

            layout = self.layout

            sima = context.space_data
            layout.template_ID(sima, "image", new="image.new", open="image.open")

But last row is not working. I got this error:

ui_template_id: pointer property not found: SpaceProperties.image
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.