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 | |
fileMaterials = bpy.data.materials | |
print(len(fileMaterials)) | |
renderMaterials = [] | |
for material in fileMaterials: | |
if material.name[:4] == 'mtl_': | |
renderMaterials.append(material) | |
print('Added: '.format(material.name)) |
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 maya.cmds as cmds | |
selection = cmds.ls(sl=1,sn=True) | |
for frame in range(1,80): | |
cmds.currentTime(frame) | |
newCube = cmds.ls (cmds.polyCube( sx=1, sy=1, sz=1), long=True) | |
posX = cmds.getAttr(selection[0]+'.translateX') | |
posY = cmds.getAttr(selection[0]+'.translateY') | |
posZ = cmds.getAttr(selection[0]+'.translateZ') | |
cmds.setAttr(newCube[0]+'.translateX',posX) |
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 maya.api.OpenMaya import MVector, MMatrix, MPoint | |
import maya.cmds as cmds | |
def get_relative_transform (node,coordinate_space_node): | |
node_matrix = MMatrix(cmds.xform(node, q=True, matrix=True, ws=True)) | |
parent_matrix = MMatrix(cmds.xform(coordinate_space_node, q=True, matrix=True, ws=True)) | |
return (node_matrix * parent_matrix.inverse()) | |
node_a = (cmds.ls(sl=1,sn=True))[0] | |
node_b = (cmds.ls(sl=1,sn=True))[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
from maya.api.OpenMaya import MVector, MMatrix, MPoint | |
import maya.cmds as cmds | |
def get_world_transform (obj): | |
return MMatrix ( cmds.xform( obj, q=True, matrix=True, ws=True ) ) | |
selected_object = (cmds.ls(sl=1,sn=True))[0] | |
print ( get_world_transform( selected_object ) ) |
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 MaxPlus import ClassIds | |
from MaxPlus import Point3 | |
import random | |
# Define Sphere geometry object: | |
sphere_obj = Factory.CreateGeomObject(ClassIds.Sphere) | |
sphere_obj.ParameterBlock.Radius.Value = 5 | |
sphere_obj.ParameterBlock.Segs.Value = 64 | |
# Create a list of 10 sphere instanced objects: |
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 os import listdir | |
from os.path import isfile, join | |
dir = "D:\\" | |
files = [f for f in listdir(dir) if isfile(join(dir, f)) and f[-3:]=='jpg'] | |
for f in files: | |
print join(dir, 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
from os import listdir | |
from os.path import isfile, join | |
dir = "D:\\" | |
files = [f for f in listdir(dir) if isfile(join(dir, f))] | |
for f in files: | |
print join(dir, 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
from MaxPlus import FileManager | |
from MaxPlus import SelectionManager | |
model_path = r"D:\Models\Some_model.max" | |
place_holders = [] | |
for o in SelectionManager.Nodes: | |
place_holders.append(o) | |
FileManager.Merge(model_path,True,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 math | |
from MaxPlus import Factory | |
from MaxPlus import ClassIds | |
from MaxPlus import INode | |
from MaxPlus import TriObject | |
from MaxPlus import Matrix3 | |
from MaxPlus import Point3 | |
# Intensity: | |
effecr_mult = 1.0 |
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 | |
objects = bpy.context.selected_objects | |
for i, o in enumerate(objects): | |
o.name = "{}_{}".format(o.type, o.name) |
NewerOlder