[Maya-Python] Re: visual studio code for maya python?

2019-09-15 Thread simon . anderson
I think what you are wanting can be found here. https://forums.autodesk.com/t5/maya-programming/maya-python-api-2-0-ide-code-complete/td-p/6239681 I have not set it up in Code, but have it setup in Pycharm. I hope that is helps Cheers, Si On Friday, September 13, 2019 at 7:47:41 AM UTC+12, Mar

[Maya-Python] Re: What does makeIdentity (Freeze Transforms) do under the hood?

2019-02-12 Thread simon . anderson
Hi Micheal, I was just having a read over what the method does, and trying it out on a few different type of objects. on an group, it just seems get the world matrix and apply it to the groups pivot. on geo, it offsets all the points by the world position of that object and then sets the pi

[Maya-Python] Re: PyMel orientJoint() usage

2017-11-19 Thread Simon Anderson
Can I ask why use pyMel, when you have a much faster and more pythonic API, om2? On Sunday, 19 November 2017 06:11:28 UTC+11, Tom Whitzer wrote: > > I am curious if anyone could provide me with an example of the the > orientJoint() function in PyMel. I have been searching online to see how to >

[Maya-Python] Re: Interactive Slider with its own Undo Chunk?

2017-10-31 Thread Simon Anderson
Hi Isai, I would suggest looking at Om2 http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__py_ref_index_html http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_GUID_AC9B3C66_90FE_493F_A7B2_44ABBA77CED2_htm I find the best way is set up some small projects that test specific areas and

[Maya-Python] Re: Interactive Slider with its own Undo Chunk?

2017-10-19 Thread Simon Anderson
Ahoy Isai, Nice implementations. For Solution 1, you could add two events one for the "click" mousePressEvent and another for the "release" mouseReleaseEvent. That way when the user clicks on the slider it stores the initial position if timer is 0, and then when the user releases the mouse it

[Maya-Python] Re: Interactive Slider with its own Undo Chunk?

2017-10-18 Thread Simon Anderson
Hi Isai, Sounds like a tricky situation, as when would the code know the user is done "tweaking" the slider and happy with the result, as you are continuesly apply the command. if you store the original state before a tweak, you will end up with a ton of undos, which is the situation you are i

Re: [Maya-Python] How to size and center my GUI.

2017-10-18 Thread Simon Anderson
This usually works for me when setting a size of a dialog. self.resize(QSize(500,300)) Try and call this inside the init method, before you call show(). -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe fr

[Maya-Python] Re: Maya 2017-- Qt5 and pyside questions.

2017-10-17 Thread Simon Anderson
I took a look at the file. It was build using pyside 1, and Maya 2017 uses pyside 2. So in order to get this to work in maya, you will have to update the file, and migrate all the pyside 1 modules and calls to pyside 2. It can be a good task, as you learn about the changes in the API. Here i

[Maya-Python] Re: Maya 2017-- Qt5 and pyside questions.

2017-10-17 Thread Simon Anderson
Looks like in you are importing the wrong module, for the version of Maya you are using. you need to import PySide2, like you do in your code snippet. In one of your modules you are importing PySide. a good rule of thumb is to implement a try, where you try import pyside2, and then if that fai

[Maya-Python] Re: help please with this error.

2017-10-13 Thread Simon Anderson
looks like your Long is meant to be long Take a look at the Qt example here, it is quiet helpful. http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_GUID_66ADA1FF_3E0F_469C_84C7_74CEB36D42EC_htm On Saturday, 14 October 2017 16:40:11 UTC+11, jettam wrote: > > > I am using maya2017. I a

Re: [Maya-Python] Re: string formatting.

2017-10-11 Thread Simon Anderson
+1 :) On Thursday, 12 October 2017 11:50:02 UTC+11, damonshelton wrote: > > I would suggest utilizing keywords rather than order - also a nice trick > is expanding locals to keep from having to specify the keywords repeatedly > > def sayHello(name=None, age=None, weight=None ): > print( "name

[Maya-Python] Re: string formatting.

2017-10-11 Thread Simon Anderson
missing the last close bracket print( "name: {0} age:{1} weight:{2}".format(sayHello)) outputString = "name: {0} age:{1} weight:{2}".format(sayHello) print( outputString ) On Thursday, 12 October 2017 11:11:54 UTC+11, jettam wrote: > > Can someone help me with this string formatting. > > def sa

[Maya-Python] Re: string formatting.

2017-10-11 Thread Simon Anderson
you need to assign the variables into the format method. def sayHello (name=None, age=None, weight=None ): print( "name: {0} age:{1} weight:{2}".format(name, age, weight) sayHello ("Allen", 20, 150) On Thursday, 12 October 2017 11:11:54 UTC+11, jettam wrote: > > Can someone help me with this

[Maya-Python] Re: help with QtGui methods.

2017-10-10 Thread Simon Anderson
I think its been moved to QWidgets in QT v5 On Wednesday, 11 October 2017 15:54:51 UTC+11, jettam wrote: > > Can someone tell me why I am getting this error. > I am running maya2017. It appears the QtGui.QDiaLog doesn't exist. Can > someone suggest what I should be looking for here instead.

[Maya-Python] Re: Atom vs Sublime editor

2017-10-05 Thread Simon Anderson
I would recommend pyCharm, and the MayaCharm plugin. Allows you to send code directly to maya and get logs directly in pycharm. I would recommend giving it a try On Thursday, 5 October 2017 18:01:03 UTC+11, Jeremy Beauchamp wrote: > > I'm fairly new to coding in Maya, but Atom has been recommend

Re: [Maya-Python] Re: How to combine two lists into a dictionary

2017-09-23 Thread Simon Anderson
you can do the following. keys = ['k1', 'k2', 'k3'] data = ['d1', 'd2', 'd3'] newDict = {k:d for k,d in zip(keys, data)} -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving

Re: [Maya-Python] Re: What does this comma do "print (Blah,)"

2017-09-22 Thread Simon Anderson
>From my understanding, str is a string representation, that one uses if they want to perform comparisons with other strings. If you create the str method it will trump the repr method when printing. repr is usualy used to show what the object represents, but wont be used in evaluations. *clas

[Maya-Python] Re: What does this comma do "print (Blah,)"

2017-09-21 Thread Simon Anderson
That is correct. From my understanding, print will query each objects _repr_ which it stores in a tuple and then prints that tuple out. The reason why the single value is not a tuple, is that you cannot create a tuple with one value. ie variableA = (), or variableA = (1) should both fail if you

[Maya-Python] Re: What am I missing here.

2017-09-14 Thread Simon Anderson
Hey, the only thing that looks a bit suspect to me is the way you are setting a variable that is outside of the method. The scope of the variable may be incorrect. Can I suggest that if everything runs correctly in your makestairs() then you return True, and then check against the returned vari

Re: [Maya-Python] recover scripting work after a crash ?

2017-09-14 Thread Simon Anderson
Like Marcuss mentioned, its gone for good. I try dev in an IDE and then just import and refresh the module in Maya. That way you dont get caught out by Maya not playing nice. On Thursday, 14 September 2017 15:24:38 UTC+10, jettam wrote: > > Well since I'm learning, this will only make me stronge

Re: [Maya-Python] Re: Import blendShape attribute map

2017-09-13 Thread Simon Anderson
Just gave it a try on a Windows machine, it works with only the single '/' On Wednesday, 13 September 2017 12:23:15 UTC+10, Simon Anderson wrote: > > Will have to give that a try when I get home. At the moment I'm on a Linux > box, and just double checked, single

Re: [Maya-Python] Re: Import blendShape attribute map

2017-09-12 Thread Simon Anderson
Will have to give that a try when I get home. At the moment I'm on a Linux box, and just double checked, singles dont seem to play fair -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and s

[Maya-Python] Re: Import blendShape attribute map

2017-09-12 Thread Simon Anderson
Hi Aren, Just from first glance, it looks like your path is incorrect. Remember to use \\ when using strings in Python. ifl='P:\\BsMaps\\half_l.tif' in the code above you have pm, not sure what that variable is meant to be in your example Tests I got working: # export # I had the UI tool op

[Maya-Python] Re: couple of userSetup file questions.

2017-09-11 Thread Simon Anderson
Q1. I have not tried this before, If there any reason why you have both, when you could have the python file call what ever is in the mel file? Q2. Have you added the see module path to your Python Path system environment variables? On Tuesday, 12 September 2017 09:01:01 UTC+10, jettam wrote: >

Re: [Maya-Python] Re: Access Maya UI in Qt way using Python API

2017-09-06 Thread Simon Anderson
Totally agree with Cesar On Wednesday, 6 September 2017 22:29:30 UTC+10, Cesar Saez wrote: > > Just a small note on Simon comments: please do not use import * (aka from > x import *) it pollutes the name space with all sorts of things and the > risk of name collisions/shadowing is very high. Als

[Maya-Python] Re: Access Maya UI in Qt way using Python API

2017-09-06 Thread Simon Anderson
Hi Ruchit, I am not sure exactly what you are asking for. Do you want to create a Qt UI that performs some maya command. Here is a small snippet that creates a label and a small window. Everything you see in the videos is all custom layouts built in Qt. from maya import OpenMayaUI as omui fro

[Maya-Python] Re: Drive things with .displaySmoothMesh

2017-08-29 Thread Simon Anderson
Have you tried connecting the shapes together using the node editor? On Wednesday, 30 August 2017 15:18:37 UTC+10, justin hidair wrote: > > I basically need the Smooth Mesh Preview of a object A to drive the one of > an other object B, .. While it's just a matter of connection for the > smoothin

[Maya-Python] Re: Having trouble nesting all instances into group.

2017-08-29 Thread Simon Anderson
You need to increment your names. I would also suggest you use the string format command, its much easier to read and handle variables name = "What ever you want to call it" instanceName="{0}s_{1}_inst".format(name, i) https://docs.python.org/2/library/stdtypes.html#str.format On Wednesday, 30

[Maya-Python] Re: beginners question

2017-08-29 Thread Simon Anderson
Hi jettam, the piece of code that is making your objects move incrementally is the: for i in range (0,10): cmds.move(x,i,z, instanceResult) if you want each block to move a specific amount per a loop: offsetPerIndex = 2 for i in range (0,10): y = i * (offsetPerIndex + 1) # 1 represents

Re: [Maya-Python] Python Noob question

2017-08-20 Thread Simon Anderson
As Justin mentioned above, it is also better to use xrange then range, as it is more efficient in memory. As it doesn't actually create a list list in memory like range() does, xrange is a generator. On Sunday, 20 August 2017 08:27:32 UTC+10, Johnathan Scoon wrote: > > Thanks Justin, you're a ro