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;
$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()
python
$endgroup$
add a comment |
$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()
python
$endgroup$
$begingroup$
You'll find some good answers here
$endgroup$
– Robin Betts
Jul 29 at 17:07
add a comment |
$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()
python
$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
python
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
add a comment |
$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
add a comment |
2 Answers
2
active
oldest
votes
$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
$endgroup$
add a comment |
$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)
$endgroup$
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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
$endgroup$
add a comment |
$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
$endgroup$
add a comment |
$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
$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
answered Jul 29 at 13:05
VirtualTurtleVirtualTurtle
1135 bronze badges
1135 bronze badges
add a comment |
add a comment |
$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)
$endgroup$
add a comment |
$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)
$endgroup$
add a comment |
$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)
$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)
answered Jul 29 at 13:04
brockmannbrockmann
1,6276 silver badges31 bronze badges
1,6276 silver badges31 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
$begingroup$
You'll find some good answers here
$endgroup$
– Robin Betts
Jul 29 at 17:07