Removing all material slots in one goQuick way to remove thousands of materials from an object?Scripted Copy of all Materials/Material slots from another ObjectEdit an object's material in Blender using pythonAssign one material to multiple objects via PythonRemoving specular intensity from all materials with internalScript to remove submesh in all objects by material name?Disable Material DuplicationSmall automated scriptPython to Replace Skechup Material to Cycles MaterialPassing data from one running instance of script to the nextBatch OBJ Import - Change all materials on all objects to the base material for each

How quickly could a country build a tall concrete wall around a city?

Is it true that control+alt+delete only became a thing because IBM would not build Bill Gates a computer with a task manager button?

How can glass marbles naturally occur in a desert?

How to say "fit" in Latin?

Look mom! I made my own (Base 10) numeral system!

Team goes to lunch frequently, I do intermittent fasting but still want to socialize

Why are there so many Doppler Effect formulas?

Why does Intel's Haswell chip allow multiplication to be twice as fast as addition?

sed delete all the words before a match

Are there any financial disadvantages to living significantly "below your means"?

How to help new students accept function notation

How does The Fools Guild make its money?

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

How to write "upright" integrals with automatic sizing

Looking for a new job because of relocation - is it okay to tell the real reason?

How can I tell if a flight itinerary is fake?

Pretty heat maps

How to identify the wires on the dimmer to convert it to Conventional on/off switch

Secure my password from unsafe servers

Is multiplication of real numbers uniquely defined as being distributive over addition?

English - Acceptable use of parentheses in an author's name

What is the best way to cause swarm intelligence to be destroyed?

Is refreshing multiple times a test case for web applications?

Can ads on a page read my password?



Removing all material slots in one go


Quick way to remove thousands of materials from an object?Scripted Copy of all Materials/Material slots from another ObjectEdit an object's material in Blender using pythonAssign one material to multiple objects via PythonRemoving specular intensity from all materials with internalScript to remove submesh in all objects by material name?Disable Material DuplicationSmall automated scriptPython to Replace Skechup Material to Cycles MaterialPassing data from one running instance of script to the nextBatch OBJ Import - Change all materials on all objects to the base material for each






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








3












$begingroup$


I need some help in removing all material slots in one go using a python script.
I am able to use this, would prefer to ave all removed.



bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 1
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 2
bpy.ops.object.material_slot_remove()









share|improve this question











$endgroup$













  • $begingroup$
    You'll find some good answers here
    $endgroup$
    – Robin Betts
    Jul 29 at 17:07


















3












$begingroup$


I need some help in removing all material slots in one go using a python script.
I am able to use this, would prefer to ave all removed.



bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 1
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 2
bpy.ops.object.material_slot_remove()









share|improve this question











$endgroup$













  • $begingroup$
    You'll find some good answers here
    $endgroup$
    – Robin Betts
    Jul 29 at 17:07














3












3








3


1



$begingroup$


I need some help in removing all material slots in one go using a python script.
I am able to use this, would prefer to ave all removed.



bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 1
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 2
bpy.ops.object.material_slot_remove()









share|improve this question











$endgroup$




I need some help in removing all material slots in one go using a python script.
I am able to use this, would prefer to ave all removed.



bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 1
bpy.ops.object.material_slot_remove()
bpy.context.object.active_material_index = 2
bpy.ops.object.material_slot_remove()






python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 29 at 12:17









lemon

19.8k1 gold badge19 silver badges55 bronze badges




19.8k1 gold badge19 silver badges55 bronze badges










asked Jul 29 at 11:58









Michael TeinikerMichael Teiniker

1111 silver badge8 bronze badges




1111 silver badge8 bronze badges














  • $begingroup$
    You'll find some good answers here
    $endgroup$
    – Robin Betts
    Jul 29 at 17:07

















  • $begingroup$
    You'll find some good answers here
    $endgroup$
    – Robin Betts
    Jul 29 at 17:07
















$begingroup$
You'll find some good answers here
$endgroup$
– Robin Betts
Jul 29 at 17:07





$begingroup$
You'll find some good answers here
$endgroup$
– Robin Betts
Jul 29 at 17:07











2 Answers
2






active

oldest

votes


















2












$begingroup$

import bpy #import the blender python library
for x in bpy.context.object.material_slots: #For all of the materials in the selected object:
bpy.context.object.active_material_index = 0 #select the top material
bpy.ops.object.material_slot_remove() #delete it





share|improve this answer









$endgroup$






















    2












    $begingroup$

    You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():



    for obj in bpy.context.selected_editable_objects:
    obj.active_material_index = 0
    for i in range(len(obj.material_slots)):
    bpy.ops.object.material_slot_remove('object': obj)





    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
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f146714%2fremoving-all-material-slots-in-one-go%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









      2












      $begingroup$

      import bpy #import the blender python library
      for x in bpy.context.object.material_slots: #For all of the materials in the selected object:
      bpy.context.object.active_material_index = 0 #select the top material
      bpy.ops.object.material_slot_remove() #delete it





      share|improve this answer









      $endgroup$



















        2












        $begingroup$

        import bpy #import the blender python library
        for x in bpy.context.object.material_slots: #For all of the materials in the selected object:
        bpy.context.object.active_material_index = 0 #select the top material
        bpy.ops.object.material_slot_remove() #delete it





        share|improve this answer









        $endgroup$

















          2












          2








          2





          $begingroup$

          import bpy #import the blender python library
          for x in bpy.context.object.material_slots: #For all of the materials in the selected object:
          bpy.context.object.active_material_index = 0 #select the top material
          bpy.ops.object.material_slot_remove() #delete it





          share|improve this answer









          $endgroup$



          import bpy #import the blender python library
          for x in bpy.context.object.material_slots: #For all of the materials in the selected object:
          bpy.context.object.active_material_index = 0 #select the top material
          bpy.ops.object.material_slot_remove() #delete it






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 29 at 13:05









          VirtualTurtleVirtualTurtle

          1135 bronze badges




          1135 bronze badges


























              2












              $begingroup$

              You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():



              for obj in bpy.context.selected_editable_objects:
              obj.active_material_index = 0
              for i in range(len(obj.material_slots)):
              bpy.ops.object.material_slot_remove('object': obj)





              share|improve this answer









              $endgroup$



















                2












                $begingroup$

                You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():



                for obj in bpy.context.selected_editable_objects:
                obj.active_material_index = 0
                for i in range(len(obj.material_slots)):
                bpy.ops.object.material_slot_remove('object': obj)





                share|improve this answer









                $endgroup$

















                  2












                  2








                  2





                  $begingroup$

                  You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():



                  for obj in bpy.context.selected_editable_objects:
                  obj.active_material_index = 0
                  for i in range(len(obj.material_slots)):
                  bpy.ops.object.material_slot_remove('object': obj)





                  share|improve this answer









                  $endgroup$



                  You can set the index of the list to 0, iterate through all slots and override the context of material_slot_remove():



                  for obj in bpy.context.selected_editable_objects:
                  obj.active_material_index = 0
                  for i in range(len(obj.material_slots)):
                  bpy.ops.object.material_slot_remove('object': obj)






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 29 at 13:04









                  brockmannbrockmann

                  1,6276 silver badges31 bronze badges




                  1,6276 silver badges31 bronze badges






























                      draft saved

                      draft discarded
















































                      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%2f146714%2fremoving-all-material-slots-in-one-go%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

                      Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                      Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                      Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림