Showing category "C in Maya" (Show all posts)

Understanding 'with' in Python

Posted by Jeremy YeoKhoo on Sunday, November 30, 2014, In : Python 
I've found a link to giving a very detailed and simple to understand explanation using the statement 'with' in python, and to summarise...Well if we use 'with', python will close the function that is called within the body of with. Say for an example using the in built function of open in Python, usually you will need to close that function. With 'with', Python does that for you. Simple.
with open("x.txt") as f:
  data =
  do something with data

Continue reading ...

Multithreading your plugins

Posted by Jeremy YeoKhoo on Tuesday, September 23, 2014, In : C++ in Maya 
Ok, since I started compiling a plugin, let's talk about multi-threading. 

Autodesk has a good description of multi-threading and 

Continue reading ...

Compiling a C++ plugin for Maya

Posted by Jeremy YeoKhoo on Monday, September 22, 2014, In : C++ in Maya 
Recently I had a hand in finally trying out compiling a plugin for Maya. Here's a bit of information regarding the setup. I am using Maya 2014, Windows 7 and Visual Studio Express 2013. 

So Visual Express 2013 is a free version of Studio Express and for a lone developer, it is free from Microsoft. Kudos to Microsoft because I have to say that they are changing for the better and the userbase is starting to benefit. 

You can get Studio Express here:
Studio Express 2013

And here is another interest...
Continue reading ...

Create joints between startJoint and endJoint

Posted by Jeremy YeoKhoo on Friday, May 23, 2014, In : Python 
Hey guys, here is another simple script that I have found invaluable. Basically whilst rigging, I find that numerous times I need to create 'midJoints' between a startJoint and an endJoint. 

Here it is, feel free to use it around where you see fit in your everyday toolsets.

import maya.cmds as cmds
import maya.OpenMaya as OpenMaya

def createMidJoints(startJoint, endJoint, steps= 2):
  sPos= cmds.xform(startJoint, q=1, ws=1, t=1)
  ePos= cmds.xform(endJoint, q=1, ws=1, t=1)

  vecA= OpenMaya...

Continue reading ...

PEP8: Style Guide for Python

Posted by Jeremy YeoKhoo on Saturday, May 10, 2014, In : Python 
I thought I might mention PEP8 which is basically a style guide for writing your code in Python. Here\s the link:
PEP 8 -- Style Guide for Python Cod

Continue reading ...

PyCharm and VCS

Posted by Jeremy YeoKhoo on Saturday, April 26, 2014,
So this might be old news to you folk out there, but I use an IDE (Integrated Development Environment) to edit my code. And Eclipse is too much of a behemoth to behold, and thus enter pyCharm Community Edition. I have been using this awesome software for about 6 months now as recommended by a colleague of mine. 

Working as a freelancer, I use different platforms to update my own personal code, so versioning would be a very handy tool, which pyCharm has its own version control system (VCS) in p...
Continue reading ...

Maya's Python API 2.0.

Posted by Jeremy YeoKhoo on Thursday, April 17, 2014, In : Maya API in Python 
This is by now a bit of old news. But I am going to spend more time on this blog updating and releasing more of my code onto the interwebs. So here it is. Autodesk Maya has released a new python friendly API since their Maya 2013 release where you can easily access by importing their module 

import maya.api.OpenMaya as api
To this effect, they claim that using their python api is virtually 2 to 3 times faster than using their old api version. Remember that the original API is a python wr...
Continue reading ...

Setting your Maya Shelf for Multiple Users

Posted by Jeremy YeoKhoo on Wednesday, April 9, 2014, In : MEL 
Instead of explicitly coding all your , lets say your icon paths, you can query Maya to return the location of your preferences pathname during startup. This way you can set your own custom path that can be picked up from multiple users during maya startup.

global proc shelf_soup(){
  string $appver= `about -preferences`; 
  string $soupIcon= ($appver + "/prefs/icons/soup/");
	//Or wherever the shelf location might be
	//Other useful commands are `getenv "MAYA_APP_DIR"`

Continue reading ...

Autodesk's Tutorials - Creating Python plugins in Maya

Posted by Jeremy YeoKhoo on Tuesday, October 9, 2012, In : Tutorials 
Here is a basic how-to create python plugins in Maya. I find this tutorial very informative and covers very concisely on creating plugins.
Continue reading ...

Pipeline Abbreviations

Posted by Jeremy YeoKhoo on Saturday, April 14, 2012, In : Pipeline 
For my own personal use....

The following abbreviations is an index list of abbreviations used for the jykTools pipe.

SDM - subdiv divisable mesh
GRP - group (prefix descriptor)
NUL - null
BLN - blinn
SDR - shader
DEF - deformer 


Continue reading ...

MVector class using MScriptUtil()

Posted by Jeremy YeoKhoo on Monday, March 5, 2012, In : Maya API in Python 
As per the example in the previous blog entry. You can use one of Mayas API classes to translate a python array data variable to something that the MVector class can read. (remember SWIG and C++ ...)

import maya.OpenMaya as ommyArray= om.MScriptUtil()
myArray.createFromList([1.0, 1.0, 1.0], 3)

vec= om.MVector( myArray.asDoublePtr() )
print vec.x vec.y, vec.z
Continue reading ...

The MVector class in Python

Posted by Jeremy YeoKhoo on Monday, February 27, 2012, In : Maya API in Python 
Ok, so we're trying to use a vector data variable within our tool development using Maya API. 

import maya.OpenMaya as om
myVec= [ 0.0, 1.0, 2.0 ]
VecA= om.MVector( myVec )

# Error: Wrong number of arguments for overloaded function 'new_MVector'.
This would work if we directly parse arguments into the MVector class with:

VecA= om.MVector ( 0.0, 1.0, 2.0 ) 

This is because the Maya API is written in C++. The python component translated into the API is being handled by SWIG within ...

Continue reading ...

Introduction - Maya API

Posted by Jeremy YeoKhoo on Monday, February 27, 2012, In : Tutorials 
This webpage of Maya tutorials is set to in a blog format. At the moment, I am teaching myself Maya API in Python, to become more a proficient as a Character/Creature Technical Director. The Maya API will provide many tools more so than what MEL commands can provide. This will allow a more efficient toolset to a specific task. Feel free to leave some comments.

Continue reading ...

About Me

Character TD and Creature TD with some generalist skills