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.
joojaa
November 3, 2010, 7:04pm
2
maya ascii files are NOT MEL theres no such thing as group and xform in a maya ascii file. You must contend yourself with using following subset of commands:
file requires currentUnit fileInfo createNode setAttr select connectAttr lockNode
which is basically all you will ever need. Since a group is just basically the same thing as:
createNode transform -n "CHARACTERS";
you should use that. But your file is actually far more complicated than that. your file would look something like (didnt test very thoroughly):
//Maya ASCII 2009 scene
//Codeset: 1252
file -rdi 1 -ns "sfr" -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
requires maya "2009";
currentUnit -l centimeter -a degree -t pal;
fileInfo "application" "maya";
createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";
Tough you may want to actiually ad the default cameras or your order will be wonky So your scene should look like:
//Maya ASCII 2009 scene
//Codeset: 1252
file -rdi 1 -ns "sfr" -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
file -r -ns "sfr" -dr 1 -rfn "sfrRN" "//ibm-118/Work Area/char/sfr.ma";
requires maya "2009";
currentUnit -l centimeter -a degree -t pal;
fileInfo "application" "maya";
createNode transform -s -n "persp";
setAttr ".v" no;
setAttr ".t" -type "double3" 28 21 28 ;
setAttr ".r" -type "double3" -27.938352729602379 44.999999999999972 -5.172681101354183e-014 ;
createNode camera -s -n "perspShape" -p "persp";
setAttr -k off ".v" no;
setAttr ".fl" 34.999999999999993;
setAttr ".coi" 44.82186966202994;
setAttr ".imn" -type "string" "persp";
setAttr ".den" -type "string" "persp_depth";
setAttr ".man" -type "string" "persp_mask";
setAttr ".hc" -type "string" "viewSet -p %camera";
createNode transform -s -n "top";
setAttr ".v" no;
setAttr ".t" -type "double3" 0 100.1 0 ;
setAttr ".r" -type "double3" -89.999999999999986 0 0 ;
createNode camera -s -n "topShape" -p "top";
setAttr -k off ".v" no;
setAttr ".rnd" no;
setAttr ".coi" 100.1;
setAttr ".ow" 30;
setAttr ".imn" -type "string" "top";
setAttr ".den" -type "string" "top_depth";
setAttr ".man" -type "string" "top_mask";
setAttr ".hc" -type "string" "viewSet -t %camera";
setAttr ".o" yes;
createNode transform -s -n "front";
setAttr ".v" no;
setAttr ".t" -type "double3" 0 0 100.1 ;
createNode camera -s -n "frontShape" -p "front";
setAttr -k off ".v" no;
setAttr ".rnd" no;
setAttr ".coi" 100.1;
setAttr ".ow" 30;
setAttr ".imn" -type "string" "front";
setAttr ".den" -type "string" "front_depth";
setAttr ".man" -type "string" "front_mask";
setAttr ".hc" -type "string" "viewSet -f %camera";
setAttr ".o" yes;
createNode transform -s -n "side";
setAttr ".v" no;
setAttr ".t" -type "double3" 100.1 0 0 ;
setAttr ".r" -type "double3" 0 89.999999999999986 0 ;
createNode camera -s -n "sideShape" -p "side";
setAttr -k off ".v" no;
setAttr ".rnd" no;
setAttr ".coi" 100.1;
setAttr ".ow" 30;
setAttr ".imn" -type "string" "side";
setAttr ".den" -type "string" "side_depth";
setAttr ".man" -type "string" "side_mask";
setAttr ".hc" -type "string" "viewSet -s %camera";
setAttr ".o" yes;
createNode transform -n "CHARACTERS" ;
createNode reference -n "sfrRN";
lockNode -l 1 ;
connectAttr "sfrRN.msg" "CHARACTERS.ihi";
PS: make sure your application actually writes foles in windows-1252 format
Thanks Jooja. But one pbm now: 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?
Thanks.