Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello, I am trying to change the Viewport Renderer parameters. I was able to use the method illustrated in the code sample below, but something changed (I believe in the API) and this now leads to TypeError: __setitem__ expected str, not bool. If I'm not to assign these values as a boolean, can someone please advise on how these are to be set? Thank you.
TypeError: __setitem__ expected str, not bool
import c4d from c4d import documents def main(): doc = documents.GetActiveDocument() rdata = doc.GetActiveRenderData() rd = rdata.GetData() post = rdata.GetFirstVideoPost() post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_NGONLINES] = False post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_OTHER] = False post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_SDSCAGE] = False post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_ONION] = False if __name__=='__main__': main()
I think I have discovered the issue: I believe rdata.GetFirstVideoPost() was getting a renderer other than the Viewport Renderer, so those symbols weren't available. I am now using the following (I found it here) to check that the video post is the Viewport Renderer.
rdata.GetFirstVideoPost()
post = rdata.GetFirstVideoPost() while post is not None: if post.CheckType(300001061): break post = post.GetNext() if post is None: rd.InsertVideoPost(c4d.BaseList2D(300001061))
Unless the API devs have any corrections, I'll mark this as solved.
hi,
Pretty strange i was not able to reproduce the issue.
@blastframe said in Changing VideoPost leads to TypeError:
300001061
you can use the symbol c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE instead.
c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE
Cheers, Manuel
@m_magalhaes Yes, I think the error was because Octane was the result of rdata.GetFirstVideoPost() and those symbols don't exist in it. If I check for the Viewport Renderer, it seems to work fine. Thanks for the reply and symbol tip!