I am going a bit slow on my rigging framework since I decided to redesign my website (maulik13). I needed more space to put some content and share some of my scripts. And I wanted to add a simple database so that I can update downloads and portfolio easily. It's taking some time, but I have finished the new logo, layout, colors, login and database connectivity. So hopefully I will have my downloads section up and running live soon.
edit:
I just forgot to mention that I am using codeigniter php framework for my website and I am loving it. This is one of those few frameworks that I absolutely appreciate because of its ease and smooth learning curve. Hopefully I can get those characteristics in my rigging framework as well.
22 June, 2010
21 June, 2010
Rigenerator: Rules Based Graph Traversal
It is not very difficult to traverse the whole graph in Maya and make a data structure to be able to analyze it. In "Rigenerator" I can select one node in the outliner and I am able to get all the nodes related to it in anyway possible. The next step I want to add is to be able to specify rules in the graph traversal algorithm so that I can restrict the network within the specified hierarchy. This is so that my "Rigenerator" tool can extract only a part of the rig.
My goal is to come up with some kind of short hand notation for specifying these rules. I am trying to come up with different possible scenarios to be able to generalize these rules. So for example, I can specify levels and combine it with a node type(s) and their relationships with the source node. This is just theory and hopefully I can find some way to implement this idea.
My goal is to come up with some kind of short hand notation for specifying these rules. I am trying to come up with different possible scenarios to be able to generalize these rules. So for example, I can specify levels and combine it with a node type(s) and their relationships with the source node. This is just theory and hopefully I can find some way to implement this idea.
06 June, 2010
Rigenerator: Rig Code Generator, Milestone 1
Rigenerator is one of the toolsets from my modular rigging framework (which is still in very very early stage). My goal with this tool is to help riggers speed up the coding and modularizing of the rig components. This can also be used for copying, mirroring rigs of any kind. The first step for this tool is to generate the raw code which is the same as .MA file commands. There are some very useful functions in API to generate a lot of code directly (e.g. setAttr commands for given plug, check MPlug class). You can check an example plugin called MA exporter in devkit. Later based on this raw code this tool allows to organize it and add modularity.
In my previous planning, I wanted to work on this tool at a later stage. But, since I have to create many rig parts for the framework, I thought I would actually finish Rigenerator first. So I can create rigs in different ways and whichever I find the best, I can convert it into code using this tool. This will speed up the coding process for my rigs.
I have reached the first Milestone for this module. I am able to generate the raw commands to regenerate the rigs. I have planned many features for this tool which includes, mirroring, code analysis/modification, dg graph inclusion/exclusion options, mel or python options, etc. I will post more on this as I make some progress.
In my previous planning, I wanted to work on this tool at a later stage. But, since I have to create many rig parts for the framework, I thought I would actually finish Rigenerator first. So I can create rigs in different ways and whichever I find the best, I can convert it into code using this tool. This will speed up the coding process for my rigs.
I have reached the first Milestone for this module. I am able to generate the raw commands to regenerate the rigs. I have planned many features for this tool which includes, mirroring, code analysis/modification, dg graph inclusion/exclusion options, mel or python options, etc. I will post more on this as I make some progress.

02 June, 2010
Parenting a Shape the Right Way
I had written a script some time ago to parent a shape to a given transform. I took into account frozen transformation on both source and target. However, script would not place the shape on to pivot point of the target in some cases. Recently I fixed this script as I need to use it quite often. I had to change the logic compeltely to parent a shape to account for different orientations on the source(s) and the target. The main idea is to match the pivots of both the objects before parenting. I will make this script avaiable for download once I create a download section on my website (hopefully very soon). Meanwhile if you need to try this script let me know and I will send it to you.
06 May, 2010
Conditions: No Need for Extra "else"
Sometimes when I am writing code quickly and jumping between functions, I miss a bit obvious logic and end up having multiple "else" statements. Below are two examples doing the same thing. Here the logic itself is not important, this is just to make a note.
In above example, two else conditions are unnecessary and messy. Concise version,
... if trueKey != "": modObj = pkgDict[trueKey] if modObj.__dict__.haskey(className): return modObj.__dict__[className] else: return None else: return None
In above example, two else conditions are unnecessary and messy. Concise version,
... if trueKey != "": modObj = pkgDict[trueKey] if modObj.__dict__.haskey(className): return modObj.__dict__[className] return None
30 April, 2010
Python: Import a Module and Get a given Class
Python offers different ways to import a module. The most flexible one is to use __import__ function. This allows script to load a module dynamically. So we can load a particular module based on user input.
Since everything in python is an object even the python module has some useful properties. One of them is __dict__ property. This is how you can use it.
Edit:
This logic works if you are using just modules. For packaging this may need to be modified.
Since everything in python is an object even the python module has some useful properties. One of them is __dict__ property. This is how you can use it.
className = 'MyClass'
modObj = __import__('moduleName')
# This gives us the class reference
MyClass = modObj.__dict__[className]
# So we can create class instance like this
inst = MyClass(params)Edit:
This logic works if you are using just modules. For packaging this may need to be modified.
Modular Rigging System : Goals
As I have started writing my modular rigging system, I am constantly thinking about the main goals. I feel that at each stage as I put a concept on paper or write code that should satisfy the main goals. After a lot of thinking I have decided on the following goals,
So any module that I create can be changed or replaced. This will create very minimal core modules. We are not really defining the logic of rigging in the core modules. I think the core modules define the concept of modular rigging. And the modules that has some common logic for rigging are defined in core utility modules. Hence the core system modules represent only the idea of the modular rigging system.
Rigging modules should not be constrained to a personal workflow.
Example:
In general, there is a template system that lets us define blueprint of the rig and then we create joints and rig on top of it. So roughly there are three parts to this system, locators(guides), joints(skeleton), rig(controls). But,
what if I already have my joint chains created manually? What if I have my own guide system? or I want to change the way animation controls are aligned or created? etc...
There is really no right or wrong way to do things here. But I am doing my planning based on what I think a modular system should be.
- One should be to be able to change/extend pretty much everything in the system
- All the parts of the system should be as much independent as possible
- Whenever possible not be specific to Maya
- Editable template/skeleton/rig at any stage
So any module that I create can be changed or replaced. This will create very minimal core modules. We are not really defining the logic of rigging in the core modules. I think the core modules define the concept of modular rigging. And the modules that has some common logic for rigging are defined in core utility modules. Hence the core system modules represent only the idea of the modular rigging system.
Rigging modules should not be constrained to a personal workflow.
Example:
In general, there is a template system that lets us define blueprint of the rig and then we create joints and rig on top of it. So roughly there are three parts to this system, locators(guides), joints(skeleton), rig(controls). But,
what if I already have my joint chains created manually? What if I have my own guide system? or I want to change the way animation controls are aligned or created? etc...
There is really no right or wrong way to do things here. But I am doing my planning based on what I think a modular system should be.
29 April, 2010
Being Pythonic
I mentioned in my earlier post that we can assign a tuple/list to multiple variables. However both number of elements should match on both sides. One of the options is to assign only fixed number of elements to variables like this
mylist = [1,2,3,4,5] x,y,z = mylist[:3]mylist[:3] will return 3 elements from the beginning.
28 April, 2010
Being Pythonic
Tuple is a very important data structure in python. You can directly assign tuple elements to variables like this.
Tuple assignment
tup = (3,'xyz',[1,2,3]) ind, myKey, myList = tupThis is called unpacking. It is wise to do this only on tuples since they are immutable and it is sure that the number of elements being unpacked is same as the number of variables on the left side. This can be very useful when using *args and **kwargs. More on that later.
Use negative index
myList[-1] returns the last element
And Now I am a Python Fan
I was a little hesitant towards learning one more language since I get mixed up easily after working with many different languages: c, c++, ActionScript, mel, php, .Net, qlikview and now python (no boasting but I get surprised myself thinking what human brain can do). For example,
String concatenation,
Defining functions,
However, after learning python I am thinking about making it my main focus amongst all programming languages. The ease of use, elegant syntax and flexibility to create magic is what sets this language apart from other languages. However, I don't claim it's the best language out there, but it surely is powerful and different in a way that I have started loving it.
Since I am still young in using python I thought it would be a good idea to post tricks and helpful language features that I learn on my own or from others.
String concatenation,
php : $str1.$str2
c++: str1 + str2
vb: str1 & str2
Defining functions,
mel : global int[] proc getMyAnts(string $place)
c++: int* MyClass::getMyAnts(MString place)
python: def getMyAnts(self, place)However, after learning python I am thinking about making it my main focus amongst all programming languages. The ease of use, elegant syntax and flexibility to create magic is what sets this language apart from other languages. However, I don't claim it's the best language out there, but it surely is powerful and different in a way that I have started loving it.
Since I am still young in using python I thought it would be a good idea to post tricks and helpful language features that I learn on my own or from others.
Subscribe to:
Posts (Atom)