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 | |
from math import radians | |
# set smooth with auto-smooth active at 30 degrees | |
for o in bpy.context.selected_objects: | |
o.data.use_auto_smooth = True | |
o.data.auto_smooth_angle = radians(30) | |
for p in o.data.polygons: | |
p.use_smooth = True |
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 all selected object if subsurf modifier: | |
# render subdivision number = view subdivision number | |
act = bpy.context.active_object | |
exist = False | |
for mod in act.modifiers: | |
if mod.type == 'SUBSURF': | |
sub = act.modifiers['Subsurf'].levels |
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 | |
from math import radians | |
# Render all specified layers in //layers/ folder with layer names | |
# (based on layers name with layers manager addon) | |
C = bpy.context | |
def render(lay, sup=[]): | |
lay = lay - 1 |
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 | |
# navigate in timeline with marker | |
# markers must be named "start_1" "end_1" then "start_2" ... | |
scn = bpy.context.scene | |
def RangePart(n): | |
n = str(n) | |
scn.frame_start = scn.timeline_markers['start_' + n].frame |
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, os | |
# Dirty apply Scale | |
# Apply transform even if objects are linked (if they share the same dimensions) | |
apply_scale = True | |
apply_rot = False # Useless option, if True, all linked objects will get the same rotation | |
C = bpy.context | |
scn = C.scene |
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
# -*- coding: utf-8 -*- | |
#python 3.x | |
import csv | |
import sys | |
#convert a "comma separated values" file to vcf contact cards | |
#USAGE: | |
#CSV_to_Vcards.py CSV_filename |
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, re | |
#sequence checker, print gaps in a numberred img/files sequence in current working directory | |
l = [f for f in os.listdir(os.getcwd()) if not f.endswith('.py')] | |
miss = 0 | |
gap = 0 | |
i = 0 | |
for f in l: | |
num = re.search('^(.*?)(\d+)(\D*)$', l[i]) |
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
#removes images with no users | |
import bpy | |
images = bpy.data.images | |
U = 0 | |
NU = 0 | |
print (10*'-') | |
print ("total image before", len(bpy.data.images)) |
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 | |
#in armature you have mirror names | |
#this do the similar but for other objects (outside armatures) | |
def mirrorname(o): | |
if o.name[-5:-4] == "L": | |
o.name = o.name[:-5] + "R" | |
elif o.name[-5:-4] == "R": | |
o.name = o.name[:-5] + "L" | |
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, re | |
#increment number in name (if any) while removing trailing blender incrementation | |
#ex: obj02.L.001 >> obj03.L | |
def checkNum(n): | |
'''check if number in string (without trailing number)''' | |
if len(n) > 4: | |
return any(char.isdigit() for char in n) | |
#return bool(re.search(r'\d', inputString)) #regex method | |
else: |
OlderNewer