disable all collections with python in blender 2.8Blender 2.8: how to go back to previous Collection visibility setting?2.8 Python Outliner CollectionsWhat is the Python code related to collection actions for blender 2.8?Show all Collections with one button in 2.8How to render a collection instance but not the original collection in blender 2.8?Managing layers/collections in blender 2.8Workaround for offset of linked collection? (Blender 2.8)blender 2.8 : temporarily show all visible objects in the sceneBlender 2.8 Link Collection ProblemPortal effect in EEVEE?

Does a semiconductor follow Ohm's law?

how to find the equation of a circle given points of the circle

How to solve constants out of the internal energy equation?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

What does the "ep" capability mean?

With a Canadian student visa, can I spend a night at Vancouver before continuing to Toronto?

How do I reattach a shelf to the wall when it ripped out of the wall?

Exchange,swap or switch

Does holding a wand and speaking its command word count as V/S/M spell components?

A ​Note ​on ​N!

The Defining Moment

Is there an official tutorial for installing Ubuntu 18.04+ on a device with an SSD and an additional internal hard drive?

Error message with tabularx

Document starts having heaps of errors in the middle, but the code doesn't have any problems in it

How did Captain America manage to do this?

Phrase for the opposite of "foolproof"

How would one muzzle a full grown polar bear in the 13th century?

Unexpected email from Yorkshire Bank

Noun clause (singular all the time?)

Why do games have consumables?

Pulling the rope with one hand is as heavy as with two hands?

Was there a shared-world project before "Thieves World"?

Do I have to worry about players making “bad” choices on level up?

How to type a section sign ( § ) into the Minecraft client on Linux



disable all collections with python in blender 2.8


Blender 2.8: how to go back to previous Collection visibility setting?2.8 Python Outliner CollectionsWhat is the Python code related to collection actions for blender 2.8?Show all Collections with one button in 2.8How to render a collection instance but not the original collection in blender 2.8?Managing layers/collections in blender 2.8Workaround for offset of linked collection? (Blender 2.8)blender 2.8 : temporarily show all visible objects in the sceneBlender 2.8 Link Collection ProblemPortal effect in EEVEE?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


I am trying to disable all collections in the render with python in Blender 2.8



It works on top-level collections with the code below, but ignores nested collections.



import bpy
coll = bpy.context.view_layer.layer_collection
for x in bpy.context.view_layer.layer_collection.collection.children:
x.hide_render = True


Is there a way to get all collections, regardless of hierarchy?










share|improve this question







New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
    $endgroup$
    – Leander
    Apr 23 at 14:28

















3












$begingroup$


I am trying to disable all collections in the render with python in Blender 2.8



It works on top-level collections with the code below, but ignores nested collections.



import bpy
coll = bpy.context.view_layer.layer_collection
for x in bpy.context.view_layer.layer_collection.collection.children:
x.hide_render = True


Is there a way to get all collections, regardless of hierarchy?










share|improve this question







New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
    $endgroup$
    – Leander
    Apr 23 at 14:28













3












3








3





$begingroup$


I am trying to disable all collections in the render with python in Blender 2.8



It works on top-level collections with the code below, but ignores nested collections.



import bpy
coll = bpy.context.view_layer.layer_collection
for x in bpy.context.view_layer.layer_collection.collection.children:
x.hide_render = True


Is there a way to get all collections, regardless of hierarchy?










share|improve this question







New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




I am trying to disable all collections in the render with python in Blender 2.8



It works on top-level collections with the code below, but ignores nested collections.



import bpy
coll = bpy.context.view_layer.layer_collection
for x in bpy.context.view_layer.layer_collection.collection.children:
x.hide_render = True


Is there a way to get all collections, regardless of hierarchy?







collections






share|improve this question







New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 23 at 13:56









cookiemonsterandthegirlscookiemonsterandthegirls

183




183




New contributor




cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






cookiemonsterandthegirls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • $begingroup$
    Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
    $endgroup$
    – Leander
    Apr 23 at 14:28
















  • $begingroup$
    Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
    $endgroup$
    – Leander
    Apr 23 at 14:28















$begingroup$
Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
$endgroup$
– Leander
Apr 23 at 14:28




$begingroup$
Welcome to Blender.se. Thank you for your question, be aware, that the 2.8 api is still under development, although I'd think, that collection access won't change anytime soon.
$endgroup$
– Leander
Apr 23 at 14:28










2 Answers
2






active

oldest

votes


















1












$begingroup$

Access to Blender's internal data is achieved through bpy.data. This is usually also easier to maintain, since context access (bpy.context) is context-dependent.



Access all collections through:



bpy.data.collections


Render-restricting all collections:



import bpy

coll = bpy.data.collections

for c in coll:
c.hide_render=True





share|improve this answer











$endgroup$








  • 1




    $begingroup$
    Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
    $endgroup$
    – cookiemonsterandthegirls
    Apr 23 at 14:39







  • 1




    $begingroup$
    Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
    $endgroup$
    – Leander
    Apr 23 at 14:43


















1












$begingroup$

With recursion



As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.



This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection



import bpy

def traverse_tree(t):
yield t
for child in t.children:
yield from traverse_tree(child)

coll = bpy.context.view_layer.layer_collection.collection

for c in traverse_tree(coll):
c.hide_render = True





share|improve this answer









$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "502"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    cookiemonsterandthegirls is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f137860%2fdisable-all-collections-with-python-in-blender-2-8%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1












    $begingroup$

    Access to Blender's internal data is achieved through bpy.data. This is usually also easier to maintain, since context access (bpy.context) is context-dependent.



    Access all collections through:



    bpy.data.collections


    Render-restricting all collections:



    import bpy

    coll = bpy.data.collections

    for c in coll:
    c.hide_render=True





    share|improve this answer











    $endgroup$








    • 1




      $begingroup$
      Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
      $endgroup$
      – cookiemonsterandthegirls
      Apr 23 at 14:39







    • 1




      $begingroup$
      Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
      $endgroup$
      – Leander
      Apr 23 at 14:43















    1












    $begingroup$

    Access to Blender's internal data is achieved through bpy.data. This is usually also easier to maintain, since context access (bpy.context) is context-dependent.



    Access all collections through:



    bpy.data.collections


    Render-restricting all collections:



    import bpy

    coll = bpy.data.collections

    for c in coll:
    c.hide_render=True





    share|improve this answer











    $endgroup$








    • 1




      $begingroup$
      Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
      $endgroup$
      – cookiemonsterandthegirls
      Apr 23 at 14:39







    • 1




      $begingroup$
      Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
      $endgroup$
      – Leander
      Apr 23 at 14:43













    1












    1








    1





    $begingroup$

    Access to Blender's internal data is achieved through bpy.data. This is usually also easier to maintain, since context access (bpy.context) is context-dependent.



    Access all collections through:



    bpy.data.collections


    Render-restricting all collections:



    import bpy

    coll = bpy.data.collections

    for c in coll:
    c.hide_render=True





    share|improve this answer











    $endgroup$



    Access to Blender's internal data is achieved through bpy.data. This is usually also easier to maintain, since context access (bpy.context) is context-dependent.



    Access all collections through:



    bpy.data.collections


    Render-restricting all collections:



    import bpy

    coll = bpy.data.collections

    for c in coll:
    c.hide_render=True






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 23 at 14:42

























    answered Apr 23 at 14:27









    LeanderLeander

    13.4k11654




    13.4k11654







    • 1




      $begingroup$
      Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
      $endgroup$
      – cookiemonsterandthegirls
      Apr 23 at 14:39







    • 1




      $begingroup$
      Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
      $endgroup$
      – Leander
      Apr 23 at 14:43












    • 1




      $begingroup$
      Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
      $endgroup$
      – cookiemonsterandthegirls
      Apr 23 at 14:39







    • 1




      $begingroup$
      Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
      $endgroup$
      – Leander
      Apr 23 at 14:43







    1




    1




    $begingroup$
    Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
    $endgroup$
    – cookiemonsterandthegirls
    Apr 23 at 14:39





    $begingroup$
    Ah! That was easy. Thanks Leander. This works: import bpy coll = bpy.data.collections for c in coll: c.hide_render=True
    $endgroup$
    – cookiemonsterandthegirls
    Apr 23 at 14:39





    1




    1




    $begingroup$
    Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
    $endgroup$
    – Leander
    Apr 23 at 14:43




    $begingroup$
    Forgot to include the final code, added your example, glad it worked. For future reference, if any answer is missing a piece of information (like your code example) feel free to suggest an edit yourself. Comments are only temporary and may get removed.
    $endgroup$
    – Leander
    Apr 23 at 14:43













    1












    $begingroup$

    With recursion



    As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.



    This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection



    import bpy

    def traverse_tree(t):
    yield t
    for child in t.children:
    yield from traverse_tree(child)

    coll = bpy.context.view_layer.layer_collection.collection

    for c in traverse_tree(coll):
    c.hide_render = True





    share|improve this answer









    $endgroup$

















      1












      $begingroup$

      With recursion



      As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.



      This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection



      import bpy

      def traverse_tree(t):
      yield t
      for child in t.children:
      yield from traverse_tree(child)

      coll = bpy.context.view_layer.layer_collection.collection

      for c in traverse_tree(coll):
      c.hide_render = True





      share|improve this answer









      $endgroup$















        1












        1








        1





        $begingroup$

        With recursion



        As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.



        This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection



        import bpy

        def traverse_tree(t):
        yield t
        for child in t.children:
        yield from traverse_tree(child)

        coll = bpy.context.view_layer.layer_collection.collection

        for c in traverse_tree(coll):
        c.hide_render = True





        share|improve this answer









        $endgroup$



        With recursion



        As well as setting attributes on all collections in bpy.data.collections can recursively walk the children.



        This will only set the property on descendants of the collection. In this case bpy.context.view_layer.layer_collection.collection



        import bpy

        def traverse_tree(t):
        yield t
        for child in t.children:
        yield from traverse_tree(child)

        coll = bpy.context.view_layer.layer_collection.collection

        for c in traverse_tree(coll):
        c.hide_render = True






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 23 at 14:45









        batFINGERbatFINGER

        27.1k53078




        27.1k53078




















            cookiemonsterandthegirls is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            cookiemonsterandthegirls is a new contributor. Be nice, and check out our Code of Conduct.












            cookiemonsterandthegirls is a new contributor. Be nice, and check out our Code of Conduct.











            cookiemonsterandthegirls is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Blender Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f137860%2fdisable-all-collections-with-python-in-blender-2-8%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bulk add to cart function issuecart vs. mini cart issue … rwd themeRedirect Add to cart button to cart pageAdd to cart issue - Magento 2.1The requested Payment Method is not available When creating an orderM2: reason add-to-cart might not function in production modeAdd to cart issue in some android devicesMagento 2 - custom price can not add to subtotal and grand total after add to cartAdd to cart codeIssue with my cart module on pdp and cart pages, just keeps spinningBulk price and quantity update using rest api

            БиармияSxpst500bh2ntaf! 3h2r