Page 1 of 1

[Maya]Clean/Organize CDT Materials in Maya

Posted: Wed Dec 10, 2008 11:43 am
by YMangolds
Clean/Organize CDT Materials in Maya
Here's a script I wrote a little while ago to help deal with the millions of lamberts that Craft Director makes (well maybe not millions... but I have seen them go into the multiple hundreds on complex scenes). This should grab most cdt lamberts, if I missed any let me know.

Code: Select all

//###################################] C2i Studios [#######################################
//	Script Name: cdtCleanMats.mel
//
//	By: Yuris Mangolds - ymangolds@c-2iinc.com
//
//	Version: 0.2
//
//	Last Updated: 12/10/08
//
//	Bugs/Comments/Suggestions: Send to ymangolds@c-2iinc.com
//
//	Update/Change this file at:
//		http://c-2iinc.dyndns.org:8001/Public/cdtCleanMaterials.mel
//
//	Compatibility: Writen for Maya 2008
//
//	Description: A tool to help clean and organize the materials created when using Craft
//		Director Tools.
//
//	Installation: Place this script in your user scripts directory then run "cdtCleanMats"
//
//	Notes: At the end of the script it removes unused render nodes (previous cdt lamberts)
//		So make sure any materials you've created otherwise are assigned to something.
//
//#########################################################################################

global proc cdtCleanMats(){
    int $makeBeigeLgt = 1;
    int $makeBeigeMed = 1;
    int $makeBeigeDark = 1;
    int $makeBlue = 1;
    int $makeGreenLgt = 1;
    int $makeGreenMed = 1;
    int $makeGreenDark = 1;
    int $makeGrey = 1;
    int $makeOrange = 1;
    int $makePurpLgt = 1;
    int $makePurpDark = 1;
    int $makeRedLgt = 1;
    int $makeRedMed = 1;
    int $makeTealLgt = 1;
    int $makeTealMed = 1;
    int $makeWhite = 1;
    int $makeYellow = 1;
    string $materials[] = `ls -mat`;
    string $lamberts[] = `ls -type "lambert"`;

//check for materials
	for ($mat in $materials){
    	if ($mat == "cdtBeigeLgt") $makeBeigeLgt = 0;
     	else if ($mat == "cdtBeigeMed") $makeBeigeMed = 0;
     	else if ($mat == "cdtBeigeDark") $makeBeigeDark = 0;
     	else if ($mat == "cdtBlue") $makeBlue = 0;
     	else if ($mat == "cdtGreenLgt") $makeGreenLgt = 0;
        else if ($mat == "cdtGreenMed") $makeGreenMed = 0;
        else if ($mat == "cdtGreenDark") $makeGreenDark = 0;
        else if ($mat == "cdtGrey") $makeGrey = 0;
        else if ($mat == "cdtOrange") $makeOrange = 0;
        else if ($mat == "cdtPurpLgt") $makePurpLgt = 0;
        else if ($mat == "cdtPurpDark") $makePurpDark = 0;
        else if ($mat == "cdtRedLgt") $makeRedLgt = 0;
        else if ($mat == "cdtRedMed") $makeRedMed = 0;
        else if ($mat == "cdtTealLgt") $makeTealLgt = 0;
     	else if ($mat == "cdtTealMed") $makeTealMed = 0;
        else if ($mat == "cdtWhite") $makeWhite = 0;
     	else if ($mat == "cdtYellow") $makeYellow = 0;
    }

//Make new materials
	if ($makeBeigeLgt == 1){
		string $cdtBeigeLgt = `shadingNode -asShader lambert -n "cdtBeigeLgt"`;
        string $cdtBeigeLgtSG = `sets -renderable true -noSurfaceShader true -empty -n cdtBeigeLgtSG`;
        connectAttr -f ($cdtBeigeLgt + ".outColor") ($cdtBeigeLgtSG + ".surfaceShader");
        setAttr ($cdtBeigeLgt + ".color") 0.941176 0.988235 0.705882;
	} else { string $cdtBeigeLgtSG = "cdtBeigeLgtSG";}

	if ($makeBeigeMed == 1){
        string $cdtBeigeMed = `shadingNode -asShader lambert -n "cdtBeigeMed"`;
        string $cdtBeigeMedSG = `sets -renderable true -noSurfaceShader true -empty -n cdtBeigeMedSG`;
        connectAttr -f ($cdtBeigeMed + ".outColor") ($cdtBeigeMedSG + ".surfaceShader");
        setAttr ($cdtBeigeMed + ".color") 0.784314 0.823529 0.588235;
	} else { string $cdtBeigeMedSG = "cdtBeigeMedSG";}

	if ($makeBeigeDark == 1){
        string $cdtBeigeDark = `shadingNode -asShader lambert -n "cdtBeigeDark"`;
        string $cdtBeigeDarkSG = `sets -renderable true -noSurfaceShader true -empty -n cdtBeigeDarkSG`;
        connectAttr -f ($cdtBeigeDark + ".outColor") ($cdtBeigeDarkSG + ".surfaceShader");
        setAttr ($cdtBeigeDark + ".color") 0.54902 0.576471 0.411765;
	} else { string $cdtBeigeDarkSG = "cdtBeigeDarkSG";}

	if ($makeBlue == 1){
        string $cdtBlue = `shadingNode -asShader lambert -n "cdtBlue"`;
        string $cdtBlueSG = `sets -renderable true -noSurfaceShader true -empty -n cdtBlueSG`;
        connectAttr -f ($cdtBlue + ".outColor") ($cdtBlueSG + ".surfaceShader");
        setAttr ($cdtBlue + ".color") 0.227 0.522 0.824;
	} else { string $cdtBlueSG = "cdtBlueSG";}

	if ($makeGreenLgt == 1){
        string $cdtGreenLgt = `shadingNode -asShader lambert -n "cdtGreenLgt"`;
        string $cdtGreenLgtSG = `sets -renderable true -noSurfaceShader true -empty -n cdtGreenLgtSG`;
        connectAttr -f ($cdtGreenLgt + ".outColor") ($cdtGreenLgtSG + ".surfaceShader");
        setAttr ($cdtGreenLgt + ".color") 0.337255 0.878431 0.337255;
	} else { string $cdtGreenLgtSG = "cdtGreenLgtSG";}

	if ($makeGreenMed == 1){
        string $cdtGreenMed = `shadingNode -asShader lambert -n "cdtGreenMed"`;
        string $cdtGreenMedSG = `sets -renderable true -noSurfaceShader true -empty -n cdtGreenMedSG`;
        connectAttr -f ($cdtGreenMed + ".outColor") ($cdtGreenMedSG + ".surfaceShader");
        setAttr ($cdtGreenMed + ".color") 0 1 0;
	} else { string $cdtGreenMedSG = "cdtGreenMedSG";}

	if ($makeGreenDark == 1){
        string $cdtGreenDark = `shadingNode -asShader lambert -n "cdtGreenDark"`;
        string $cdtGreenDarkSG = `sets -renderable true -noSurfaceShader true -empty -n cdtGreenDarkSG`;
        connectAttr -f ($cdtGreenDark + ".outColor") ($cdtGreenDarkSG + ".surfaceShader");
        setAttr ($cdtGreenDark + ".color") 0 0.471 0;
	} else { string $cdtGreenDarkSG = "cdtGreenDarkSG";}

	if ($makeGrey == 1){
        string $cdtGrey = `shadingNode -asShader lambert -n "cdtGrey"`;
        string $cdtGreySG = `sets -renderable true -noSurfaceShader true -empty -n cdtGreySG`;
        connectAttr -f ($cdtGrey + ".outColor") ($cdtGreySG + ".surfaceShader");
        setAttr ($cdtGrey + ".color") 0.627 0.659 0.588;
	} else { string $cdtGreySG = "cdtGreySG";}

	if ($makeOrange == 1){
        string $cdtOrange = `shadingNode -asShader lambert -n "cdtOrange"`;
        string $cdtOrangeSG = `sets -renderable true -noSurfaceShader true -empty -n cdtOrangeSG`;
        connectAttr -f ($cdtOrange + ".outColor") ($cdtOrangeSG + ".surfaceShader");
        setAttr ($cdtOrange + ".color") 0.878431 0.560784 0.341176;
	} else { string $cdtOrangeSG = "cdtOrangeSG";}

	if ($makePurpLgt == 1){
        string $cdtPurpLgt = `shadingNode -asShader lambert -n "cdtPurpLgt"`;
        string $cdtPurpLgtSG = `sets -renderable true -noSurfaceShader true -empty -n cdtPurpLgtSG`;
        connectAttr -f ($cdtPurpLgt + ".outColor") ($cdtPurpLgtSG + ".surfaceShader");
        setAttr ($cdtPurpLgt + ".color") 0.549 0.392 0.412;
    } else { string $cdtPurpLgtSG = "cdtPurpLgtSG";}

	if ($makePurpDark == 1){
        string $cdtPurpDark = `shadingNode -asShader lambert -n "cdtPurpDark"`;
        string $cdtPurpDarkSG = `sets -renderable true -noSurfaceShader true -empty -n cdtPurpDarkSG`;
        connectAttr -f ($cdtPurpDark + ".outColor") ($cdtPurpDarkSG + ".surfaceShader");
        setAttr ($cdtPurpDark + ".color") 0.471 0.039 0.196;
    } else { string $cdtPurpDarkSG = "cdtPurpDarkSG";}

	if ($makeRedLgt == 1){
        string $cdtRedLgt = `shadingNode -asShader lambert -n "cdtRedLgt"`;
        string $cdtRedLgtSG = `sets -renderable true -noSurfaceShader true -empty -n cdtRedLgtSG`;
        connectAttr -f ($cdtRedLgt + ".outColor") ($cdtRedLgtSG + ".surfaceShader");
        setAttr ($cdtRedLgt + ".color") 0.878431 0.337255 0.337255;
	} else { string $cdtRedLgtSG = "cdtRedLgtSG";}

	if ($makeRedMed == 1){
        string $cdtRedMed = `shadingNode -asShader lambert -n "cdtRedMed"`;
        string $cdtRedMedSG = `sets -renderable true -noSurfaceShader true -empty -n cdtRedMedSG`;
        connectAttr -f ($cdtRedMed + ".outColor") ($cdtRedMedSG + ".surfaceShader");
        setAttr ($cdtRedMed + ".color") 1 0 0;
	} else { string $cdtRedMedSG = "cdtRedMedSG";}

	if ($makeTealLgt == 1){
        string $cdtTealLgt = `shadingNode -asShader lambert -n "cdtTealLgt"`;
        string $cdtTealLgtSG = `sets -renderable true -noSurfaceShader true -empty -n cdtTealLgtSG`;
        connectAttr -f ($cdtTealLgt + ".outColor") ($cdtTealLgtSG + ".surfaceShader");
        setAttr ($cdtTealLgt + ".color") 0 1 1;
	} else { string $cdtTealLgtSG = "cdtTealLgtSG";}

	if ($makeTealMed == 1){
        string $cdtTealMed = `shadingNode -asShader lambert -n "cdtTealMed"`;
        string $cdtTealMedSG = `sets -renderable true -noSurfaceShader true -empty -n cdtTealMedSG`;
        connectAttr -f ($cdtTealMed + ".outColor") ($cdtTealMedSG + ".surfaceShader");
        setAttr ($cdtTealMed + ".color") 0 0.471 0.471;
	} else { string $cdtTealMedSG = "cdtTealMedSG";}

    if ($makeWhite == 1){
        string $cdtWhite = `shadingNode -asShader lambert -n "cdtWhite"`;
        string $cdtWhiteSG = `sets -renderable true -noSurfaceShader true -empty -n cdtWhiteSG`;
        connectAttr -f ($cdtWhite + ".outColor") ($cdtWhiteSG + ".surfaceShader");
        setAttr ($cdtWhite + ".color") 1 1 1;
	} else { string $cdtWhiteSG = "cdtWhiteSG";}

    if ($makeYellow == 1){
        string $cdtYellow = `shadingNode -asShader lambert -n "cdtYellow"`;
        string $cdtYellowSG = `sets -renderable true -noSurfaceShader true -empty -n cdtYellowSG`;
        connectAttr -f ($cdtYellow + ".outColor") ($cdtYellowSG + ".surfaceShader");
        setAttr ($cdtYellow + ".color") 0.878431 0.878431 0.337255;
    } else { string $cdtYellowSG = "cdtYellowSG";}


//Check and Reassign Lamberts
    for ($lamb in $lamberts){
        float $currColor[3] = `getAttr ($lamb + ".color")`;

        //Beiges
        if ((($currColor[0] >= 0.941) && ($currColor[0] <= 0.942))
        && (($currColor[1] >= 0.988) && ($currColor[1] <= 0.989))
        && (($currColor[2] >= 0.705) && ($currColor[2] <= 0.706))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtBeigeLgtSG $objShape;}}

        else if ((($currColor[0] >= 0.784) && ($currColor[0] <= 0.785))
        && (($currColor[1] >= 0.823) && ($currColor[1] <= 0.824))
        && (($currColor[2] >= 0.588) && ($currColor[2] <= 0.589))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtBeigeMedSG $objShape;}}

        else if ((($currColor[0] >= 0.549) && ($currColor[0] <= 0.550))
        && (($currColor[1] >= 0.576) && ($currColor[1] <= 0.577))
        && (($currColor[2] >= 0.411) && ($currColor[2] <= 0.412))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
				sets -edit -forceElement cdtBeigeDarkSG $objShapes;}}

		//Blue
       	else if ((($currColor[0] >= 0.226) && ($currColor[0] <= 0.228))
        && (($currColor[1] >= 0.521) && ($currColor[1] <= 0.523))
        && (($currColor[2] >= 0.823) && ($currColor[2] <= 0.825))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
				sets -edit -forceElement cdtBlueSG $objShapes;}}

		//Greens
        else if ((($currColor[0] >= 0.337) && ($currColor[0] <= 0.338))
        && (($currColor[1] >= 0.878) && ($currColor[1] <= 0.879))
        && (($currColor[2] >= 0.337) && ($currColor[2] <= 0.338))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtGreenLgtSG $objShape;}}

        else if (($currColor[0] == 0)
        && ($currColor[1] == 1)
        && ($currColor[2] == 0)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtGreenMedSG $objShape;}}

        else if (($currColor[0] == 0)
        && (($currColor[1] >= 0.470) && ($currColor[1] <= 0.472))
        && ($currColor[2] == 0)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtGreenDarkSG $objShape;}}

		//Grey
        else if ((($currColor[0] >= 0.626) && ($currColor[0] <= 0.628))
        && (($currColor[1] >= 0.658) && ($currColor[1] <= 0.66))
        && (($currColor[2] >= 0.587) && ($currColor[2] <= 0.589))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtGreySG $objShape;}}

		//Orange
        else if ((($currColor[0] >= 0.878) && ($currColor[0] <= 0.879))
        && (($currColor[1] >= 0.560) && ($currColor[1] <= 0.561))
        && (($currColor[2] >= 0.341) && ($currColor[2] <= 0.342))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtOrangeSG $objShapes;}}

		//Purples
        else if ((($currColor[0] >= 0.548) && ($currColor[0] <= 0.55))
        && (($currColor[1] >= 0.391) && ($currColor[1] <= 0.393))
        && (($currColor[2] >= 0.411) && ($currColor[2] <= 0.413))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtPurpLgtSG $objShape;}}

        else if ((($currColor[0] >= 0.470) && ($currColor[0] <= 0.472))
        && (($currColor[1] >= 0.038) && ($currColor[1] <= 0.04))
        && (($currColor[2] >= 0.195) && ($currColor[2] <= 0.197))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtPurpDarkSG $objShape;}}

		//Reds
        else if ((($currColor[0] >= 0.878) && ($currColor[0] <= 0.879))
        && (($currColor[1] >= 0.337) && ($currColor[1] <= 0.338))
        && (($currColor[2] >= 0.337) && ($currColor[2] <= 0.338))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtRedLgtSG $objShape;}}

        else if ((($currColor[0] >= 0.699) && ($currColor[0] <= 0.701))
        && (($currColor[1] >= 0.299) && ($currColor[1] <= 0.301))
        && (($currColor[2] >= 0.299) && ($currColor[2] <= 0.301))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtRedLgtSG $objShape;}}

        else if (($currColor[0] == 1)
        && ($currColor[1] == 0)
        && ($currColor[2] == 0)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtRedMedSG $objShape;}}

		//Teals
        else if (($currColor[0] == 0)
        && ($currColor[1] == 1)
        && ($currColor[2] == 1)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtTealLgtSG $objShape;}}

        else if ((($currColor[0] >= 0) && ($currColor[0] <= 0.001))
        && (($currColor[1] >= 0.470) && ($currColor[1] <= 0.472))
        && (($currColor[2] >= 0.470) && ($currColor[2] <= 0.473))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtTealMedSG $objShape;}}

        //White
        else if (($currColor[0] == 1)
        && ($currColor[1] == 1)
        && ($currColor[2] == 1)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtWhiteSG $objShape;}}

		//Yellows
        else if ((($currColor[0] >= 0.878) && ($currColor[0] <= 0.879))
        && (($currColor[1] >= 0.878) && ($currColor[1] <= 0.879))
        && (($currColor[2] >= 0.337) && ($currColor[2] <= 0.338))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtYellowSG $objShape;}}

        else if ((($currColor[0] >= 0.699) && ($currColor[0] <= 0.701))
        && (($currColor[1] >= 0.699) && ($currColor[1] <= 0.701))
        && (($currColor[2] >= 0.299) && ($currColor[2] <= 0.301))){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement cdtYellowSG $objShape;}}

        //initialShadingGroup
        else if (($currColor[0] == 0.5)
        && ($currColor[1] == 0.5)
        && ($currColor[2] == 0.5)){
            select -r $lamb;
            hyperShade -objects "";
            string $objShapes[] = `ls -sl`;
            for ($objShape in $objShapes){
            	sets -edit -forceElement initialShadingGroup $objShape;}}

    }
	hyperShadePanelMenuCommand("hyperShadePanel1", "deleteUnusedNodes");
}
I wrote this when I was new to mel and scripting in general so it probably could of been broken into procedures with arguements to make it alot simpilar. If I find time I might do that but for now... if it's not broke, don't fix it.

Discussion regarding Useful Scripts for SpeedAnimation: Maya

Posted: Wed Dec 10, 2008 11:51 pm
by Luigi Tramontana
A really useful script, thank you very much Yuris! I will take look at the ocean script as soon as I have time.
We have scheduled an enhancement for the system to handle the textures in a better way. Do you have any suggestions?

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Thu Dec 11, 2008 1:28 am
by YMangolds
Yeah, simular to how my little script works, but maybe in a different order. Feel free to use any or part of my script in your enhancement. Ideally, when a new cdt element is created (or added to in the case of adding wheels/tracks to the track system) something would run a check to see if a material already exists for the color desired in the new object, if it does exist it would connect the existing material to the new object, if it doesn't, then it would create a new one. Which would be really nice since a command to remove unused rendernodes wouldn't be needed, and only used materials would be created (my script makes a material for every possible cdt color then removes the unused ones at the end).

Another suggestion I have is standardizing the colors you use. When writing the script above, I found out that there are some colors created that are visually identical to other ones but the values are slightly different (look at the part at the end where there's 2 different checks for yellows that assign to the same new material). Also might want to round values to the closest .000 so values aren't .3438925 etc (which is why when my script checks a lamberts color it has to check if the value is between 2 values instead of being able to see if it's exactly a certain value).

I also recommend rethinking the names of the materials created, and naming them based on what the type of proxy geo is that get's it (instead of naming them the color like my script does). So for example: instead of making "cdtOrange", it'd be named "cdtRelocationLambert" connected to a "cdtRelocationLambertSG" shading group. Also, I think that there are some cdt objects that aren't gravity direction meshes that have the same color as gravity direction meshes (i think one might be the hook mesh on a trailer). It would be awesome if all specific cdt object's roles had shared a unique material (like gravity direction meshes). This would allow for some really powerful selection filters available for user created scripts. For example when laying out many vehicles for background civilian traffic it'd be very easy to write a script where you select the ground/road, run the script and it would grab all the objects that have "cdtGravityDirectionLambert" assigned to it and reparent them under the choosen groun/road.

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Thu Dec 11, 2008 9:47 am
by Carl Buhre
YMangolds wrote: I also recommend rethinking the names of the materials created, and naming them based on what the type of proxy geo is that get's it (instead of naming them the color like my script does). So for example: instead of making "cdtOrange", it'd be named "cdtRelocationLambert" connected to a "cdtRelocationLambertSG" shading group. Also, I think that there are some cdt objects that aren't gravity direction meshes that have the same color as gravity direction meshes (i think one might be the hook mesh on a trailer). It would be awesome if all specific cdt object's roles had shared a unique material (like gravity direction meshes). This would allow for some really powerful selection filters available for user created scripts. For example when laying out many vehicles for background civilian traffic it'd be very easy to write a script where you select the ground/road, run the script and it would grab all the objects that have "cdtGravityDirectionLambert" assigned to it and reparent them under the choosen groun/road.
There is a thought behind the coloring. But it isn't that Red = GravityDirectionMesh. Rather that Red = <This object should be linked/parented to something>.

Now forgive my inexperience when it comes to scripts, but couldn't the selections filters that you speak for be done by using the objects' names instead? I mean all GravityDirectionMeshes are called %somethingsomething%_GravityDirectionMesh.

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Thu Dec 11, 2008 1:47 pm
by YMangolds
Carl Buhre wrote: couldn't the selections filters that you speak for be done by using the objects' names instead? I mean all GravityDirectionMeshes are called %somethingsomething%_GravityDirectionMesh.
Yeah that's how we currently do it. Having an extra selection filter method would be nice in case things get renamed. Also in cases where a scene has a million namespaces from referencing/importing, using object's names can sometimes be a pain, but if "use shared materials" is on in the referencing/importing options, all gravity direction meshes would have the same material even if they have 5 levels of different namespaces. It was just a minor suggstion to keep options open.

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Thu Dec 11, 2008 1:51 pm
by Carl Buhre
YMangolds wrote:
Carl Buhre wrote: couldn't the selections filters that you speak for be done by using the objects' names instead? I mean all GravityDirectionMeshes are called %somethingsomething%_GravityDirectionMesh.
Yeah that's how we currently do it. Having an extra selection filter method would be nice in case things get renamed. Also in cases where a scene has a million namespaces from referencing/importing, using object's names can sometimes be a pain, but if "use shared materials" is on in the referencing/importing options, all gravity direction meshes would have the same material even if they have 5 levels of different namespaces. It was just a minor suggstion to keep options open.
There's no chance of using wildcards like ´*_GravityDirectionMesh´? Regarding the materials, I'm sure Micael Belin (our Head Systems Developer) will take a look at it as soon as he gets back as he's currently out of the office.

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Thu Dec 11, 2008 9:35 pm
by YMangolds
Wildcards usually work except for namespaces. There's supposed to be an arguement in the "ls" command to have it ignore namespaces but it doesn't work very well. Solution is to multiple searches like "*:*_GravityDirectionMesh" plus "*:*:*_GravityDirectionMesh" plus "*:*:*:*_GravityDirectionMesh" etc then create a new list that combines those searches. Imho, maya's namespace system is one of it's biggest flaws (it's usually the reason why alot of stuff breaks). If it's easier to keep it as it is, by all means do so.

Another idea i had (which is merely an idea and not a suggestion, since it may be more trouble then it's worth and only something to consider if your developer is feeling very adventureous) would be to use a single material for all craft geo with a switch node plugged into the color so the color would change based on the object. We did this for the boxcars in our Talon Hazmat animation (which I'm still trying to get written permission from Foster-Miller to have it released so you can use it in your gallery), and though I don't remember the exact process, I do remember it being tricky to figure out. If it's something you want to consider I could dig up the files.

Re: Useful Scripts for SpeedAnimation: Maya

Posted: Fri Dec 12, 2008 12:34 pm
by Luigi Tramontana
Yuris, the texture suggestions you have are quite perfect.
It is true that we use unnecessarily many colors, these should be standardized to say a list of basic standard colors and say 10 nuances. Then as a standard procedure one picks the first color in the list for that specific color code which would minimize the number of textures in maya. Also as you say, some same color objects should always have the same color such as the gravityDirectionMeshes.
Thanks a bunch for the tricks of the trade!