Friday 3 December 2010

BAPS TIME!

I cant deny how forward I've been looking to getting stuck into this job and start to look more in depth at rigging a character and actually doing a live one, alot of this will more than likely be a trial by fire, with alot of debugging, and even more staring at lines of code, with paper everywhere and gallons of coffee consumed. Yes this is my idea of a fun time, and with that, lets begin.

The basics;

The basic setup will be essential to making a flexable rig, not just in the rig itself but also the file structure and how its all layed out, so I need to create some files and folders, to do this I'll set a new project and create a blank scene with nothing in it, called, "hunter_rig_02_12_10_0001" [this was the naming convention already used by the group] make sure we save this as an ascii file type, with all that done it should look like this;



Next I need to create a reference for the rig scene, I'll be using "Simon_hunter_25_11_10_0001" [I'll be changing that capitalisation on "Simon" at some point], doing it this way allows for high/low poly models and updated models to be switched out without too much work needed to be done, and I'll doing this in that blank scene;



With that done, the next step will be to edit these to be a little more flexable, considering that the aim of the game is ease of use, I'd like a file system that can be moved easily without any complications, so we open up the blank scene in crimson and aslong as its that ascii file type it shouldnt be a problem, and we edit the referenced file directory to be a little more intuative [props go to georg for showing me this] changing the directorys from c:/blah/blah/blah/file.ma to .//blah/file.ma;

And finally I'll open up the character model file, and apply some pruning and organisation selecting the character mesh and grouping it, then deleting everything that isnt in that group;

So now it's time to merge the files more intricatly, firstly I'll run a simple node script that sets up nodes and there attributes, ;


The script is pretty simple creating nodes for the different parts joints, ik's etc.



After this has been run the outliner will look like this;


And then to parent the model node into the script generated node;


And now for the rest of the day I shall be tackling my previously posted rename script, why? whats the point? in short I'm going to need it to rename the bones and other such things.

While it works as intended, it needs added functionality, it currently adds a prefix and suffix to the selected objects but I want to take it to the next step, and be able to change the actual name of objects, I've drawn up a rough design for what it will look like;


 the left hand box is as it is currently coded, on the left is the added section, I'm unsure if I want this to be apart of the same window or not, I will probably add in a button that brings it up, and if I do that, I will also have one for the prefix and sufix.

So I have a rough idea of what i'm aiming for, now to produce some test code;


I've added in a new procedure to the bottom of the current code and named it adv for the time being, this section will contain the code for the new window like so;

Here we have the basic implementation of the whole concept, it woks and is functional, but there is an issue with the coding, its in two seperate parts at the moment, and I want them as one so it runs automatically, the code itself is fairly simple;

proc sc_adv()
{
string $rnm_win = `window -t "Rename"`;
columnLayout -adj 1;
string $sel[] = `ls -sl`;
for ($each in $sel)
{
nameField -o $each;
}
showWindow $rnm_win;
}
sc_adv()

 It simply creates a window and adds a new text field for each object selected, I will need to bolt in an update selection feature to complete this side of the script, which off the top of my head will be somthing like "button -l "update" -c newproc;"
where new proc is I shall be shifting the for loop into a different proc and replacing it with the above button command.

And one heache later we have this;

and the code;

proc sc_gui()
{
    string $selection[] = (`ls -selection`);  
    if (`window -exists "sc_gui"`) deleteUI "sc_gui";
        window -w 150 -h 300 -t "GUI" -maximizeButton false -minimizeButton false sc_gui;            
        print "Selected: ";            
        print ($selection);         
            columnLayout;
                text -w 150 -al "left" -fn "boldLabelFont" -l "Prefix";
                textField -width 150 sc_preffix;
                text -w 150 -al "left" -fn "boldLabelFont" -l "Sufix";
                textField -width 150 -text `date -format "DDMMYY"` sc_suffix;
                button -label "Convention" -w 150 -command "sc_fix";
                separator -style "double" -w 150;
                       button -l "Rename" -w 150 -c "sc_rnm_win";
        showWindow "sc_gui";
}
proc sc_fix()
{
    string $marker = "nc_";
    string $prefix = `textField -q -text sc_preffix`;
    string $sufix = `textField -q -text sc_suffix`;   
    string $selection[] = (`ls -selection`);
    if (size($prefix) == 0 ||  size($prefix) < 1 )
        {
            print "\nNo Prefix defined\n";
        }
    else
        {
            print "\nPREFIX: ";
            print ($prefix + "\n");
        }
        if (size($selection) == 0 ||  size($selection) < 1 )
        {       
        print "No Objest selected\n";
        }
    else
        {  
        for ($items in $selection)
            {
                print ($items + "\n");
                string $matches = (`match $marker $items`);
                print ($matches + "\n");
                if ( $matches == $marker)
                    {
                     print "false \n ";
                    }
                else
                    {
                    //***********add the selected names to a seperate node***********
                    rename $items ("nc_" + $prefix + "_" + $items + "_" + $sufix);
                    //***********add the changed names to a seperate node***********
                    }
            }
        }
    string $selection[] = (`ls -selection`);
            print "Selected:\n";
            print $selection "\n";
}
proc sc_rnm_win()
{
    if (`window -exists "rnm_win"`) deleteUI "rnm_win";
        window -w 600 -h 300 -t "Rename" -maximizeButton false -minimizeButton false rnm_win;
    columnLayout -adj 1;
    string $sel[] = `ls -sl`;
    for ($each in $sel)
        {
            nameField -o $each;
        }
showWindow rnm_win;
}

sc_gui()


There are some things that need changing, but for the most part this works and is easier than the default way of renaming stuff, so I think its a success, I also previously posted this with a edit at the end about the proc()'s not working, this has been addressed and fix'd.


In between all that I drew up a quick front view of where the main joints on the rig are going or likely to be;


just need to do a side view, and add in the bones, but thats view is pretty much where I'm going to place them.
And with that I'm done for the day.


No comments:

Post a Comment