Custom Properties on RenderLayers possible?

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Custom Properties on RenderLayers possible?

Simon Rainerson
Hello

I'm trying to get blender to run on our render farm and I would like to have different priorities or frame ranges or other things per render layer. I thought it would be practical to store these properties on the render layers themselves, but when I tested that I couldn't get it to work.

Is it a known/intended limitation, a bug or just me not knowing what I'm doing?

Here is my test code (also attached):


import bpy

class RENDER_UL_my_renderlayers(bpy.types.UIList):    
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        layer = item
        row=layout.row()
        print(dir(layer))
        row.prop(layer, 'name', text='')
        row.prop(layer, 'test2', text='')
        row.prop(layer, 'use', text = '')

class TEST_PANEL(bpy.types.Panel):
    bl_label = "TEST"
    bl_idname = "RENDER_PT_ui_test"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"

    def draw(self, context):
        layout = self.layout
        col = layout.column()
        col.prop(context.scene, "test1")
        col.template_list('RENDER_UL_my_renderlayers', 'RenderLayers', context.scene.render, 'layers', context.scene, "testindex")

def register():
    bpy.types.Scene.test1 = bpy.props.IntProperty()
    bpy.types.Scene.testindex = bpy.props.IntProperty()
    bpy.types.SceneRenderLayer.test2 = bpy.props.IntProperty()
    
    bpy.utils.register_class(RENDER_UL_my_renderlayers)
    bpy.utils.register_class(TEST_PANEL)

def unregister():
    bpy.utils.unregister_class(RENDER_UL_my_renderlayers)
    bpy.utils.unregister_class(TEST_PANEL)

    del bpy.types.Scene.test1
    del bpy.types.Scene.test2
    del bpy.types.Scene.testindex


if __name__ == "__main__":
    register()

In the console I get 
rna_uiItemR: property not found: SceneRenderLayer.test2

In the print(dir(layer)) test2 shows up but If I do
bpy.data.scenes[0].render.layers[0].test2
I get
(<built-in function IntProperty>, {})
Instead of a number.

test1 shows up like it should.

Thanks

SIMON RAINERSON
Techincal Director

GOODBYE KANSAS STUDIOS
Rosenlundsgatan 40, 4th floor
118 53 Stockholm, Sweden

<a href="tel:+46855699000" style="font-family:Arial;font-size:13.3333px;color:rgb(0,0,0)" target="_blank">Ph: +46 8 556 990 00
www.goodbyekansas.com 


_______________________________________________
Bf-python mailing list
[hidden email]
https://lists.blender.org/mailman/listinfo/bf-python
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom Properties on RenderLayers possible?

Kerim Borchaev
I don't know if it's a bug or limitation of 2.78(I have same results)
but in Blender 2.79 testbuild2 it works!



On Thu, Jul 27, 2017 at 3:03 PM, Simon Rainerson
<[hidden email]> wrote:

> Hello
>
> I'm trying to get blender to run on our render farm and I would like to have
> different priorities or frame ranges or other things per render layer. I
> thought it would be practical to store these properties on the render layers
> themselves, but when I tested that I couldn't get it to work.
>
> Is it a known/intended limitation, a bug or just me not knowing what I'm
> doing?
>
> Here is my test code (also attached):
>
>
>>> import bpy
>>>
>>>
>>> class RENDER_UL_my_renderlayers(bpy.types.UIList):
>>>
>>>     def draw_item(self, context, layout, data, item, icon, active_data,
>>> active_propname, index):
>>>
>>>         layer = item
>>>
>>>         row=layout.row()
>>>
>>>         print(dir(layer))
>>>
>>>         row.prop(layer, 'name', text='')
>>>
>>>         row.prop(layer, 'test2', text='')
>>>
>>>         row.prop(layer, 'use', text = '')
>>>
>>>
>>> class TEST_PANEL(bpy.types.Panel):
>>>
>>>     bl_label = "TEST"
>>>
>>>     bl_idname = "RENDER_PT_ui_test"
>>>
>>>     bl_space_type = 'PROPERTIES'
>>>
>>>     bl_region_type = 'WINDOW'
>>>
>>>     bl_context = "render"
>>>
>>>
>>>     def draw(self, context):
>>>
>>>         layout = self.layout
>>>
>>>         col = layout.column()
>>>
>>>         col.prop(context.scene, "test1")
>>>
>>>         col.template_list('RENDER_UL_my_renderlayers', 'RenderLayers',
>>> context.scene.render, 'layers', context.scene, "testindex")
>>>
>>>
>>> def register():
>>>
>>>     bpy.types.Scene.test1 = bpy.props.IntProperty()
>>>
>>>     bpy.types.Scene.testindex = bpy.props.IntProperty()
>>>
>>>     bpy.types.SceneRenderLayer.test2 = bpy.props.IntProperty()
>>>
>>>
>>>
>>>     bpy.utils.register_class(RENDER_UL_my_renderlayers)
>>>
>>>     bpy.utils.register_class(TEST_PANEL)
>>>
>>>
>>> def unregister():
>>>
>>>     bpy.utils.unregister_class(RENDER_UL_my_renderlayers)
>>>
>>>     bpy.utils.unregister_class(TEST_PANEL)
>>>
>>>
>>>     del bpy.types.Scene.test1
>>>
>>>     del bpy.types.Scene.test2
>>>
>>>     del bpy.types.Scene.testindex
>>>
>>>
>>>
>>> if __name__ == "__main__":
>>>
>>>     register()
>
>
> In the console I get
>>
>> rna_uiItemR: property not found: SceneRenderLayer.test2
>
>
> In the print(dir(layer)) test2 shows up but If I do
>>
>> bpy.data.scenes[0].render.layers[0].test2
>
> I get
>>
>> (<built-in function IntProperty>, {})
>
> Instead of a number.
>
> test1 shows up like it should.
>
> Thanks
>
> SIMON RAINERSON
> Techincal Director
>
> GOODBYE KANSAS STUDIOS
> Rosenlundsgatan 40, 4th floor
> 118 53 Stockholm, Sweden
>
> Ph: +46 8 556 990 00
> www.goodbyekansas.com
>
>
> _______________________________________________
> Bf-python mailing list
> [hidden email]
> https://lists.blender.org/mailman/listinfo/bf-python
>
_______________________________________________
Bf-python mailing list
[hidden email]
https://lists.blender.org/mailman/listinfo/bf-python
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom Properties on RenderLayers possible?

Julian Eisel-2
Hi,

Support for custom properties in render-layers was just added for
2.79, see https://developer.blender.org/rB4cf7fc3b3a4d0. Your script
should work with it :)

Cheers,
- Julian -

On 28 July 2017 at 13:17, Kerim Borchaev <[hidden email]> wrote:

> I don't know if it's a bug or limitation of 2.78(I have same results)
> but in Blender 2.79 testbuild2 it works!
>
>
>
> On Thu, Jul 27, 2017 at 3:03 PM, Simon Rainerson
> <[hidden email]> wrote:
>> Hello
>>
>> I'm trying to get blender to run on our render farm and I would like to have
>> different priorities or frame ranges or other things per render layer. I
>> thought it would be practical to store these properties on the render layers
>> themselves, but when I tested that I couldn't get it to work.
>>
>> Is it a known/intended limitation, a bug or just me not knowing what I'm
>> doing?
>>
>> Here is my test code (also attached):
>>
>>
>>>> import bpy
>>>>
>>>>
>>>> class RENDER_UL_my_renderlayers(bpy.types.UIList):
>>>>
>>>>     def draw_item(self, context, layout, data, item, icon, active_data,
>>>> active_propname, index):
>>>>
>>>>         layer = item
>>>>
>>>>         row=layout.row()
>>>>
>>>>         print(dir(layer))
>>>>
>>>>         row.prop(layer, 'name', text='')
>>>>
>>>>         row.prop(layer, 'test2', text='')
>>>>
>>>>         row.prop(layer, 'use', text = '')
>>>>
>>>>
>>>> class TEST_PANEL(bpy.types.Panel):
>>>>
>>>>     bl_label = "TEST"
>>>>
>>>>     bl_idname = "RENDER_PT_ui_test"
>>>>
>>>>     bl_space_type = 'PROPERTIES'
>>>>
>>>>     bl_region_type = 'WINDOW'
>>>>
>>>>     bl_context = "render"
>>>>
>>>>
>>>>     def draw(self, context):
>>>>
>>>>         layout = self.layout
>>>>
>>>>         col = layout.column()
>>>>
>>>>         col.prop(context.scene, "test1")
>>>>
>>>>         col.template_list('RENDER_UL_my_renderlayers', 'RenderLayers',
>>>> context.scene.render, 'layers', context.scene, "testindex")
>>>>
>>>>
>>>> def register():
>>>>
>>>>     bpy.types.Scene.test1 = bpy.props.IntProperty()
>>>>
>>>>     bpy.types.Scene.testindex = bpy.props.IntProperty()
>>>>
>>>>     bpy.types.SceneRenderLayer.test2 = bpy.props.IntProperty()
>>>>
>>>>
>>>>
>>>>     bpy.utils.register_class(RENDER_UL_my_renderlayers)
>>>>
>>>>     bpy.utils.register_class(TEST_PANEL)
>>>>
>>>>
>>>> def unregister():
>>>>
>>>>     bpy.utils.unregister_class(RENDER_UL_my_renderlayers)
>>>>
>>>>     bpy.utils.unregister_class(TEST_PANEL)
>>>>
>>>>
>>>>     del bpy.types.Scene.test1
>>>>
>>>>     del bpy.types.Scene.test2
>>>>
>>>>     del bpy.types.Scene.testindex
>>>>
>>>>
>>>>
>>>> if __name__ == "__main__":
>>>>
>>>>     register()
>>
>>
>> In the console I get
>>>
>>> rna_uiItemR: property not found: SceneRenderLayer.test2
>>
>>
>> In the print(dir(layer)) test2 shows up but If I do
>>>
>>> bpy.data.scenes[0].render.layers[0].test2
>>
>> I get
>>>
>>> (<built-in function IntProperty>, {})
>>
>> Instead of a number.
>>
>> test1 shows up like it should.
>>
>> Thanks
>>
>> SIMON RAINERSON
>> Techincal Director
>>
>> GOODBYE KANSAS STUDIOS
>> Rosenlundsgatan 40, 4th floor
>> 118 53 Stockholm, Sweden
>>
>> Ph: +46 8 556 990 00
>> www.goodbyekansas.com
>>
>>
>> _______________________________________________
>> Bf-python mailing list
>> [hidden email]
>> https://lists.blender.org/mailman/listinfo/bf-python
>>
> _______________________________________________
> Bf-python mailing list
> [hidden email]
> https://lists.blender.org/mailman/listinfo/bf-python
_______________________________________________
Bf-python mailing list
[hidden email]
https://lists.blender.org/mailman/listinfo/bf-python
Loading...