Problem linking floatField with floatSlider

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
  10 October 2012
Problem linking floatField with floatSlider

// Procedure that runs when the user changes the tolerance value
global proc float matchTolChange()
	global string $matchTolField;

	// Fetch field value
	global float $matchTol;
	$matchTol = `floatField -q -v $matchTolField`;
	floatField -e -v $matchTol $matchTolField;

	return $matchTol;

// Procedure for popping up the window for changing tolerance value
global proc changeTol()
	global float $matchTol;
	global string $matchTolField;
	global string $matchTolSlider;
	// In case the window is already open and hidden somewhere
	if (`window -exists matchTolWindow`) deleteUI matchTolWindow;
		// The window popup	
			-t "Adjust Match UVs -tolerance" 
			-mnb false 
			-mxb false 
			-resizeToFitChildren true

			-width 240 
			-height 130  
			-adjustableColumn true 
			-columnAlign "center" 
			-rowSpacing 6
		text -label "";		
		text -label "text";
		text -label "text";		

			-minValue 0.001 
			-maxValue 0.1 
			-value $matchTol 
			-precision 3  
			-step 0.001 
			-width 50 
			-minValue 0.001 
			-maxValue 0.1 
			-value $matchTol 
			-changeCommand "matchTolChange()"
		button -label "Close" -command "matchTolChange()" -width 100;
		text -label "";		
	showWindow matchTolWindow;

Short summary of the code:
The first procedure does that actual change to the $matchTol variable and is supposed to update both the floatField and the floatSlider. Currently it only updates the floatField.

The second procedure pops up the window with the UI. It's supposed to run the first procedure - updating the $matchTol -variable - when the user clicks the close button or move the slider.

The problem I have is linking the floatSlider to the floatField and make sure both updates when the user touches one of them. What am I doing wrong here?
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.
  10 October 2012
both floatField & floatSlider need to have a -cc so that when you click in them or drag them it will get the value from the field and edit the slider control and vice versa when you make a change.


floatField -cc "float $x=`floatField -q -v myFloatField`;floatSlider -e -v $x myFloatSlider" myFloatField;
blah blah blah
  10 October 2012
Thanks, that sorts the linking problem.
But CC only performs a command on change so the field wont update before the user lets go of the float slider. If you compare it with any other native Maya slider you will see that the associated fields always update when you drag the slider (click > drag > autoupdating) and not "just" when the user lets go of the slider. How can I achieve that effect?
(Mesh > Reduce for example has these kind of sliders)

EDIT: Nvm - I found out about floatSliderGrp
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.

Last edited by DeadlyNightshade : 10 October 2012 at 12:17 PM.
  10 October 2012
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
Society of Digital Artists

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

All times are GMT. The time now is 06:59 PM.

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