maya

How to create Maya sliders to move objects in interface

久未见 提交于 2019-12-02 08:45:36
I am trying to use sliders to move objects along the x,y and z axis. This is my code so far: import maya.cmds as cmds cmds.columnLayout( adjustableColumn=True ) cmds.intSlider(min=-100, max=100, value=0, step=1, dc = cmds.move(x=True)) cmds.showWindow() I keep getting this error # Error: line 1: TypeError: file <maya console> line 10: Invalid arguments for flag 'dc'. Expected string or function, got NoneType # I am very new to Python so I am not sure what it means. Many Thanks, Martyn you have to create a function containing cmds.move() import maya.cmds as cmds from functools import partial #

How to store the value of floatSliderGrp in Python Maya

拜拜、爱过 提交于 2019-12-02 04:54:06
I have a slider that goes from 1 to 10 and I want to store the value that the user chose with the slider every time. I want the value to get updated with the movement of the slider. This is what I have so far def PrintValue(): print value cmds.floatSliderGrp(label='Angle', field=True, minValue=0.0, maxValue=10.0, value=0 ,dc=PrintValue(PASSVALUE) ) I want to pass the value where the PASSVALUE argument is, is there a way to get the value from the slider? theodox 'value' is a flag for the floatSliderGrp -- not a variable. That's why you can't print it directly. Depending on what you want to do,

#跟着教程学# 6、maya/python window命令

。_饼干妹妹 提交于 2019-12-02 03:02:53
window 命令可以创建一个新的窗口,但是不显示它。需要使用 showWindow 命令显示。注意:如果窗口需要一些控件布局来布置控件(buttons按钮,sliders滑块,fields字段等),控制布局的命令,例如columnLayout,formLayout,rowLayout等。 maya实例: 1、创建一个新的窗口。 import maya.cmds as cmds # Make a new window # window = cmds.window( title="Long Name", iconName='Short Name', widthHeight=(200, 55) ) cmds.columnLayout( adjustableColumn=True ) cmds.button( label='Do Nothing' ) cmds.button( label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)') ) cmds.setParent( '..' ) cmds.showWindow( window ) 2、调整maya主窗口大小。 # Resize the main window 调整maya主窗口 # # This is a workaround to get

Python - Re-Implementing __setattr__ with super

不想你离开。 提交于 2019-12-01 20:32:00
I know this one has been covered before, and perhaps isn't the most pythonic way of constructing a class, but I have a lot of different maya node classes with a lot @properties for retrieving/setting node data, and I want to see if procedurally building the attributes cuts down on overhead/mantinence. I need to re-implement __setattr__ so that the standard behavior is maintained, but for certain special attributes, the value is get/set to an outside object. I have seen examples of re-implementing __setattr__ on stack overflow, but I seem to be missing something. I don't think i am maintaining

How do I compile multiple py files as one?

别来无恙 提交于 2019-12-01 18:08:01
I am new to Python and am totally lost as to where to even start to get this done. I have written many small modules (a toolset for maya) that need to be compiled into on single .pyc file. Is there a module that just does this? Or can you tell me where to go to start? A tutorial? I don't even know what terms to look for. theodox You don't even need to make an egg, you can just zip up your files and put the zip file onto your python path. Maya's version of python includes the zipimport module by default so it 'just works' as long as maya can find your zip file. Here are some discussions of the

How do I compile multiple py files as one?

五迷三道 提交于 2019-12-01 17:52:59
问题 I am new to Python and am totally lost as to where to even start to get this done. I have written many small modules (a toolset for maya) that need to be compiled into on single .pyc file. Is there a module that just does this? Or can you tell me where to go to start? A tutorial? I don't even know what terms to look for. 回答1: You don't even need to make an egg, you can just zip up your files and put the zip file onto your python path. Maya's version of python includes the zipimport module by

How to get from Maya event of a change highlight objects in the scene?

依然范特西╮ 提交于 2019-12-01 14:06:32
I'm using: Maya2014 + pyqt4.8 + python2.7 I'm doing an application which allows you to speed up and simplify the selection of items in Maya. Is a selector which the user can attach to how the objects in the scene. Selection of objects in the window leads to the separation of objects in the scene. but on the contrary I can not find how to do. How to catch an event that occurs when changing the selection of objects in the scene and process it further its program? I really recommend if you doing a pretty heavy stuff then stay away from scriptjob. I prefer to go with API def test(*args, **kwargs):

How to store and then retreive parent-child dependency data (Maya MEL/Python script)

泄露秘密 提交于 2019-12-01 13:20:45
I have a hierarchy that I need to: break apart doSomething() put it back together the same way it was before. I know how to break things for sure, and have plan about what I need to do when they are flat in hierarchy. The problem is how do I parent them back? Details This is related to my previous question: Freeze scale transform on a parent object with animated child (MAYA MEL/Python script) I need to freeze scale transforms on all nodes in a hierarchy. Problem is that nodes have translate animations on them, and if I try to freeze scale on a parent node, it's child animation gets weird.

Loading Maya model with Three.js

别说谁变了你拦得住时间么 提交于 2019-12-01 11:58:29
I am following this tutorial on how to load Maya models with Three.js. Everything is fine, but tutorial only explains how to load models with one texture. Here's the source code from the tutorial: function createScene(geometry, x, y, z, scale, tmap) { zmesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture(tmap)})); zmesh.position.set(x, y, z); zmesh.scale.set(scale, scale, scale); meshes.push(zmesh); scene.add(zmesh); } Full JS Live Link var SCREEN_WIDTH = window.innerWidth; var SCREEN_HEIGHT = window.innerHeight; var container; var camera, scene; var

Loading Maya model with Three.js

允我心安 提交于 2019-12-01 10:54:00
问题 I am following this tutorial on how to load Maya models with Three.js. Everything is fine, but tutorial only explains how to load models with one texture. Here's the source code from the tutorial: function createScene(geometry, x, y, z, scale, tmap) { zmesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture(tmap)})); zmesh.position.set(x, y, z); zmesh.scale.set(scale, scale, scale); meshes.push(zmesh); scene.add(zmesh); } Full JS Live Link var SCREEN