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 | |
import maya.OpenMaya as OpenMaya | |
def TsMatConvert(MatType,AttList): | |
selMat = cmds.ls( selection=True, materials=True ) | |
for tmpMat in selMat: |
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
//Viewのテクスチャ表示を一時的に変更 | |
//マテリアルを選択して実行 | |
//引数:解像度サイズ | |
global proc TsSetTexRes(int $TexRes){ | |
int $moto = `displayPref -q -maxTextureResolution`; | |
displayPref -maxTextureResolution $TexRes; | |
string $infoName[] = `listConnections -type materialInfo`; | |
for( $tmp in $infoName){ |
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
#pointAとpointBを結ぶ直線とpointPの最近点の座標を返す | |
import pymel.core as pm | |
import pymel.core.datatypes as dt | |
import maya.cmds as cmds | |
def GetNearestPointToLine(pointA,pointB,pointP): | |
AP = pointP - pointA | |
nAB = (pointB - pointA).normal() |
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
#最近点にスナップ | |
#tgtObj=スナップ元のオブジェ、vtxList=スナップ対象の頂点リスト | |
import pymel.core as pm | |
import maya.cmds as cmds | |
def snapToClosestPointOnMesh(tgtObj,vtxList): | |
tgtObjShape = pm.PyNode(tgtObj).getShapes() | |
tmpCpNode = cmds.createNode( 'closestPointOnMesh', ss=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
#二つの選択オブジェの入れ替え(translate,rotate,scale) | |
#入れ替えたいオブジェクトを選択して実行 | |
import maya.cmds as cmds | |
objs = cmds.ls(sl=True,flatten=True) | |
traA = cmds.getAttr(objs[0]+".translate") | |
rotA = cmds.getAttr(objs[0]+".rotate") | |
scaA = cmds.getAttr(objs[0]+".scale") |
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 pymel.core as pm | |
import maya.cmds as cmds | |
def TsRelaxVtxs(): | |
vtxs = cmds.ls(fl=True, sl=True) | |
if len(vtxs) == 0: | |
cmds.error("Please select some vertices.") | |
else: |
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 | |
import maya.mel as mm | |
def TsInsideSelection(): | |
selEdges = cmds.ls(sl=True, fl=True) | |
selType = cmds.selectType(q=True, meshComponents=True ) | |
obj = selEdges[0].split(".")[0] | |
tmpObj = cmds.duplicate( obj, rr=True )[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 maya.cmds as cmds | |
import maya.mel as mel | |
import os.path | |
def TsRename(): | |
sel = cmds.ls( selection=True ) | |
for obj in sel: | |
type = cmds.ls( obj,showType=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
var ap=app.project; | |
var myLayer=ap.item(1).layer(1); | |
var numEff=myLayer.property("Effects").numProperties; | |
$.writeln( "---------------------------------------------------" ); | |
for(k=1;k<=numEff;k++){ | |
var effName=myLayer.property("Effects").property(k).matchName; | |
$.writeln(effName ); | |
} |
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
//Ts_DelUnUsedEffFromSel() | |
flag = confirm("選択レイヤーの未使用エフェクトを削除します。\n処理を開始しますか?"); | |
if(flag == true){ | |
var activeComp = app.project.activeItem; | |
var selectedLayers = activeComp.selectedLayers; | |
var ap=app.project; | |
var compName=""; |
OlderNewer