15 Oct 2012

Nested Attributes

If you want to create nested attributes you need to take care of unique attribute names, because you can call it from the root. When you want to create an attribute with the existed name you will get an error. I had this problem when I created a really deep coumpound attribute.

In the example the sphere is a pymel object.

WRONG attribute concept name:
sphere.position.X

CORRECT attribute concept name:
sphere.position.positionX

Calling:
sphere.positionX

# =======================================================
import pymel.core as pc
plane = pc.polyPlane()[0]
plane.addAttr('sphere0', at='float3')
plane.addAttr('sphere0pos', at='float', p='sphere0')
plane.addAttr('sphere0rot', at='float', p='sphere0')
plane.addAttr('sphere0scl', at='float', p='sphere0')
# =======================================================

11 Oct 2012

What is DAG node

A really basic word in rigging and it is usefull to know what is it originally. In Maya, a directed acyclic graph (DAG), defines elements such as the position, orientation, and scale of geometry. The DAG is composed of two types of DAG nodes, transforms and shapes. Transform nodes-Maintain transformation information (position, rotation, scale, etc.) as well as parenting information. For example, if you model a hand, you would like to apply a single transformation to rotate the palm and fingers, rather than rotating each individually-in this case the palm and fingers would share a common parent transformation node. Shape nodes-Reference geometry and do not provide parenting or transformation information. In the simplest case, the DAG describes how an instance of an object is constructed from a piece of geometry. For example, when you create a sphere, you create both a shape node (the sphere) and a transformation node that allows you to specify the sphere's position, scale, or rotation. The transformation node's shape node is its child.

21 Sept 2012

Digic Pictures

Hi everybody!

I left Glasgow with so many memories. I said hello to my friends. Thanks a lot guys especially Marco Godinho you were the best mentor in my life. I took a little relax and now I want to share the news, I've started at a new company at Digic Pictures as a rigging/pipeline TD. I think it will be a big challange.

23 Jun 2012

Python tipps and tricks

Class Attribute vs. Instance Attribute

I will show what is the difference between class and instance attribute. If you have some instances the class attribute will be affected by all of them, but the instance attribute just by the own instance.
1
2
3
4
5
6
7
8
9
10
11
12
class Name ():
   count = 0
   def __init__ (self, name):
      self .name = name
      Name.count += 1

man1 = Name('David')
man2 = Name('Jozsi')
print Name.count
# Result: 2 #
print man2.name
# Result: 'Jozsi' #


Lambda function bug

Sometimes the lambda function does not want to work. You do everything on right way but you've got error.

1
2
3
4
# If it's not working:
lamda x: call_function()
# Try this:
lamda : call_function()


For statement an other way

Today I learnt a new way to use 'for' statement. It is really useful if we want to give a simple function to every item:

1
2
3
4
5
# We have a list
lst = ['a_1', 'b_2', 'c_3']
numbers = [str.split('_') for str in lst]
# equivalent with this:
numbers = map ( lambda str: str.split('_')[1], lst)


Map function

There is the "map" function in pyton that is very handy. I show how it works.

1
2
3
4
5
6
7
8
9
10
# Example 1.
# We define a function first.
def myFunction (input): return input+1
result = map (myFunction, [1,2,3,4])
print result[1]
# Result: 3 #

# Example 2.
map ( lambda x : x+1, [1,2,3])
# Result: [-1, 1, 3] #
"map(f, sequence)" is directly equivalent with: "[f(x) for x in sequence]"


Class inheritance

I wrote a little template for class inheritance with super function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class A (object):
   def __init__ ( self , name= 'alma' , *args, **kwds):
     super (A, self ).__init__( *args, **kwds )
     self .name = name
   def getName ( self ):
     print self .name

class B (A):
   def __init__ ( self , number=12 , *args, **kwds):
     super (B, self ).__init__( *args, **kwds )
     self .number = number
   def getNumber ( self ):
     print self .number

b_object = B()
b_object.getName()
# Result: 'alma' #


SetAttr command

I wrote a script some days ago and I had a problem with cmds.setAttr's keyable flag. If you want to lock and hide a double3-type-attribute you need to set separately each attribute.

# Wrong:
cmds.setAttr('pCube1.t', k=False)
# Correct:
for axis in ['x', 'y', 'z']:
  cmds.setAttr('pCube1.t'+axis, k=False)


1 May 2012

Eclipse plugin: Umlet

It's a great plugin for ecplise to show a flow about your program. No more comments, just check the link and videos. Enjoy!
http://www.umlet.com/

19 Apr 2012

3 vs 1 channel node attribute

We found a new bug in maya.  If you want to connect maya nodes, create connection directly between one-one channel. Sometimes Maya gives wrong value if you connect compound attributes.
Wrong
Correct

7 Apr 2012

Skeleton connection

I have seen a lot of tutorials to solve connections between joints with parent constraint. I think is bad because if you want to animate the switching the translation has a linear movement and this is very bad. Check the pictures what I am speaking about.
I suggest to use blend nodes for purpose. There are twoBlendAttr or blendColors nodes. The twoBlendAttr is useful between only two attributes and the other one is for compound attributes. So now we will use blendColorAttr node to connect two joints.

And the result is that we wanted.

I hope it is handy for you.

3 Apr 2012

Resident Evil Raccoon City

I could work on 4 shots of Resident Evil: Raccoon tv spot. The first and last two shots exactly.
I rigged the zombies, the runner and the big muscular guy. :)
Enjoy! Click here for the link.

27 Feb 2012

Maya bugs and solutions

Save Maya files
Maya has a little bug to save out data to network. actually it's not a bug just too slow. At every company the data is written to the network nobody works with local data. The solution is nice and easy. Just save the file to the local space afterwards copy to the right place and delete the temporary file. Of course this is useful in case the data saving is automatized. The difference is quite massive.
Cheers Marco the notice.

31 Jan 2012

Aptana Studio/Eclipse set up

I write a little description how you can create a good workspace for programming. I am using Aptana for purpose because it contains a lot of useful features.

Step 1.
Install Aptana:http://www.aptana.com/products/studio3/download
or eclipse: http://download.eclipse.org/eclipse/downloads

Step 2.
Install pydev. Go to Help → Install Software
You should add this url: http://pydev.org/updates

Step 3.
Adding interpreter to the application.
For Maya 2011 add C:/Program Files/Autodesk/Maya2011/bin/mayapy.exe
Check all checkboxes, but remove site-packages path afterwards add
(Path To Your Pymel/pymel-1.0.2)/extras/completion/py/
and finally add back the site-packages path.Check on the picture the order.


Step 4.
Window→ Open Perspective→ Other…→ Pydevmake sure that the PyDev Package Explorer is open: Window→ Show View→ Pydev Package Explorer
In the Pydev Package Explorer, Right click and select New→ project→ Pydev(folder)→ Pydev Project


Step 5.
Right click on the project in explorer, Import→General→File system


Step 6.
Follow the setup based on picture. You can add filters, if you want.

Step 7.
Adding new file to the project:
New→Pydev module

29 Jan 2012

Aliens: Colonial Marines

A new teaser came out that was made by us. I worked on alien drone and some marines. Check it out!
Aliens teaser

4 Aug 2011

Transform or Shape selection

There is a little bug in maya. You have a hierarchy and a transform node is referenced. If  you have under this node mesh, curve or surface with multiplied shape you can't select the transform node in panel-view just the shape. (You can select just in outliner)
The solution you need to make reference the shape whenever possible.