Author Topic: Useful resources for writing blender 2.8x scripts (especially import scripts)  (Read 2048 times)

Toolwut

  • Stingray
  • Posts: 60
I bookmarked some useful pages when I worked on my .md2 import script (https://forums.digitalpaint.org/index.php?topic=28727.0). Since blender likes doing API changes e.g. many from 2.7x to 2.8x and python does the same (blender 2.8x uses python 3.7) scripts and add-ons always have to be kept up-to-date.

https://blender.stackexchange.com/questions/61879/create-mesh-then-add-vertices-to-it-in-python - The bottom answer (dunno how to link replies from stackexchange without an account) shows how to create an object in blender from a list of vertices and faces

https://blender.stackexchange.com/questions/162256/bpy-prop-collection-object-has-no-attribute-link - Shows an API change that caused trouble for me when I copy and pasted some old code

https://devtalk.blender.org/t/selecting-an-object-in-2-8/4177/2 - same here

https://blenderartists.org/t/module-dev-reloading-a-module/359775/5 - (the reply below the linked one) explains how to reload a module. Since the blender text editor isn't super comfortable I wrote most of the code in an external file in a different IDE (Pycharm is good for python). Changing that file requires manually reloading it in the main file in blender. Also explains importing modules from custom directories.

https://blender.stackexchange.com/questions/36902/how-to-keyframe-mesh-vertices-in-python and https://blender.stackexchange.com/questions/78262/animation-of-dupliverts-with-shape-keys-with-python-api - In blender you can animate individual vertices, necessary when you're importing animated 3D models

https://blender.stackexchange.com/questions/53709/bmesh-how-to-map-vertex-based-uv-coordinates-to-loops/53808 - shows how to assign uv coordinates to faces. required later assigning a uv map

https://blender.stackexchange.com/questions/27001/mesh-object-has-no-attribute-uv/27003 - don't remember why I needed this, I think it says that you assign uv coordinates to triangles (aka. each vertex in a triangle) instead of directly assigning them to a vertex

https://blender.stackexchange.com/questions/118646/add-a-texture-to-an-object-using-python-and-blender-2-8 - to add the uv texture/skin

https://docs.blender.org/manual/en/latest/files/media/image_formats.html - why jitspoe should remove all pcx images: modern software doesn't support that format anymore

https://blenderscripting.blogspot.com/2012/08/adjusting-image-pixels-internally-in.html - you can still edit an image pixel by pixel in blender or even create a new one. This way you could build a pcx loader / import any unsupported format