Print cmds.file(query=True, sceneName=True) Set workspace Sometimes you need to retrieve the current workspace directory, a.k.a. If cmds.window(window_name, q = True, ex = True): Super(UiClass, self)._init_(parent=parent) Max_syllables = int(random.random() * 4)+1Ĭlass UiClass (MayaQWidgetDockableMixin,QWidget): Handling close events: class Ui (MayaQWidgetDockableMixin, QWidget):Ĭomplete example: import maya.cmds as cmdsįrom import MayaQWidgetDockableMixin Still, one had to use classes, but this is the bare stuff. Fortunately this is not so true: from PySide import QtGui Get Shading Group from material sg = cmds.listConnections('material_node', type='shadingEngine')Īre incredibly complicated, if you search around the webz. Mat = for se in node.getShape().outputs(type='shadingEngine')] Pymel oneliner for aquiring material import re as pm Shading_group=ts(renderable=True,noSurfaceShader=True,empty=True)Ĭmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' %shading_group)Ĭmds.connectAttr('%s.outColor' %file_node, '%s.color' %shader)Ĭmds.setAttr(file_node+".fileTextureName", "texture.png",type="string")Ĭmds.sets("myobject",e=True,forceElement=shading_group)Īpply a sg to faces: ts(', 'new.f'], e = True, forceElement = 'sg') shader=cmds.shadingNode("phong",asShader=True)įile_node=cmds.shadingNode("file",asTexture=True) Probably not elegant, but this is the whole shebang of creating a shader, shading group and texture and assigning it to something. Maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM) Message = 'import mymod as mod mod.run()' This is pretty straightforward, but there is one evil thing: when I talked from blender to Maya, blender's python version wanted to send encoded strings. The command port might be really useful for remote controlling maya from other apps. Get object of shape (actually, the parent - since the transform is the parent of the shape, this will return the transform):Ĭmds.listRelatives( "pCubeShape1", allParents=True ) Command port The -type flag is only required when setting a non-numeric attribute.Print cmds.ls("yourpattern*",showType=True) The attribute is needed when the -l/-k/-s flags are used. Sets the value of a dependency node attribute. SetAttr is undoable, queryable, and editable. Note: Strings representing object names and arguments must be separated by commas.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |