0

In python, how do I input an image file, add it to an image texture node, and set its properties so that it will be packed into the .blend file? That is, how do I automate the actions in this animated gif and then pack the image?

https://gfycat.com/ElaborateFalseEmperorpenguin

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
  • It would help if we could see your Python script. Can you add it to your question? It might be easiest if you add the blend file containing. (How to add a blend file) If you do, be sure to pack everything in the blend file before adding it. – Marty Fouts Oct 07 '21 at 21:02
  • Something like this: https://pasteall.org/TJNF/raw ? Make sure there is a material assigned to the active object, the name of the image is correct ("Image Name") is just an example, and run the script. – brockmann Oct 16 '21 at 12:33
  • Before "I have packed image inside blend file...", now "and set its properties so that it will be packed into the .blend file?", makes it a different question. See the gif, the image is loaded already @MartyFouts – brockmann Oct 16 '21 at 14:04
  • @brockmann imo you're misunderstanding the reason for the gif. The OP is saying he wants to accomplish the actions in the gif, but in a script and also to make sure the image is packed, not just that they want to pack an image. Also, the script in your previous comment doesn't pack the image, so it wouldn't work even for your interpretation of the question. – Marty Fouts Oct 16 '21 at 14:14
  • 1
    My script doesn't pack it because this wasn't part of the question (and is a shot into the blue anyway to help the OP), see the revisions: https://blender.stackexchange.com/posts/240125/revisions - the image is packed and loaded already, to quote it again: "I have packed image inside blend file" @MartyFouts Again, please don't edit questions the way you understand it. – brockmann Oct 16 '21 at 14:20
  • See: How to load an image from disc and assign it to a newly created image texture node?. If you really want to pack the image as well, just add img.pack() to the script. – brockmann Oct 16 '21 at 14:43
  • @brockmann The original question asked "want to add default image what is packed in blend file. " Your script does neither of those things. your script also includes code to create an image texture, a new material, and attach the image texture to the shader in the new material. None of which are in the OPs original question. Again, stop asking other people to act on their interpretation of a question when you're doing exactly that yourself. – Marty Fouts Oct 16 '21 at 14:53
  • 1
    Apples and oranges. I don't edit other peps posts without knowing what they want @MartyFouts ... I added a simple demo to help getting started. Btw: How to assign an image to the texture node without any material and without creating the node in a simple demo? – brockmann Oct 16 '21 at 15:00
  • @brockmann you vote to close them as duplicates without knowing what they want. You've even asked the OP for an explanation and voted to close before it was forthcoming. Apples and apples. Here's a helpful lesson I learned from a reference librarian: when you don't understand the OP's question, restate it to them differently and let them correct your understanding. What I'm doing is question clarification 101. – Marty Fouts Oct 16 '21 at 15:14
  • 1
    Voting to close as dupe is legit since the OP can always clearify based on a starting point. What you're are doing is slipperly slope and helps neither the OP nor US to answer the question properly. Your comment doesn't answer my question from before, it's just righteous rant as always @MartyFouts – brockmann Oct 16 '21 at 15:21
  • @brockmann if someone's ranting here, it's not me. For instance, your argument for closing a dupe is exactly my description of clarification 101. The OP can always clarify. The point of restating the question is so that they can clarify. It's also not a slippery slope. This is one of the tools that reference librarians use in real life, and I've seen it work here in circumstances just like this one. I didn't answer your question because it's an intentional distraction from the point under discussion. – Marty Fouts Oct 16 '21 at 15:35
  • 1
    Wouldn't librarians ask a question in the comments rather than editing your words? It's about respect and giving the author a chance @MartyFouts Your claim was "None of which are in the OPs original question." and I asked you how would you create a demo thus no distraction and actually part of our great discussion, I personally call it "Demo 101", lol. – brockmann Oct 16 '21 at 15:51

0 Answers0