disable all collections with python in blender 2.8 Announcing the arrival of Valued Associate...

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Does Prince Arnaud cause someone holding the Princess to lose?

Coin Game with infinite paradox

How do I deal with an erroneously large refund?

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

Raising a bilingual kid. When should we introduce the majority language?

Could a cockatrice have parasitic embryos?

What is the evidence that custom checks in Northern Ireland are going to result in violence?

France's Public Holidays' Puzzle

Is it OK if I do not take the receipt in Germany?

RIP Packet Format

Is there a way to fake a method response using Mock or Stubs?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Is there a possibility to generate a list dynamically in Latex?

Why doesn't the university give past final exams' answers?

Is there an efficient way for synchronising audio events real-time with LEDs using an MCU?

What's parked in Mil Moscow helicopter plant?

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Was Objective-C really a hindrance to Apple software development?

What is ls Largest Number Formed by only moving two sticks in 508?

Is it appropriate to mention a relatable company blog post when you're asked about the company?

Why is water being consumed when my shutoff valve is closed?

Writing a T-SQL stored procedure to receive 4 numbers and insert them into a table

Has a Nobel Peace laureate ever been accused of war crimes?



disable all collections with python in blender 2.8



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
2019 Community Moderator ElectionBlender 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
    11 hours ago


















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
    11 hours ago














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 11 hours ago









cookiemonsterandthegirlscookiemonsterandthegirls

182




182




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
    11 hours ago


















  • $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
    11 hours ago
















$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
11 hours ago




$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
11 hours ago










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
    10 hours ago








  • 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
    10 hours ago



















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
      10 hours ago








    • 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
      10 hours ago
















    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
      10 hours ago








    • 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
      10 hours ago














    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 10 hours ago

























    answered 11 hours ago









    LeanderLeander

    13.3k11653




    13.3k11653








    • 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
      10 hours ago








    • 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
      10 hours ago














    • 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
      10 hours ago








    • 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
      10 hours ago








    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
    10 hours ago






    $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
    10 hours ago






    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
    10 hours ago




    $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
    10 hours ago













    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 10 hours ago









        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

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...