How to stop Maya from asking for network connection (OS X)

For some reason, Maya isn’t allowed to receive network connections without manually letting it by choosing “Allow” or “Deny” in the firewall pop up message. Even if it is listed as “Allow” in the firewall preferences, it asks again every time.

I’m not sure whats causing this behavior, but it sure is annoying. Finally I found a solution for it!

It has to do with “code signing” and something the developer has forgotten to do after changing the application, I don’t know.

I’m not as paranoid to think that someone has altered the code without my knowledge, so I trust the code from Autodesk and sign it myself to stop receiving this message. I’ll route you to the blog where I found the solution here:

Silvanote blog post

I’ve heard people have similar problems with other applications as well, like iTunes.

I take no responsibilities for this solution, it’s totally up to you!

Advertisements

Python scripting in Maya week 2

What I forgot to tell you in the last post is how to actually execute the code
in the script editor.
To keep the code you’ve written, select the text first, then press ctrl+enter.
This executes the code, but does not clear the editor.
Just a little tip. Let’s get on with Python in Maya!

in a command such as scale, we can see from the MEL that it has a parameter in
the beginning called -r then a three value numeric parameter to follow.
This has nothing to do with the -r, because the -r (-relative) in MEL is just
a boolean value meaning “True” in Python. The parameter signals a relative
scale, not an absolute scale.
Therefor we must write it as so in python:

scale(4,5,4,r=True)

The reason for putting r=True last in the list is because it is a keyword
argument, and in Python you must put it last if the other arguments are not
also keyword arguments.
Because the relative attribute is set to True, this command can be repeated
to add the same size to the object. Try it out.

Let’s make a script that creates a nicely beveled cube that we can use as
dice or something. I always bevel the edges slightly anyway, so why not have
a script in the shelf that does it for me.

In the script editor, type in the following:

polyCube(w=4,h=4,d=4)
polyBevel(offset=0.10,fillNgons=True,segments=3,smoothingAngle=30)

The first line creates a cube with 4 units in xyz, and the second line bevels
the cube with some adjustments so that it gets smooth and nice.

To place this as a tool in one of your shelves, just select the code from the
script editor and middle mouse drag it into the shelf.

You can now create small scripts to create elements you use often in your scenes,
such as lighting setups, planes, cameras, you name it. That’s a nice start.

Try to create and do different things in Maya with the script editor open, then
try to “translate” the MEL output into working Python code.

Until net time…

First post about Python scripting in Maya

This is the first post in a planned series of posts about Python scripting in
Autodesk Maya. Don’t expect this to turn you into a pro or something, this is
something I do to learn the material better myself.
I don’t know about your experience with Python, but this is not meant to be
a tutorial in the python language. I’ve used Python for some time now, and
I hope you are familiar with the language to get something out of the content.
You can probably do basic stuff without knowing the ins and outs of Python,
but to do something creative you must have some knowledge about the
different datatypes and constructs that defines Python.
One thing that also is important is that you understand the basics of how MEL
works, as most of the same applies to Python for Maya.
Well, let’s get started!

Getting access to Python in Maya

You can use Python either as a single command launcher from the command line,
or as a full scripting environment in the script editor, I’ll mention both in
sequence.
To start using Python in Maya you have to click the command line where it says
“MEL”. This will change into “Python”, and for one-shot commands this is all
you need.

To access Python through the script editor, click the script editor button
also on the command line, next to the output field.
There you’ll see to tabs, MEL and Python. Off course you should choose Python,
but you already knew that!
In the script editor I also choose “Command” -> “Command Completion” and
“Command” -> “Object Path Completion”.
This makes experimenting with Python a lot easier, as you can try out
different functions without knowing the names.

One thing you should be able to do is to transform MEL commands into Python,
so that you can download existing scripts, modify them to your needs and run
them in Python. Most of the scripts out there are still MEL, but py scripts
start to show up here and there.
I’ve always wanted to learn MEL, but it didn’t really make sense to me, so I
find the Python logic easier to grasp. Besides I use it for other tasks, so
I don’t have to learn a whole new language and tools.

Let’s make a polygon cube!
Let’s see, if I watch my script editor output while creating a cube I see that
the MEL needed for this is:

polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;

Well, it’s actually not that complicated but this is all the default arguments
used by MEL in the output. The same cube will appear by just typing:

polyCube

Try that in the command line by changing back to MEL and press enter. Whee!
But hey! This is not Python… True. Lets try to switch back to Python
and run:

polyCube()

as all function calls ends with parentheses.
This does not work, because we have to import the namespace that the Maya
commands live in. We can do that by:

from maya.cmds import *

This makes a bunch of frequently used commands accessible to Python.
Now we can try again with:

polyCube()

or, for a change, let’s say that we wanted to change the defaults. Look back
to the MEL command used to create the polyCube. -w 1 -h 1 -d 1 etc.
All these define width, height, depth, sizeX, sizeY, sizeZ and so on.
To access these preferences in python, we have to write it as arguments
with a value in the construction call:

polyCube(w=2,h=3,d=4)

This creates a different cube with changed parameters.

Well, this wasn’t much but I’ll post more soon!
Try creating different shapes with different attributes to get a feel for how
it works.

Have a nice one!

Scripting Maya with Python

This is the introduction to a series of small tutorials I’m going to make while learning to use Python in Maya.

I always learn stuff better if I try to teach what I learn to others while doing it. Maybe someone out there will find use for my experiences!
To start with I want to explain why I want to learn to use Python with Maya.
For some years now, I’ve used both Python and Maya occasionally, just as a hobby.
I am by no means an advanced user of Maya, but I find the software incredibly fascinating.
You can do so much cool stuff with its modules, like the nCloth module, the dynamics and fluids modules, hair and fur, Maya Muscle,
I could go on and on. Incredibly complex software. It’s also very demanding and difficult to learn properly.

People spend years of working with it without learning everything. You just can’t expect to master all aspects of the software, but
that’s not my goal either.
I like to model objects, set up the shaders and render settings and watch the results. Animation is also something that Maya does maybe best in the industry, so a bit of that is also something I like to spend time doing.
When it comes to Python, I learned some of it while working as a network administrator, using it for system scripting mostly.
I’ve never felt the need for extending Maya with anything, because I have plenty to learn before ever needing to customize anything myself.

So basically this project with learning how to use Python to script Maya is purely for entertainment.
But, who knows? Maybe I find it so interesting that I can start writing plugins. Or maybe I come across a situation where I miss a certain modeling tool or want to change how the defaults are working, then it would be nice to
roll my own little script instead of relying on others work on places like creativecrash.com.

Anyway, if you’re new to the world of scripting Maya with Python, the upcoming posts to this blog might get you in the right direction of learning it!

So, until next time, sharpen your senses.