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?

Get consecutive integer number ranges from list of int

Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?

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

Critique of timeline aesthetic

Converting a sprinkler system's 24V AC outputs to 3.3V DC logic inputs

Phrase for the opposite of "foolproof"

A ​Note ​on ​N!

How to display Aura JS Errors Lightning Out

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

What are the steps to solving this definite integral?

How does Captain America channel this power?

What happened to Captain America in Endgame?

a sore throat vs a strep throat vs strep throat

Was there a Viking Exchange as well as a Columbian one?

What happens to Mjolnir (Thor's hammer) at the end of Endgame?

can anyone help me with this awful query plan?

Can we say “you can pay when the order gets ready”?

Elements other than carbon that can form many different compounds by bonding to themselves?

Extension of 2-adic valuation to the real numbers

Why do games have consumables?

What's the name of these pliers?

What does ゆーか mean?

What is the philosophical significance of speech acts/implicature?

Apply MapThread to all but one variable



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

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?