Jump to content

Featured Replies

czy ktos zna metode na export jointow do geometrii ?,

3dmax pozwala to zrobic poprostu fbx'em, ale w mayi nie znalazłem nigdzie takiej opcji

  • Replies 7
  • Views 967
  • Created
  • Last Reply

Top Posters In This Topic

  • Author

that's simple:skończyłem własnie skinować postać, gotowy szkielet uzmysłowił mi kilka błedów na siatce, ale mesh wole poprawiać w zbrushu, dlatego przydałby mi sie wzor rigu wyrzucony do geometrii,zapięty w tle jako subtool.

misiu, jest gdzies skrypt na highend3d, ktory pod jointy podpina z automatu geometrie. te mozesz sobie pozniej wypluc do ZB.

 

Tylko zabij mnie, ale nie pamietam jak sie nazywa ;)

if(`window -exists "addGeoWindow"`)
deleteUI "addGeoWindow";

if(`windowPref -exists "addGeoWindow"`)
windowPref -r "addGeoWindow";

// Prepare the UI

window -rtf true -title "Add geometry to selected." addGeoWindow;
columnLayout -rowSpacing 5 addGeoControlColumn1;
	text -label "Geometry Orientation";
	separator -ann "Geometry Orientation" -w 250;
	radioCollection addGeoRadioGrp1;
	rowLayout -numberOfColumns 3 addGeoControlRow1;
			radioButton -label "+X" posX;
			radioButton -label "+Y" posY;
			radioButton -label "+Z" posZ;
	setParent ..;
	rowLayout -numberOfColumns 3 addGeoControlRow2;
			radioButton -label "-X" negX;
			radioButton -label "-Y" negY;
			radioButton -label "-Z" negZ;
	setParent ..;
	separator -w 250;
	button -c "addGeoPrep" -label "Create";
setParent ..;
showWindow addGeoWindow;

radioCollection -e -sl posX addGeoRadioGrp1;

// Preparation phase

global proc addGeoPrep(){
$sel = `ls -sl`;
string $a;
float $length;

// See if we have anything selected

if (size($sel) == 0){
	error "Select a target";
}

// Recurence trough selection

for($a in $sel){

		$child = `listRelatives -c $a`;

		if (size($child) > 0 && nodeType($child[0]) == "joint"){	// If the target is a joint calculate the length
			float $componentX = `getAttr ($child[0] + ".tx")`;
			float $componentY = `getAttr ($child[0] + ".ty")`;
			float $componentZ = `getAttr ($child[0] + ".tz")`;
			$length = `mag (>)`; 
		} else {													// If not - set length to 1
			$length = 1;
		}
					// Read values
	float $width = `getAttr ($a + ".radius")`;
	//float $rad = `floatSliderGrp -q -value "FKradius"`;
	string $orient = `radioCollection -q -sl addGeoRadioGrp1`;
	addGeo( $width, $length, $a, $orient);		// Make the main function
}
}

global proc string addGeo ( float $width, float $height, string $targetName, string $orient) {
$mesh = `polyCube -w $width -d $width-h $height -n ($targetName + "_joint_geo")`;
setAttr ($mesh[0] + ".translateY") ($height / 2);
xform -ws -piv 0 0 0 $mesh[0];
if ($orient == "posX"){
	setAttr ($mesh[0] + ".rotateZ") -90;
	makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $mesh[0];
}
if ($orient == "negX"){
	setAttr ($mesh[0] + ".rotateZ") 90;
	makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $mesh[0];
}
if ($orient == "negY"){
	setAttr ($mesh[0] + ".rotateZ") 180;
	makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $mesh[0];
}

if ($orient == "posZ"){
	setAttr ($mesh[0] + ".rotateX") 90;
	makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $mesh[0];
}
if ($orient == "negZ"){
	setAttr ($mesh[0] + ".rotateZ") -90;
	makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $mesh[0];
}

copyMatrixAddGeo($targetName, $mesh[0], 1);

// constraint the scale to the .translateX attribute of a bone

$child = `listRelatives -c $targetName`;
if (`objExists($child[0])`){
	$multDiv = `createNode -n ($mesh[0] + "_multDiv") multiplyDivide`;
	setAttr ($multDiv + ".input2X") (`getAttr ($child[0] + ".translateX")`);
	connectAttr ($child[0] + ".translateX") ($multDiv + ".input1X");
	setAttr ($multDiv + ".operation") 2;
	connectAttr ($multDiv + ".outputX") ($mesh[0] + ".scaleX");
}
parent $mesh[0] $targetName;
// return the mesh name
return $mesh[0]; 
}

global proc copyMatrixAddGeo( string $sourceObj, string $targetObj, int $worldSpace){
string $command;
float $sourceMatrix[];
if($worldSpace == 1){
	$sourceMatrix = `xform -q -ws -m $sourceObj`;
	$command = "xform -ws -m ";
} else {
	$sourceMatrix = `xform -q -os -m $sourceObj`;
	$command = "xform -os -m ";
}



string $matrix;
string $a;
for($a in $sourceMatrix){
	$matrix += $a;
	$matrix += " ";
}

$command += $matrix;
$command += $targetObj;

eval($command);
}

 

Dawno tego narzedzia nie uzywalem ale powinno ci pomoc. Dodaje do zaznaczonych jointow geometrie (nie dziala na pelnej hierarhii wiec musisz sobie pozaznaczac wszystkie jointy ktore chcesz tym potraktowac.

To co napisze ponizej pisze "z dyni" wiec moge sie pomylic ale:

 

$sel = `ls -sl -l`;
selectHierarhy($sel[size($sel) - 1]);

proc selectHierarhy (string $obj){
$children = `listRelatives -c -f $obj`;
for ($child in $children){
	if ((`nodeType($child)`) == "joint"){
		select -add $child;
		selectHierarhy($child);
	}
}
}

 

 

Ten kod powinien zaznaczac wszystkie jointy w hierarchii. Musisz sprawdzic czy dziala wogole.

 

Pozdrowki

  • Author

dzięki ludzie, Kroopson rządzisz , skrypt działa mniej więcej tak jak chciałem, dzięki wielkie, pozdr

Create an account or sign in to comment

Important Information

We are using cookies. Read about our Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.