Bonus tools dynamic joint issue


#1

Hi,
I’m having an issue with the Make Joints Dynamic tool in the Maya bonus tools. It looks like I can only do it once in a scene, as part of the script is looking for “jiggle1” but a new jiggle deformer is versioned up (to jiggle2 and so on), whether I’ve renamed the other jiggle deformer or not. So it stops before the end of the script.
Has anyone found a way around this?
Thanks!
-Ted


#2

Its not too had to fix the script so it works. Actually you’ll need to change two scripts.

First C:\Program Files\Autodesk\Maya2016\scripts\others\doJiggle.mel

The proc called doJiggle() currently does not return the name of the jiggle node(s) that it creates. Since this proc is designed to work on multiple input objects we need to modify it to return a string array.

Here is the modified code:

global proc string[] doJiggle(int $version, string $args[])
{
	string $jiggle_list[];
	float $stiffness = $args[0];
	float $damping = $args[1];
	float $weight = $args[2];
	int $ignoreTransform = $args[3];
	int $ifResting = $args[4];
	string $positioning = $args[5];
	string $exclusiveName = $args[6];

	int $ii;
	// Find all the surf transforms that have been selected
	//
	string $selectedObjects[] = getSelectedSurfsAndParticles();
	int $numObjects = size($selectedObjects);

	if ($numObjects == 0)
	{
		error( (uiRes("m_doJiggle.kNoDeformableSel")));
		return $jiggle_list;
	}

	// Create the jiggle deformer for each surface
	//
	select -clear;
	for($ii = 0; $ii < $numObjects; $ii++) {
		string $objects = $selectedObjects[$ii]; 
		string $res[];
		$cmd = "deformer -type jiggle ";
		if ($exclusiveName != "") {
			$cmd += (" -exclusive \""+$exclusiveName+"\"");
		}
		if ($positioning != "default") {
			$cmd += (" -"+$positioning);
		}
		$cmd += " " + $objects; 

		$res = `eval $cmd`;
		string $jiggle = $res[0];
		$jiggle_list[size($jiggle_list)] = $jiggle;

		verifyWorkspaceFileRule( "diskCache", "data" );

		string $cacheName = uniqueCacheName($res[0], ".mcj");
		connectAttr time1.outTime ($jiggle + ".currentTime");
		string $dskC = `createNode -name ($jiggle+"Cache") diskCache`;
		setAttr -type "string" ($dskC + ".hiddenCacheName") $cacheName;
		setAttr -type "string" ($dskC + ".cacheType") ("mcj");
		connectAttr ($dskC + ".diskCache") ($jiggle + ".diskCache");

		setAttr ($jiggle+".ignoreTransform") $ignoreTransform;
		if( $ifResting )
			setAttr ($jiggle+".enable") 2;
		else
			setAttr ($jiggle+".enable") 0;
		setAttr ($jiggle+".stiffness") $stiffness;
		setAttr ($jiggle+".damping") $damping;
		setAttr ($jiggle+".jiggleWeight") $weight;
	}
	return $jiggle_list;
}


Then we need to change two lines in the bonustools script called C:\ProgramData\Autodesk\ApplicationPlugins\MayaBonusTools\Contents\scripts-2016\bt_makeJointsDynamicUI.mel

Serach for a line that looks like this:

doJiggle 1 { “0.5”, “0.5”, “1”, “0”, “0”, “default”, “” }

and replace it with this…

string $jiggle_list[] = doJiggle 1 { "0.5", "0.5", "1", "0", "0", "default", "" };

Then just below that change this line…

$jiggleName[0] = rename "jiggle1" "jiggleEffect#";

to this…

$jiggleName[0] = rename $jiggle_list[0] "jiggleEffect#";

Now if you restart maya, you will be able to run that make joints dynamic multiple times without the name clash.

David


#3

Awesome! That works. I had tried to do a string array in the UI script earlier, but couldn’t get it to work. Thanks so much for your help!


#4

Hiya,
Have a need to resurrect this thread, I cannot seem to reproduce the fix given by djx in maya 2019
I’m pretty sure I followed his instructions correctly and applied it to the 2019 bt_makeJointsDynamicUI.mel but no luck… It gives me this error message when I try to click the ‘Make Joints Dynamic…’ button inside of maya with the modified code:

bt_makeJointsDynamicUI;
// Error: string $jiggle_list[] = doJiggle 1 { “0.5”, “0.5”, “1”, “0”, “0”, “default”, “” }; //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 171.35: Invalid use of Maya object “doJiggle”. //
// Error: $jiggleName[0] = rename $jiggle_list[0] “jiggleEffect#”; //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 173.37: Invalid use of Maya object “rename”. //
// Error: connectAttr ($jiggleHandle + “.jiggleWeight”) ($jiggleName[0] + “.jiggleWeight”); //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 191.64: “$jiggleName” is an undeclared variable. //
// Error: connectAttr ($jiggleHandle + “.jiggleStiffness”) ($jiggleName[0] + “.stiffness”); //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 195.67: “$jiggleName” is an undeclared variable. //
// Error: connectAttr ($jiggleHandle + “.jiggleDamping”) ($jiggleName[0] + “.damping”); //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 199.65: “$jiggleName” is an undeclared variable. //
// Error: percent -v $val $jiggleName[0] ($cvName) ; //
// Error: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 239.35: “$jiggleName” is an undeclared variable. //
// Warning: int $particleCount = 0; //
// Warning: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 374.24 : Redeclaration of variable “$particleCount” shadows previous declaration at line 359. Previous value will be overwritten by explicit initializer. //
// Warning: int $buttonNumber = (optionVar -q dynJointFalloff); //
// Warning: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 1149.55 : Redeclaration of variable “$buttonNumber” shadows previous declaration at line 1105. Previous value will be overwritten by explicit initializer. //
// Warning: int $buttonNumber = (optionVar -q dynJointDetail); //
// Warning: “C:/ProgramData/Autodesk/ApplicationPlugins/MayaBonusTools-2016-2019/Contents/scripts-2019/bt_makeJointsDynamicUI.mel” line 1178.54 : Redeclaration of variable “$buttonNumber” shadows previous declaration at line 1105. Previous value will be overwritten by explicit initializer. //

I suspect that the make joints dynamic bonus tools script has been modified by Autodesk since 2016 invalidating this fix. They don’t seem to have fixed this jiggle chain bug with it at the same time, unfortunately : (

Any help to get it working again would be really appreciated


#5

Maya 2017
Same problem as bandoggo …
Anyone found a solution ?