I Am Here With A New Problem

Hello guys

once again i need your help i have a new tasks to do and again i have no idea of how to do the same so need a help on the same the task is i want to do a function in mel which should be able to perform four tasks with the input of only two objects
the four tasks are it should do object constrain ,and should work on all the three transformations that is scale, rotation & movement of the object pls give me some help on the same ........................

with rgds
sid's

i am really sorry .. I cant understand what you looking for

can you tell more clearly then i think it will help us to

give a solution ...

I'm really having a hard time trying to understand what you're saying, I feel that I'm getting stuck in some sort of infinite loop after every 10 words I read.

How about the usage of "parentConstraint " (ie. parentConstraint cone1 cube1 )?

QUOTE
I feel that I'm getting stuck in some sort of infinite loop after every 10 words I read.

Let me help ... and put punctuation on the original message

once again i need your help.
I have a new tasks to do and again i have no idea of how to do it
I want to do a function in mel which should be able to perform four tasks with the input of only two objects :
--> object constraint on scale, rotation & movement

pls give me some help

Now that we all understand the problem, the solution as Daniel_Faust proposed :
select your first object (the "master"), then the second (the "slave") and do "parentConstraint" (under animation/Constrain)
That's it.
Now if you don't want to go each time on the menu, you can effectively write a MEL script, but you can also do the following :
keep the Shift and Ctrl keys pressed and select the function you want. The function will now appears on the current shelf.
It will even have its own Icon !!!!

Guy.

Hi

Parent constain won't work on scale attributes you need a scale constraint as well as a parent to tie that in as well. Other option is to do direct connections if the two are to act together. If we could get a better description from Sid's of what he is trying to do then it should be easier to give a solution.

guys

i am creating a mel procedure which should be having four options in it and those four options would be object constrain plus all the three objects transformations value i.e; scale, rotate, movement ..........................

now as this procedure was proposed to me through my senior to work on,and as i am too is a newbie to mel so am unable to make out any thing out here but the biggest misfortune with me is that i have to do this procedure now can u people pls help me out to solve my problem b'cos i just don't know what to do exactly over here................

waiting for u guys

          reply .............................

with regards

sid's

Hi

If I understand you correctly you nedd a GUI with four checkboxes,

Checkboxes
1 - Total Object Constrain
2 - Scale Constrain
3 - Transformation Constrain
4 - Rotation Constain.

Checkbox 1 is a parent constraint plus a Scale Constaint which means object 2 will follow object 1 exactly and scale along with it.

Checkbox 2 is a Scale Constraint only to tie their Scales together

CheckBox 3 is a Point Constarint only to tie Tranformations together

CheckBox 4 is an Orient Constraint to tie Rotations together.

User could then select Checkbox 1 only or a combo of the other 3 as required. Use the changecommand in checlbox 1 to disable other 3 if it is selected as they are not needed once 1 is chosen.

A procedure would then check which checkboxes are selected and react accordingly.

hi davvey

i tried what you have told me means i have created the ui for the above tasks but still i have doubts on how to call the check boxes which i have created for the given tasks i am sending you my code pls guide me on the same

with reagrds
sid's

my code is as follows:

string $window = window -title "sid";
string $layout = formLayout;
string $control1 = checkBox -label "Total Object Constrain";
string $control2 = checkBox -label "Scale Constrain";
string $control3 = checkBox -label "Transformation Constrain";
string $control4 = checkBox -label "Rotation Constrain";
formLayout -edit
-attachForm $control1 "top" 5
-attachForm $control2 "top" 25
-attachForm $control3 "top" 45
-attachForm $control4 "top" 65
$layout;
showWindow $window;

one more thing is there is that if i make four check boxes will i be able to call all of them with one procedure only and that too with the same condition which is input of two objects only pls brief me that whether it is possible or not and if yes then how can i do the same.

with rgds
sid's

Hi Sid's

Try the following as an example of how to do the things you want There are probably neater ways and you could set your form strings to global variables and query them but I prefer to use named controls but you need to remeber to keep them unique if possible. You could use the checkBoxGrp option which will allow a group of upto four checkBoxes in one command.

[codebox]
SidTest;

global proc SidTest()
{
string $window ;

//Check for multiple similar windows.
if (window -q -ex sid) deleteUI sid;
string $window = window -title "sid's Test" sid;

string $layout = formLayout;
string $control1 = checkBox
-label "Total Object Constrain"
-onCommand "checkBox -edit -enable 0 -value 0 ScaleChkBox; checkBox -e -en 0 -v 0 TransformChkBox; checkBox -e -en 0 -v 0 RotateChkBox;"
-offCommand "checkBox -e -en 1 ScaleChkBox; checkBox -e -en 1 TransformChkBox; checkBox -e -en 1 RotateChkBox;"
TotalChkBox
;

string $control2 = checkBox -label "Scale Constrain" ScaleChkBox;
string $control3 = checkBox -label "Transformation Constrain" TransformChkBox;
string $control4 = checkBox -label "Rotation Constrain" RotateChkBox;
string $button1 = button -label "Do Something" -command "CheckboxesTest;";
formLayout -edit
-attachForm $control1 "top" 5
-attachForm $control2 "top" 25
-attachForm $control3 "top" 45
-attachForm $control4 "top" 65
-attachForm $button1 "top" 100
$layout;
showWindow $window;

}

global proc CheckboxesTest()
{
if ((checkBox -query -value TotalChkBox == 0) && (checkBox -q -v ScaleChkBox == 0) &&
(checkBox -q -v TransformChkBox == 0) && (checkBox -q -v RotateChkBox == 0))
{print "OOPS!! Please select an action\n";}

if (checkBox -q -v TotalChkBox == 1)
{print "Constrain all";}

if (checkBox -q -v ScaleChkBox == 1)
{print "Constrain Scale";}

if (checkBox -q -v TransformChkBox == 1)
{print "Constrain Transform";}

if (checkBox -q -v RotateChkBox == 1)
{print "Constrain Roation";}

}
[/codebox]

PS You should Also get in the habit of testing if your window exists before running the script.

Davey you should probably use the long names instead of short ones as you named controls have a high conflict possibility. So pass the parent layouts name to the proc.

Hi Jooja
If I was doing this for myself I would normally name them with someone unique to me i.e I normally prefix all my controls with DVY_ plus something unique to that proc i.e DVY_StairPanelFloatFieldGrp_01 would be a typical control name. I use this naming convention for all my scripts as it tells me what script group it belongs to and the type of control it is and this means unique naming but as a general rule I agree you should use parent names or you can use global variables but this can mean a lot of globals in a large script.

Well thats not exactly what i meant. I meant you are free to use whatever names you like but dont reefer them directly.

Insetad refeer them with the full pathname wich here is the full name of the partent layout+|+the name thisway you can newer screw up.

Hi Sid's
Check you PM settings as you sent me a PM but I couldn't reply as your profile says you are set not to recieve PM's form the board. In the menatime I have e-mailed you a reply to the PM in the meantime.

Hi Jooja

I staeetd using unique names right at the beginning of me writing scripts and have stuck with it ever since. What you say makes good sense it just the way I work and it seems to work for me. So I suppose I will stick with it. Also When writing GUI's I dont always name each layout especially when "nesting" layouts within each other so I find sticking to my naming convention seems to work OK.

You dont need to set the name it just pass the name (you will get it as answer form layout creation result).

But see the upside of doing it like this is that you can sue the same procs for different windows, but just rename the controls specific like you did last and Maya will work with same code something different. SO you only need to develop guis.