SOLVED Set IRR settings

Hello,

in this thread it is explained how to set the size of the IRR.

I would also like to set parameters like the resolution.

When dragging the GUI element into the console it says:

Sniper[c4d.IRR_DETAIL]

and when I execute it without the ID I get

>>> Sniper 
<c4d.BaseList2D object called Sniper/Sniper with ID 430000000 at 4756143680>

How can I get access to this inside a script?

Thank you!

Hello @interfaceguy,

Thank you for reaching out to us. The 'sniper' thing is something which is called a scene hook. You can get hold of scene hooks via c4d.documents.BaseDocument, in this case the most relevant method is BaseDocument.FindSceneHook for you. Find a small example which puts all the pieces together at the end of my posting.

Cheers,
Ferdinand

"""Provides an example for getting hold of the Interactive Render Region (IRR) scene hook.

Scene hooks are 'managing entities' that are attached to a document. The IRR has one that is called
'sniper' because some engineer was feeling funny ;) Run this as a Script Manger script, and it will 
set the active IRR to 50% detail rate.
"""


import c4d

doc: c4d.documents.BaseDocument  # The active document

def main() -> None:
    """
    """
    # Get the scene hook for the IRR from the active document.
    sniperHook: c4d.BaseList2D = doc.FindSceneHook(430000000)
    if not isinstance(sniperHook, c4d.BaseList2D):
        raise RuntimeError("Could not access Interactive Render Region scene hook.")
    
    # Set the detail to 50% and push an update event to Cinema 4D.
    sniperHook[c4d.IRR_DETAIL] = 0.5
    c4d.EventAdd()

if __name__ == '__main__':
    main()

Hello @interfaceguy,

Thank you for reaching out to us. The 'sniper' thing is something which is called a scene hook. You can get hold of scene hooks via c4d.documents.BaseDocument, in this case the most relevant method is BaseDocument.FindSceneHook for you. Find a small example which puts all the pieces together at the end of my posting.

Cheers,
Ferdinand

"""Provides an example for getting hold of the Interactive Render Region (IRR) scene hook.

Scene hooks are 'managing entities' that are attached to a document. The IRR has one that is called
'sniper' because some engineer was feeling funny ;) Run this as a Script Manger script, and it will 
set the active IRR to 50% detail rate.
"""


import c4d

doc: c4d.documents.BaseDocument  # The active document

def main() -> None:
    """
    """
    # Get the scene hook for the IRR from the active document.
    sniperHook: c4d.BaseList2D = doc.FindSceneHook(430000000)
    if not isinstance(sniperHook, c4d.BaseList2D):
        raise RuntimeError("Could not access Interactive Render Region scene hook.")
    
    # Set the detail to 50% and push an update event to Cinema 4D.
    sniperHook[c4d.IRR_DETAIL] = 0.5
    c4d.EventAdd()

if __name__ == '__main__':
    main()

Works like a charm, thank you!