This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Crush multiple image files in a folder | |
crush() { | |
for f in *; | |
do | |
mv "$f" `echo $f | tr ' ' '_'` | |
done | |
for f in *.png | |
do | |
echo "$f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy,bmesh | |
ob = bpy.data.objects['Cube'] | |
bpy.ops.object.mode_set(mode='EDIT') | |
mesh=bmesh.from_edit_mesh(bpy.context.object.data) | |
for v in mesh.verts: | |
v.select = True | |
# trigger viewport update | |
bpy.context.scene.objects.active = bpy.context.scene.objects.active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy,bmesh | |
ob = bpy.data.objects['Cube'] | |
bpy.ops.object.mode_set(mode='EDIT') | |
mesh=bmesh.from_edit_mesh(bpy.context.object.data) | |
for f in mesh.faces: | |
if f.normal.y == 1.0: | |
f.select = True | |
# trigger viewport update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from PIL import Image | |
for infile in os.listdir("./"): | |
print ("file : " + infile) | |
if infile[-3:] == "tif" or infile[-3:] == "bmp" or infile[-3:] == "png": | |
outfile = infile[:-3] + "jpeg" | |
im = Image.open(infile) | |
print("new filename : " + outfile) | |
out = im.convert("RGB") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import make_response | |
import os | |
app = Flask(__name__) | |
# Simple flask server to be used locally for serving images to get around constraints such as those created | |
# when trying to load textures in ThreeJs. | |
# https://stackoverflow.com/questions/24087757/three-js-and-loading-a-cross-domain-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
# cleans out the rest of the objects from the scene and puts the cube in, essentially a fresh start, useful for debugging | |
bpy.ops.object.select_all(action='TOGGLE') | |
bpy.ops.object.select_all(action='TOGGLE') | |
bpy.ops.object.delete(use_global=False) | |
bpy.context.scene.cursor_location = (0.0, 0.0, 0.0) | |
bpy.ops.mesh.primitive_cube_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy,bmesh | |
# Assumes we aleady have a cube out, nothing selected | |
ob = bpy.data.objects['Cube'] | |
bpy.ops.object.mode_set(mode='EDIT') | |
mesh = bmesh.from_edit_mesh(bpy.context.object.data) | |
ur_face = None | |
# look at all of the faces of the cube, find the one that is 'facing' the positive direction on the y axis | |
for f in mesh.faces: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"profiles": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
for obj in bpy.context.selected_editable_objects: | |
obj.active_material_index = 1 | |
for i in range(1, len(obj.material_slots)): | |
bpy.ops.object.material_slot_remove({'object': obj}) | |
for block in bpy.data.materials: | |
if block.users == 0: | |
bpy.data.materials.remove(block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy,bmesh | |
ob = bpy.data.objects['Cube'] | |
bpy.ops.object.mode_set(mode='EDIT') | |
mesh=bmesh.from_edit_mesh(bpy.context.object.data) | |
for v in mesh.verts: | |
v.select = True |
OlderNewer