small question why BoolProperty isnt working?

This has worked in all my other scripts and for some reason isnt working now. Might be something small im not seeing. Error is on the line:

row.prop(self, 'anaglyph_result')

saying that PxRender doesnt have a property anaglyph_result.
My other scripts are working fine using a similar approach…have i just stayed up too late and am losing my mind?


class PxRender(bpy.types.Panel):
    
    bl_label = 'Stereoscopic Rendering'
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "render"
    
    anaglyph_result = bpy.props.BoolProperty(name='Anaglyph Composite')
    
    def draw (self, context):
        layout = self.layout
        row = layout.row()
        row.prop(self, 'anaglyph_result')
        row.operator('wm.test_stereo_render', text='Test Render')

Just a guess, but your other scripts ran in the Properties panel and this one is running in the Tools area?

bpy.props only works in certain panels other panels you can only reference scene properties.

truu…
My other scripts ran in custom popup UI things.

I will have to look at the source for how other BoolPropertys are made on the properties/render panel.

Cheers, if anyone else has some ideas, muchly appreciated :slight_smile:

Ok got it working. Maybe someone else might find this useful.

@Atom Thanks your mention about other panels only referncing scene properties seemed to work. If anyone has any idea why this is the case id be keen to know just out of interest. Working code below. Hope it helps somebody! Updates in bold


class PxRender(bpy.types.Panel):
    bl_label = 'Stereoscopic Rendering'
    bl_idname = 'wm.stereo_render'
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = 'render'
    bl_options = {'DEFAULT_CLOSED'}
    COMPAT_ENGINES = {'CYCLES'}
    
  <b>  bpy.types.Scene.anaglyph_result = </b>bpy.props.BoolProperty(name='Anaglyph Composite')

    def draw (self, context):
       <b> rs = bpy.context.scene</b>
        layout = self.layout
        row = layout.row()
        row.prop(rs, 'anaglyph_result')
        row.operator('wm.test_stereo_render', text='Test Render')