disable all collections with python in blender 2.82019 Community Moderator Election Unicorn...

Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?

Coin Game with infinite paradox

Married in secret, can marital status in passport be changed at a later date?

What to do with someone that cheated their way though university and a PhD program?

Is it accepted to use working hours to read general interest books?

How to translate "red flag" into Spanish?

What is the ongoing value of the Kanban board to the developers as opposed to management

`FindRoot [ ]`::jsing: Encountered a singular Jacobian at a point...WHY

Was there ever a LEGO store in Miami International Airport?

How do I deal with an erroneously large refund?

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

What was Apollo 13's "Little Jolt" after MECO?

When speaking, how do you change your mind mid-sentence?

Is a self contained air-bullet cartridge feasible?

/bin/ls sorts differently than just ls

When I export an AI 300x60 art board it saves with bigger dimensions

What *exactly* is electrical current, voltage, and resistance?

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

What helicopter has the most rotor blades?

Simulate round-robin tournament draw

What's the difference between using dependency injection with a container and using a service locator?

What's parked in Mil Moscow helicopter plant?

Are there existing rules/lore for MTG planeswalkers?

Israeli soda type drink



disable all collections with python in blender 2.8



2019 Community Moderator Election
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
2019 Moderator Election Q&A - QuestionnaireBlender 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
    13 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
    13 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 14 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
    13 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
    13 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
13 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
13 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
    13 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
    13 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
      13 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
      13 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
      13 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
      13 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 13 hours ago

























    answered 13 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
      13 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
      13 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
      13 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
      13 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
    13 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
    13 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
    13 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
    13 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 13 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

            VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

            Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

            looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...