PDA

View Full Version : Put referenced node into a group in .ma file code


jojanpm
11-03-2010, 01:01 PM
How can v put a referenced node into a new group in a .ma file?
For e.g; see my .ma file:

//Maya ASCII 2009 scene
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "\\\\ibm-118/Work Area/char/sfr.ma";
requires maya "2009";
select -ado;
group -n "CHARACTERS"; xform -os -piv 0 0 0;


sfr.ma contains just a sphere, say sfr1.
I need to put it inside a group named "CHARACTERS".
I am not running this by opening the scene in Maya - I need to write it in that .ma file itself.
But the above code wont work.
Any way to do this..? Plz help.

NaughtyNathan
11-03-2010, 04:21 PM
.ma files are NOT straight MEL code. They are similar looking it is true, but trying to edit/modify them as MEL is going to give you grief.

:nathaN

jojanpm
11-04-2010, 03:21 AM
ya, u r right. thnx.

i solvd my pbm by replacing last two lines with:

createNode "transform" -n "CHARACTERS";
createNode reference -n "sfrRN";
setAttr ".ed" -type "dataReferenceEdits"
"sfrRN"
"sfrRN" 0
"sfrRN" 1
0 "|sfr:*" "|CHARACTERS" "-s -r ";

spiderman3
11-04-2010, 05:06 AM
u can write a code in python to do it...

maya files can be opened using python the same way you open a files in maya so that you can apply it on any maya files...

the code will run as u will run any code from your script editor in maya after opening a file..

jojanpm
11-04-2010, 05:13 AM
This will also work:

createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";

jojanpm
11-10-2010, 12:32 PM
My solution will work if only one reference. But what if there are multiple references needs to be grouped under one? For e.g;


//Maya ASCII 2009 scene
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
file -r -ns "box" -dr 1 -rfn "boxRN" "//ibm-118/Work Area/char/box.ma";
requires maya "2009";

createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";
createNode reference -n "boxRN";
lockNode -l 1 ;
connectAttr "boxRN.msg" "CHARACTERS.ihi";


.... This is not a valid .ma file.
The error shown while open in Maya is:
'CHARACTERS.isHistoricallyInteresting' already has an incoming connection from 'sfrRN.message'

... ihi attribute is already connected.
Is there any way to group multiple references under one group?

CGTalk Moderation
11-10-2010, 12:32 PM
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.