"Newbie Question ( about sliders )"

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2007   #1
"A Basic Script"

Hi Guys;

I am a newbie for MEL an ı have been studying it for last 30 days. I have already learned the fundamentals of MEL scripting and recently I started to build something realy basic..

I attempt to create a script that opens up a window containing ona button an a slider. the button for creating a sphere ( ıt is gonno be a polysphere by the way ) The slider will control the radius of this sphere...

Yes I know that it is totaly a stupid script and sound a little bit crazy... I was able to build the UI and button and slider. All of them worked properlly.

What I want to achive is that everytime I hit the button that creates a new sphere,I want my slider to control the last created sphere's radius info. Is that clear??? ( I hope so )

By the way, ı am realy new at this forum ( MEL sub forums ) If I am doing wrong something about asking, please warn me...

Here is What ı have done so far;


//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------

/*Stupid newbie script*/
//-----------------------------------
//1.Usual window stuff
//-----------------------------------

if(`window -exists windowUI`)
deleteUI windowUI;

//------------------------------------------
//2.Create a window...
//------------------------------------------

window
-title "SphereControler"
-mxb off
-wh 500 100
-sizeable off windowUI;

columnLayout
-adjustableColumn on;

button
-label "Sphere"
-command "polySphere";

attrFieldSliderGrp
-attribute "polySphere1.radius"
-fieldMinValue -10
-fieldMaxValue 10 ;

showWindow windowUI;


//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------

This one is only works when a polysphere is allready in the scene.. I tried so many things but I have not been able to fix this problem so far.. I am sure that it is pretty easy..

I hope you are not kidding me. ....

You can also suggest me everything you want!

See, you soon;

Ozioz

Last edited by ozioz : 05 May 2007 at 12:33 AM. Reason: Misstyped Title
 
Old 05 May 2007   #2
Anybody there??

....That was just a basic question... (I think so....)
 
Old 05 May 2007   #3
Originally Posted by ozioz: Hi Guys;
[...]---------------------------------------------------------------------

This one is only works when a polysphere is allready in the scene.. I tried so many things but I have not been able to fix this problem so far.. I am sure that it is pretty easy..

I hope you are not kidding me. ....

You can also suggest me everything you want!

See, you soon;

Ozioz


It should be possible to choose the most recent by looking at the list of all such spheres and chose either the first or the last (not sure the order they are listed) in the list and control that one. That assumes they are retrieved in creation-order of some kind, of course. If you can't use that strategy, you'll have to create your own script to make a sphere and always use it. In THAT script, update a global variable with the sphere you just created. Have the slider control control the sphere in the global variable.
 
Old 05 May 2007   #4

if(`window -exists windowUI`)
deleteUI windowUI;

window -title "SphereControler" -mxb off -wh 500 100 -sizeable off windowUI;

columnLayout -adjustableColumn on deleteThis;

	button -l "Create Sphere" -c makeSphere;

global proc makeSphere()
	{
	polySphere;
	string $selectedObj[] = `ls -sl`;
	string $sI[] = `listHistory $selectedObj`;
	deleteUI -lay deleteThis;
	columnLayout deleteThis;
	button -l "Create Sphere" -c makeSphere;
	attrFieldSliderGrp -min -10 -max 10 -attribute ($sI[1] + ".radius");
	}

showWindow windowUI;



Not sure if there's a better way. The button now creates the polysphere, finds the sphere's input node with the radius, deletes the layout and recreates the layout with a new button and slider for the last created sphere. Hope that helps.
 
Old 05 May 2007   #5
OK... Great

Yes man . That is exactly What I am looking for. As I mentioned before, it is a simple command but my purpose is understanding the logic of MEL rather than creating usefull scripts.

I am inventing the script you sent me.. If I cannot figure out what the commands are, I am gonno ask you guys again...

Se you soon.

Ozioz..

Edit: OK.. Here I am again. I took a look at the script. İt is perfect. But When it appears on the screen first, there is no slider that will control the radius of the sphere which is created by the button on the window. I wanna achive this effects.

Hope You can help me on this stuff..

Have nice scripting!!

Ozioz

Last edited by ozioz : 05 May 2007 at 07:46 PM. Reason: misstyping
 
Old 05 May 2007   #6
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:08 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.