Jump to content

Sign in to follow this  
Anthony Cavel

PYTHON_Change value on every TextureTags

Recommended Posts

Hi everyone,
It's been at least 6 hours I'm desperately looking for  write a python script that select all the texture tags assigned to my objects, and change the "selection" value (called TEXTURETAG_RESTRICTION) to "off#".
This would disable all the shaders in my scene, even in octane live viewport.
Then I would can write the same code and change the "off#" to "", and obviously enable again all the materials
For the moment, it took me ages to write and obtain this:

import c4d
from c4d import gui


def main():
    c4d.CallCommand(300001025) # Select All
    c4d.CallCommand(16370, 16370) # Select Texture Tags/Objects
    s = doc.GetActiveTags()
    
    for i in s:
        tag(i)[c4d.TEXTURETAG_RESTRICTION] = "off#"

    c4d.EventAdd()


if __name__=='__main__':
    main()


The execution of these lines selects all all the texture tags assigned to my objects, but it's impossible for the moment to change the "selection" value (called TEXTURETAG_RESTRICTION) to "off#"

Does anyone have an idea to solve my issue ?

Thanks,
Antoka

Share this post


Link to post
Share on other sites

s is a list of tags, so i is a tag object, not an index. Use:

 

i[c4d.TEXTURETAG_RESTRICTION] = "off#"

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...