Solved read active render data

Hi all,
I'm developing a plugin for c4d that will need to retrieve various information from the currently loaded scene then export that data to a json that can later be retrieved. I've tried a few different methods of doing this, but no luck yet. The information i'm trying to get is: from frame, to frame, and the base of the filename(not present in the code below).

        doc = documents.GetActiveDocument()
        rd = doc.GetActiveRenderData()
        fromSlice = rd[c4d.RDATA_FRAMEFROM]
        toSlice = rd[c4d.RDATA_FRAMETO]

any guidance would be appreciated, thanks in advance :-)

Hello and welcome,

when creating a new post, please use tags and the Q&A system. See Read Before Posting.

I tried your code in a R20 script and it seems to work perfectly fine:

rd = doc.GetActiveRenderData()

if rd is None:
    return

fromSlice = rd[c4d.RDATA_FRAMEFROM]
toSlice = rd[c4d.RDATA_FRAMETO]

fps = doc.GetFps()

print(fromSlice.GetFrame(fps))
print(toSlice.GetFrame(fps)

What exactly is not working for you? In what context do you execute your code?

best wishes,
Sebastian

Hello and welcome,

when creating a new post, please use tags and the Q&A system. See Read Before Posting.

I tried your code in a R20 script and it seems to work perfectly fine:

rd = doc.GetActiveRenderData()

if rd is None:
    return

fromSlice = rd[c4d.RDATA_FRAMEFROM]
toSlice = rd[c4d.RDATA_FRAMETO]

fps = doc.GetFps()

print(fromSlice.GetFrame(fps))
print(toSlice.GetFrame(fps)

What exactly is not working for you? In what context do you execute your code?

best wishes,
Sebastian