Copying ncloth per-vertex attributes

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  06 June 2008
Copying ncloth per-vertex attributes


I want to know if there is a way to copy the weight map of a per-vertex ncloth attributes from a scene to another scene (on the same object in a different scene).

I want to write a simple script to simulate the cloth on a character in many different scenes.
the cloth is skinned. So I select the cloth geometry, turn it to nCloth, set the Input mesh attract to 1.5 and input attract damp to 0. And I then use in the menu "edit ncloth: Paint vertex properties: input attract" and I paint a weight map for the parts I want to be fully dynamic.

My question is: how can I then copy this weight map and paste it in another scene on the same cloth but with its own deformation (by the skin) as a starting point. (I mean if I just copy the whole cloth, I will not have the skin animation as a strating point). And I would like to do this within a melscript.
  06 June 2008
Ok I found it.

While in paint mode, in the Paint NCloth Attributes Tool (right panel) in the Attribute Maps section , there is a sub-section called import. There is no export though. To export I create the map in "paint texture properties" instead of "paint vertex properties" mode. And then I can import the created map in "paint vertex" mode. And I can grab the melscript created in the script editor!

artImportAttrMapCB artAttrCtx "D:/vol/scripts/FX/cloth/hairWeight.tga" "image";
  06 June 2008
Note that you can also convert between texture and vertex maps automatically (nCloth->convertVertexToTextureMap)

  06 June 2008
Ok tanks a lot Duncan! Could be useful.
  08 August 2008
what if I dont got UVs for the objects I'm using as nCloth?
How do I transfer vertex input attraction weights from one to another?

  08 August 2008
ok, so I found this attribute nClothShape1.inputAttractPerVertex which seem to contain the vertices input Attract Weight so I wrote this code:

 float $hi[] = `getAttr nClothShape1.inputAttractPerVertex`;
 print $hi;
 setAttr "nClothShape2.inputAttractPerVertex" -type "doubleArray" $hi;

but its give me an ERROR

// Error: line 3: Error reading data element number 3: //

for now I have no Idea what is the Problem, I suppose it means the content of index 3 in the Array, I checked it and its got a float value in it.

  08 August 2008
you need to tell it the number in the array...
and you need to be built the command and eval it.
try this.

float $hi[] = `getAttr nClothShape1.inputAttractPerVertex`;
  string $CMD = ("setAttr -type doubleArray  nClothShape2.inputAttractPerVertex " + size($hi));
  for ($aVal in $hi){
  	$CMD+= (" " + $aVal);
  eval $CMD;

Make something idiot proof and they'll just build a better idiot
  08 August 2008
It works.
Thanks john.

  08 August 2008
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:11 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.