Ozon Yağı | Medikal Ozon Yağı | HGF Link Değişimi

XSICollections, python and you

Have you ever called a some scripting function in Softimage and gotten back an XSICollection and printed that return value only to get a ‘None’ value printed to the log?
Don’t worry, you got some data there. Just remember that thats the way python in Softimage prints XSICollections if you would iterate over the collection you will find your values:

for object in returnedCollectin:
   # do something with object
   ...

I have seen some people who just started scripting in xsi run in to this little issue.

What I learned today #2: Various definitions of TEMP

In Softimage on Windows, if you fetch the TEMP environment variable e.g. from witihn python (with the os.environ dictionary), you will get a different directory when you get the TEMP variable from outside Softimage.
Outside Softimage you get:
C:\Users\<username>\some\path\I\cannot\rembemer
within it you get:
C:\Users\<username>\some\path\I\cannot\rembemer\XSI_temp_###

Just in case you wanted to write files to TEMP and read from them later.

Match translation “tool” for Maya

For those who have used XSI for anything have most likely encountered the very useful “Match translation” tool (and it’s variants). This tool exists in Maya but according to some it doesn’t work very well especially when within a hierarchy. So a solution was to constrain the object you want to move to the object that we want to match the translation to and then, in the outliner, delete the constraint.

This obviously is very tedious especially if you want to this many times. So I decided to try creating my first mel scripts and created a set of scripts in a custom shelf that do this automatically. Here is the “Match translation” script:

string $nodes[];
$nodes = `selectedNodes`;
pointConstraint -name tmpconstraint -offset 0 0 0 -weight 1;
select -r tmpconstraint;
delete;
select $nodes[size($nodes)-1];

 

This script simply automates the steps listed above and the other variants (translation+orientation, orientation, scale) all work in almost the same way.

These scripts work like this: you first pick the object that you want to match the translation to and second select the object you want to move and then hit one of the shelf buttons. Simple right?

I like to use these script as marking menus and on that note I was thinking about creating a tutorial that shows how to add custom marking menus, since I guess that some people simply don’t know how to do that (but many of you do). That tutorial will hopefully be up soon.

Anyway, you can find the script here and to install it you simply place it in
 
/Users//Library/Preferences/Autodesk/maya/8.5/prefs/shelves (on a mac)
 
and I can’t remember where to place it on other platforms.

©2007, Sveinbjörn J. Tryggvason | RSS | Comments-RSS

Seo | Böcek İlaçlama | Böcek İlaçlama | İlaçlama | Böcek İlaçlama | Böcek İlaçlama | Böcek İlaçlama | prefabrik ofis | prefabrik