Skocz do zawartości

Dzielenie zeskinowanego jointa.


Kroopson

Rekomendowane odpowiedzi

Ot - taki sobie pomysł na narzędzie.

Może ktoś będzie miał jakąś dobrą ideę jak to rozwijać dalej:

 

{

$sel = `ls -sl`;

$joint = $sel[0]; // selected joint
$childs = `listRelatives -c $joint`; 
$childJoint = $childs[0]; // his first child joint

$conn = `listConnections -t "skinCluster" $sel[0]`; //this is a first skin cluster connected to the joint
$meshes = `listConnections -t "mesh" $conn[0]`; // meshes connected to the joint
$vertsNum = `polyEvaluate -v $meshes[0]`; // number of a verts in a mesh

string $influencedVerts[]; // influenced verts init

float $subJointsNum = 5; // number of subjoints (later to be controlled with a passed argument
float $vertDots[]; // dot products of vertex  joint vectors. Needed to estimate the position against the joint's X-axis.

$jointPos = `xform -q -ws -t $joint`;
$childPos = `xform -q -ws -t $childJoint`;

float $vecX = $childPos[0] - $jointPos[0];
float $vecY = $childPos[1] - $jointPos[1];
float $vecZ = $childPos[2] - $jointPos[2];

vector $jointVector = >;

string $newSkinJoints[];
$newSkinJoints[0] = $joint;

// CREATE SUBJOINTS

for ($a = 1; $a 	$njX = ($vecX * ((1 / $subJointsNum) * $a)) + $jointPos[0];
$njY = ($vecY * ((1 / $subJointsNum) * $a)) + $jointPos[1];
$njZ = ($vecZ * ((1 / $subJointsNum) * $a)) + $jointPos[2];
$roo = `joint -q -roo $joint`;
$o = `joint -q -o $joint`;
$rad = `joint -q -rad $joint`;
$newJoint = `joint -p $njX $njY $njZ -roo $roo -rad $rad[0] -n ($joint +"_"+$a + "_rotator")`;
//-o $o[0] $o[1] $o[2] 
$newSkinJoints[size($newSkinJoints)] = $newJoint;
}
$newSkinJoints[size($newSkinJoints)] = $childJoint;
parent $newSkinJoints[size($newSkinJoints) - 1] $newSkinJoints[size($newSkinJoints) - 2];


// LOCK ALL INFLUENCES EXCEPT THE SPLITTED JOINT

$influ = `skinCluster -q -inf $conn[0]`;
for ($inf in $influ){
setAttr ($inf + ".liw") 1;
}
setAttr ($joint + ".liw") 0;
//setAttr ($childJoint + ".liw") 0;

// ADD INFLUENCES TO THE SKIN CLUSTER

for ($a = 1; $a 	skinCluster -e -wt 0 -ai $newSkinJoints[$a] $conn[0];
}

//REGISTER ALL INFLUENCED VERTS IN ONE ARRAY

for ($a = 0; $a 	$val = `skinPercent -t $joint -q $conn[0] ($meshes[0] + ".vtx[" + $a + "]" )`;
if ($val > 0) $influencedVerts[size($influencedVerts)] = $a;
}


for ($vertNum in $influencedVerts){
$vertPos = `xform -q -t -ws ($meshes[0] + ".vtx[" + $vertNum + "]")`;
float $vertPosX = $vertPos[0] - $jointPos[0];
float $vertPosY = $vertPos[1] - $jointPos[1];
float $vertPosZ = $vertPos[2] - $jointPos[2];
vector $vertVector = >;
$vertDot = `dot $jointVector $vertVector`;
$jointVecMag = `mag $jointVector`;
if ($jointVecMag > 0){
	$vertDot = $vertDot / $jointVecMag;
	$vertDot = $vertDot / $jointVecMag;
	$vertDots[size($vertDots)] = $vertDot;
}

$vertexJointNum = $vertDot / (1 / $subJointsNum);
float $floorJoint = `clamp 0 (size($newSkinJoints) - 1) (floor($vertexJointNum))`;
float $easeVal = $vertexJointNum - $floorJoint;
int $floorInt = $floorJoint;
int $floorIntClamp = `clamp 0 (size($newSkinJoints) - 1) ($floorInt+1)`;
float $vtxBaseWt = `skinPercent -t $newSkinJoints[0] -q $conn[0] ($meshes[0] + ".vtx[" + $vertNum + "]")`;
skinPercent -tv $newSkinJoints[0] 0 $conn[0] ($meshes[0] + ".vtx[" + $vertNum + "]");
skinPercent -tv $newSkinJoints[$floorInt] ($vtxBaseWt - ($vtxBaseWt * $easeVal)) $conn[0] ($meshes[0] + ".vtx[" + $vertNum + "]");
skinPercent -tv $newSkinJoints[$floorIntClamp] ($vtxBaseWt * $easeVal) $conn[0] ($meshes[0] + ".vtx[" + $vertNum + "]");
}

}

Odnośnik do komentarza
Udostępnij na innych stronach

  • Odpowiedzi 6
  • Created
  • Ostatniej odpowiedzi

Top Posters In This Topic

no ok, szacun, tylko po co ? maya to jeden wielki majdan, ktory niebawem sie wykrzaczy, tylko na to czekam, ale masz 5+

 

nie wiem czy nie zauważyłeś ale ten "majdan" to wciąż jedyne słuszne narzędzie do animacji przy pełnych metrażach i szybko się to nie zmieni.

Odnośnik do komentarza
Udostępnij na innych stronach

nie wiem czy nie zauważyłeś ale ten "majdan" to wciąż jedyne słuszne narzędzie do animacji przy pełnych metrażach i szybko się to nie zmieni.

 

pffff..... to mi argument zes znalazl, ze wszyscy jezdza na zimowkach latem to znaczy ze i ty musisz ? masz potencjal nie marnuj go,

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się



×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Wykorzystujemy cookies. Przeczytaj więcej Polityka prywatności