Archive for the 'Tutorials And Tricks' Category

31
May
14

Setting up a VS 2010 C++ Project for a Maya 2014 Plugin

Hello again!

Today I’m going to write a few instructions to setup a C++ project on Visual Studio 2010 so you can create a compile a plugin for Maya 2014.

First thing. Make sure that Visual Studio has the Service Pack 1 installed. Otherwise, even with everything perfectly set up you may get this error when building: LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

The Plugin wizard doesn’t work, at least for me, so I’ll explain how to setup an empty C++ project and make it work with the Maya API.

I’m working on Windows 7 x64 so make sure the VS project is set for x64.

To get to the Project Properties on Visual Studio you can either righ click on the Project in the Solution Explorer or click on Project>Properties in the menu.

First thing we need to do is go to “Configuration Properties” “General” and set “Target Extension” to “.mll” and make sure that “Configuration Type” is set to “Dynamic Library (dll)”.

vs1

Then, on “VC++ Directories” add the following directories:

  • On “Executable Directories” add “C:\Program Files\Autodesk\Maya2014\bin”
  • On “Include Directories” add “C:\Program Files\Autodesk\Maya2014\include”
  • On “Library Directories” add “C:\Program Files\Autodesk\Maya2014\lib”

vs2

Next on “C/C++” and “General” add “C:\Program Files\Autodesk\Maya2014\include” on “Additional Include Directories”.

vs3

Next make sure “NT_PLUGIN” is on “C/C++” “Preprocessor” “Preprocessor Definitions” list.

vs4

Then on “Linker” “General” add the path “C:\Program Files\Autodesk\Maya2014\lib” to the “Additional Library Directories”.

vs5

Next, on “Linker” “Input” add the following libs to the “Additional Dependencies” list:
OpenMaya.lib
OpenMayaAnim.lib
OpenMayaRender.lib
OpenMayaFX.lib
Foundation.lib
OpenMayaUI.lib
Image.lib

You don’t need them all if you are writting simple plugins and may need additional if you are writting something specific. But those are enough for a simple deformer plugin.

vs6

And that is all. This should be enough for your plugin to compile.

Hope that helped.

Jose out.

Advertisement
28
May
14

Setting up PyCharm with Maya 2014 (Windows)

Hi all!

I’m going to write down a simple step by step guide to set up PyCharm (3.1.3) with compatible versions of python (2.7) and PyQT (4.10) with Maya 2014 (Windows x64 Environment). It is quite simple but requires a couple of things that are easy to forget and this is also mainly a remainder for me in case I have to set-up another machine.

  • Install python 2.7 and PyQT 4.10 for python 2.7. Both versions are the ones 100% compatible with Maya 2014.
  • Link the ‘mayapy.exe’ from ‘C:\Program Files\Autodesk\Maya2014\bin’ to a ‘python.exe’. This is so we can set PyCharm python interpreter to this path.
    • Run the command console as administrator.
    • Go to the ‘C:\Program Files\Autodesk\Maya2014\bin’.
    • Run the command “mklink python.exe mayapy.exe”.00
  • Next, on PyCharm go to ‘File>Settings’ and the select ‘Project Interpreter>Python Interpreter’ on the left and set ‘C:\Program Files\Autodesk\Maya2014\bin’ as Default Python Interpeter.
  • 01Then we need to add a couple of helpers to make our lifes easier. This is totally optional but you can get the pymel auto-complete from the Maya 2014 ‘devkit’ path and helpers from PyCharm itself (see image for default paths).
  • 02Once this is done, in order to get PyQT to work there is one last step that needs to be done. I’m not sure if this is the correct way to do it but it works for me. Last thing to do is to copy the ‘PyQt4’ folder and the ‘sip.pyd’ file from the ‘C:\Python27\Lib\site-packages’ into the following Maya folder ‘C:\Program Files\Autodesk\Maya2014\Python\Lib\site-packages’.
  • And that is it. After these simple steps your python code including PyQT should compile and run perfectly on both Maya and PyCharm.

 

In the following days I’ll try to post a similar step by step guide on how to Setup Visual Studio 2010 with the Maya 2014 API to write plugins. Another task that usually gets frustrating because many little things can go wrong (or simply forgetting one step) and that can get really annoying.

Until then, hope that whoever ends up reading this post finds something useful.

Jose out.

 

20
Jun
10

Tutorial – Ribbon Stretchy Spine Rig

This simple tutorial will guide you in the creation of a Ribbon Stretchy Spine. Nowadays it’s not as commonly used as the IK Spine Rig but it fits well in a cartoon rig. It will be fully stretchy and will have twist from the three controls we are going to create.

First of all we have to create a NURBS plane. The spine will have 5 joints so the NURBS plane needs 5 V patches and must have a Cubic Surface degree.

This will create a NURBS plane along the Y axis with 5 V patches and 1 U patches and three degrees in both U and V. But we’ll have to rebuild the curve so it only has 1 degree in U because we only need three degrees in V.

To do that we select the NURBS plane and click (in the Surfaces module) on Edit NURBS>Rebuild Surfaces. In the option window we select the U direction, set the U spans to 1 and the U degree to 1. The V values will be ignored.

Now the NURBS plane should look like this:

In the next step we have to attach a Hair System to the NURBS plane to use it as the drivers for the joints that will be skinned to the model.

We have to select the  NURBS plane and click (in the Dynamics module) on Hair>Create Hair. The U count must be set to 1 and the V count must be set to 5.

This will create a full Hair System but we only need the follicles so we have to delete the output curves and the hairSystem node.

Now we have to create the joints. Place then individually at the same position as the follicles and then parent them under each follicle.

Now if we move any Control Vertex of the NURBS plane the joints will follow the plane perfectly.

The next step is to create the driver system for the spine rig.

First of all create a joint structure for the top, middle and bottom parts of the NURBS plane and place them as the image below.

Now create the controls that will drive the joints and locators that will be used to Aim Constraint from top to bottom and vice versa, and also locators that will be used as the Up Object for those Aim Constraints.

The scene and Hypergraph should look as the image below.

Now we place the joints under each Aim locator.

The next step is to Aim Constraint the locators.

First, select the topCtl object, then shift-select the btmAim locator and click (in the Animation module) on Constraint>Aim Constraint.

Set the Aim Vector to Y, the Up Vector to X and the World Up Type to Object and type btmUp.

Next, select the btmCtl object, then shift-select the topAim locator and click (in the Animation module) on Constraint>Aim Constraint.

Set the Aim Vector to –Y, the Up Vector to X and the World Up Type to Object and type topUp.

Now select both topCtl and btmCtl and then shift-select midCtlGrp and create a Point Constraint.

After that we have to aim the middle control to the top control, so select the topCtl and then shift-select the midAim locator and create an Aim Constraint. Set the Aim Vector to Y, the Up Vector to X and the World Up Type to Object and type midUp.


The system should now look like this when you move it around.

Now we have to bind the driver joints to the NURBS plane so the system we created can drive the joints that will be smooth binded to the geometry.

Select the topDriver00, midDriver00 and bottomDriver00 joints and then shift-select the NURBS plane. Then click (in the Animation module) on Skin>Smooth Bind with these options.

Now, when you move, for instance, the center control, the NURBS plane will deform, moving in the process the joints placed in the NURBS plane. We will have to change the weighting on the Control Vertex so we can draw a perfect arc when we move the middle control.

Select the Control Vertex and click Window>General Editors>ComponentEditor. Go to the Smooth Skins tab and change the weight values until it look like this or until you have the deformation you’re looking for.

Finally the Ribbon Stretchy Spine is finished. You may like it or not, but it’s just another way to rig an stretchy spine, a long neck or to rig anything you may find this system suitable for.

You can also read this tutorial here: http://www.creativecrash.com/tutorials/ribbon-spine-rig




May 2023
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  

Categories