Remove Syflex Cloth Cache files script


#1

Down for now


#2

Very handy script, NolanSW :slight_smile:

Have used it on several very different files to full effect; thanks!

Atwooki


#3

Glad you like it. It’s something that is used quite often at my work. I have two more scripts in the works for syflex. One is an attribute map copier. Intended to copy and paste one map to another. Works for both cloth and Blend cache. The the other is a sort of an option for the Create Blend menu command. It will pull up a GUI where you can define the cacheNames and, blend# and saveName attrs before you create it. If you select an already existing blend node then it acts like the attribute editor but I add a file browser to each of the cacheName and saveName. This then updates the attrs right then.

Cheers,
Sean


#4

Those 2 scripts sound quite mouth-watering also, Sean!

The copy Att. maps/ blend cache would certainly be a time saver, for sure; I’ll be looking out keenly to your updates / progress on those :slight_smile:

Thanks again

Atwooki


#5

Hey Atwooki,
While your here maybe you might be able to help me. Let’s say I paint an attribute map. Is there a way to invert the map? I know how to get and set the values but not sure how it can be inverted. I had a thought but I haven’t tested yet is iterating through the values and testing each one. If I take 1 and subtract the number from it to get the low or high number and if it’s 0 then make it 1 (Ex. 1 - 0.8 = 0.2 or if value is 0 then value = 1 and visa versa). Since the map is made up with a doubleArray, using a reverse node only works with floats so unless you know of a utility that will invert a doubleArray I’ll be most grateful.

-Sean


#6

Hi Sean -

Have you tried saving the painted ‘attribute map’ in the paint att. editor, then inverting it in photoshop, and reimporting it?

Atwooki


#7

It would be slicker if it was a button push and mel driven action than having to go outside of Maya to do it. I’ve tried exporting it and assign it as a texture, invert it and reassign but doesn’t seem to work. I’ll figure something out. Thanks for the help.

-Sean


#8

Try this code, Sean:

global proc string[] zooUtilsReverseArray( string $array[] ){
string $reversedArray[];
int $arraySize = size $array;

  for( $n = 0; $n < $arraySize; $n++ ) $reversedArray[( $arraySize - 1 - $n )] = $array[$n];
  return $reversedArray;
  } 

From MacaroniKazoo’s ‘zooUtilities’ mel

Atwooki


#9

I’ve got some of mac’s stuff. Didn’t know that was in there. Cool, I’ll give it a try.
Thanks again,
Sean


#10

LOL. The code does invert the map but it actually flips it. It takes the last index and makes it the first one and so forth. But I modified to do this and does what I need it to do now.


  global proc float[] invertArray( float $array[] )
   {
     float $reversedArray[];
     
   	  //get the array size
     int $arraySize = `size $array`;
    
     
     for( $n = 0; $n < $arraySize; $n++ )
   	  { 
   		    // test number
  		   // toggle if it's 1 or 0. If it's 1 or < 1 then subract 1 
   		    // from it
   		  float $number = $array[$n];
   		  if($number == 0)
   		  {
   			  $reversedArray[$n] = (1 + $array[$n]);
   		}
   		else
   		{
   			$reversedArray[$n] = (1 - $array[$n]);
   		}
   	}
     return $reversedArray;
    
   }
      
     }
       

This inverts the black and white color. So if the value is 1 it’s 0 or if it’s 0 it’s 1. If neither then subtract 1. Thanks for the code. This really helped.

 -Sean

#11

Nice one Sean :slight_smile:

This will definitely be useful in the growing armoury of useful weapons :smiley:

Atwooki


#12

Really envy you guys cud write out such beautiful computer language.

and i made my decision to study mel every time i saw them…


#13

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.