PDA

View Full Version : Error: Collection not found, or no current collection.


karabo
10-29-2006, 02:55 AM
"Error: Collection not found, or no current collection."

Does anyone know what causes this error and how to prevent it? It's not an error in my script because when I restart maya and run the exact same code, it works fine. It's really irritating having to restart Maya from time to time when this error decides to pop up.
Any help would be greatly appreciated.

meljunky
10-30-2006, 07:29 PM
Try taking out the folder "pref" out of the x.x directory in your "My Documents" folder. Maya will recreate the folder and make it look like it is a fresh install.

-Brian
www.meljunky.com (http://www.meljunky.com)

jgibz
02-23-2007, 02:06 AM
I had this same problem,
If you don't want your hotkeys or windows prefs deleted, then delete the userPrefs.mel file in the \maya\x.x\prefs folder.

jgibz
06-16-2007, 11:08 PM
Odd, it's been a long time since I've had this problem, now when I try to source and run a script I get this again...
// Error: Collection not found, or no current collection. //

Deleting my prefs folder and restarting didn't help, and for some reason maya won't acknowledge my userHotkeys.mel file or my user pluginPrefs.mel file.

anyone know what causes this?

jgibz
01-26-2008, 04:45 AM
*bump
Anyone hear of a way to fix this? I still cant use certian scripts and they'd be a pain to rewrite.
TIA

*EDIT I fixed the problem, for some reason part of my ui code is causing the error.
global proc jgWarning()
{
confirmDialog -title "Error!" -message "You need to create the controls first.";
}



global proc int jgMakeRig()
{

//BUILD WINDOW
if(`window -exists jgWindow`)
deleteUI jgWindow;

string $jgMakeRigWindow = `window -title "jgMakeRig"
-widthHeight 483 500 jgWindow`;


//tabs variable for creating tabs after labeling.
string $tabs = `tabLayout`;

//LEG CREATION UI;
//leg marker
string $legTabMarker = `columnLayout`;


frameLayout -collapsable true -label "Make a setup with one control, attributes and a knee control will be added." -width 483;
columnLayout;

$jgHipText= `textFieldGrp -label "Hip Joint:" -w 300
-text "L_Hip" jgHipName`;

$jgAnkleText= `textFieldGrp -label "Ankle Joint:" -w 300
-text "L_Ankle" jgAnkleName`;

$jgBallText= `textFieldGrp -label "Ball Joint:" -w 300
-text "L_Ball" jgBallName`;

$jgToeText= `textFieldGrp -label "Joint at the end of a chain:" -w 300
-text "L_Toe" jgToeName`;

setParent ..;//back to frameLayout.
setParent ..;//back to columnLayout.

string $returnedStrings[];

//Action Buttons
frameLayout -collapsable true -label "Actions" -width 483;
rowLayout -nc 3;
button -label "Create Controls"
-command "string $jgHipJoint = `textFieldGrp -q -text jgHipName`; string $jgAnkleJoint = `textFieldGrp -q -text jgAnkleName`; string $jgBallJoint = `textFieldGrp -q -text jgBallName`; string $jgToeJoint = `textFieldGrp -q -text jgToeName`; source jgRigLeg; $returnedStrings = jgRigLeg($jgHipJoint, $jgAnkleJoint, $jgBallJoint, $jgToeJoint)";
button -label "Rig leg"
-command "source jgFinishRigLeg; jgFinishRigLeg($returnedStrings[0], $returnedStrings[1], $returnedStrings[2], $returnedStrings[3], $returnedStrings[4], $returnedStrings[5], $returnedStrings[6])";
button -label "cancel" -command "deleteUI jgWindow";


setParent..;//back to frameLayout
setParent..;//back to columnLayout
setParent..;//back to Window

//ARM CREATION UI
//arm tab marker
string $armTabMarker = `columnLayout`;


frameLayout -collapsable true -label "Make an IK/FK arm" -width 483;
columnLayout;

$jgShoulder = `textFieldGrp -label "Shoulder Joint: "
-text "L_shoulder" jgShoulderName`;
$jgElbow = `textFieldGrp -label "Elbow Joint: "
-text "L_elbow" jgElbowName`;
$jgForearm01 = `textFieldGrp -label "Forearm01 Joint: "
-text "L_forearm01" jgForearm01Name`;
$jgForearm02 = `textFieldGrp -label "Forearm02 Joint: "
-text "L_forearm02" jgForearm02Name`;
$jgForearm03 = `textFieldGrp -label "Forearm03 Joint: "
-text "L_forearm03" jgForearm03Name`;
$jgWrist = `textFieldGrp -label "Wrist Joint: "
-text "L_wrist" jgWristName`;

setParent..;//back to frameLayout
setParent..;//back to columnLayout

frameLayout -collapsable true -label "Make a Collar Control" -width 483;
columnLayout;

$jgCollar = `textFieldGrp -label "Collar Joint: "
-text "L_collar" jgCollarName`;

setParent..;//back to frameLayout
setParent..;//back to columnLayout

/*String to send jgRigArm's return to.*/
string $returnedArmStrings[];

//Arm setup action buttons
frameLayout -collapsable true -label "Actions" -width 483;
rowLayout -nc 3;

button -label "Create Controls"
-command "$shoulderJoint = `textFieldGrp -q -text jgShoulderName`;$elbowJoint = `textFieldGrp -q -text jgElbowName`; $forearmJoint01 = `textFieldGrp -q -text jgForearm01Name`;$forearmJoint02 = `textFieldGrp -q -text jgForearm02Name`;$forearmJoint03 = `textFieldGrp -q -text jgForearm03Name`;$wristJoint = `textFieldGrp -q -text jgWristName`; source jgRigArm; $returnedArmStrings = jgRigArm($shoulderJoint, $elbowJoint, $forearmJoint01, $forearmJoint02, $forearmJoint03, $wristJoint)";

button -label "Rig Arm"
-command "source jgFinishRigArm; jgFinishRigArm($returnedArmStrings[0],$returnedArmStrings[1], $returnedArmStrings[2], $returnedArmStrings[3], $returnedArmStrings[4], $returnedArmStrings[5], $returnedArmStrings[6])";
button -label "cancel" -command "deleteUI jgWindow";

setParent..;//back to frameLayout
setParent..;//back to columnLayout
setParent..;//back to Window

//SPINE CREATION UI
//spine tab marker
string $spineTabMarker = `columnLayout`;
frameLayout -collapsable true -label "test" -width 483;
rowLayout -nc 2;
button -label "test1";
button -label "test2";

setParent..;//back to frameLayout
setParent..;//back to columnLayout
setParent..;//back to Window

//FACE AND HEAD CREATION UI
string $headTabMarker = `columnLayout`;
frameLayout -collapsable true -label "Neck" -width 483;
rowLayout -nc 2;
button -label "text1";

setParent..;//back to frameLayout
setParent..;//back to columnLayout

frameLayout -collapsable true -label "Create an eye control with auto-following eyelids and blink controls." -width 483;
columnLayout;

$jgEyeball = `textFieldGrp -label "Eyeball name/EyeBall group" -text "L_eyeBall" jgEyeballName`;
$jgUpperLid = `textFieldGrp -label "Upper eyelid name: " -text "L_upperLid" jgUpperLidName`;
$jgLowerLid = `textFieldGrp -label "Lower eyelid name: " -text "L_lowerLid" jgLowerLidName`;
$jgEyeJoint = `textFieldGrp -label "Eye joint name: " -text "L_eyeJoint" jgEyeJointName`;

/*String variable the will hold the axis character, this changes each time one of the
radio buttons is clicked.*/
string $jgAxis;

/*$jgAxis = `radioButtonGrp -numberOfRadioButtons 3 -label "Axis through pupil." -labelArray3 "X" "Y" "Z"`;
*/
/*
text -label " ";
text -label "Axis that runs through the pupil:";
radioButton -label "X" -changeCommand "$jgAxis = \"X\"";
radioButton -label "Y" -changeCommand "$jgAxis = \"Y\"";
radioButton -label "Z" -changeCommand "$jgAxis = \"Z\""; */


setParent..;//back to frameLayout
setParent..;//back to columnLayout

frameLayout -collapsable true -label "Actions" -width 483;
rowLayout -nc 3 ;

button -label "Rig eye"
-command "$eyeBall = `textFieldGrp -q -text jgEyeballName`; $eyeJoint = `textFieldGrp -q -text jgEyeJointName`;$lowerLid = `textFieldGrp -q -text jgLowerLidName`; $upperLid = `textFieldGrp -q -text jgUpperLidName`; source jgRigEye; jgRigEye($eyeBall, $eyeJoint, $lowerLid, $upperLid, $jgAxis)";
button -label "Cancel" -command "deleteUI jgWindow";


setParent..;//back to frameLayout
setParent..;//back to columnLayout
setParent..;//back to Window

//Tab layouts
tabLayout -edit
-tl $legTabMarker "Legs"
-tl $armTabMarker "Arms"
-tl $spineTabMarker "Spine"
-tl $headTabMarker "Head/Face"

$tabs;

showWindow $jgMakeRigWindow;

/*Create a layer to hide all the objects the user shouldnt interact with.*/
createDisplayLayer -n "dontTouch";
layerEditorLayerButtonVisibilityChange dontTouch;

return 0;

}



by commenting out the below code I was able to get the script to work.
Only now a minor part of the ui is missing. Can anyone suggest what im doing wrong?
/*
text -label " ";
text -label "Axis that runs through the pupil:";
radioButton -label "X" -changeCommand "$jgAxis = \"X\"";
radioButton -label "Y" -changeCommand "$jgAxis = \"Y\"";
radioButton -label "Z" -changeCommand "$jgAxis = \"Z\""; */

jgibz
09-28-2008, 05:59 AM
Well, the thread hasn't been closed yet, so if anyone has this problem, try sourcing your scripts as often as possible. If u have a parent script that sources other files, try restarting maya and sourcing all your scripts before u call your main script. This seems to be the main cause of the error in question.
-peace

CGTalk Moderation
09-28-2008, 05:59 AM
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.