CGTalk > Software Specific Forums > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-10-2007, 06:46 PM   #1
lxdengar
Veteran
Mike Kelleher
Nuthin, Inc.
San Francisco, USA
 
Join Date: Aug 2005
Posts: 31
Getting starting MEL UI design: Quick questions

Hi All,

I tried looking through the forum before I asked these questions, but couldn't find the answer to my question. I appreciate the help.

I have a UI built, which creates and manipulates particle systems (changes amount, speed, adds fields etc). I have a delete button which correctly deletes the emitter and various systems, and rather than have the user close the window to recreate the system, I added a button for it.

The new system gets correctly created from my main proceedure, but the window values/sliders in the dialog window remained greyed out. Despite the system nodes being named the same, it looks like window doesn't recognize the new system. Closing the window and calling it again allows the system to be manipulated! I assume this is just a window refresh, but I can find anything in the mel reference about doing this.

***

Secondly, I'd like the user to be able to pick a mesh to emit particles from, and using size() and a selection array I can limit the selection to one object, but is there a way to test what kind of object it is? I assume that many, many people have done this before, so I was curious if anyone could point in the right direction. I did find

if (`nodeType ($item)` == "mesh")


But I'm sure there's more i could be checking.

Thanks for the help!

Last edited by lxdengar : 05-11-2007 at 12:49 AM.
 
Old 05-10-2007, 10:33 PM   #2
Buexe
Expert
 
Buexe's Avatar
portfolio
Jan Berger
Germany
 
Join Date: Apr 2003
Posts: 2,286
Usually when I create controls they are enabled by default, do you have any flag that disables them, like "-en 0" or something like that? And by whic hmechanism do you bind the controls to the node`s attributes. Maybe you could give an example of how you create the control and attach it to the node`s attributes to check your problem.

The other thing with testing nodes is, that you can use nodeType to get the exact type of node, but remember that some "objects" like a polyMesh consist of a transform and a shape node, so to see which kind of object you deal with in this situation probably the nodeType command on the shape node is the better choice.
Hope this helps
__________________
Digital Characters R&D - Suntoucher Labs
 
Old 05-11-2007, 12:46 AM   #3
lxdengar
Veteran
Mike Kelleher
Nuthin, Inc.
San Francisco, USA
 
Join Date: Aug 2005
Posts: 31
Arrow

Quote:
Originally Posted by Buexe
Usually when I create controls they are enabled by default, do you have any flag that disables them, like "-en 0" or something like that? And by whic hmechanism do you bind the controls to the node`s attributes. Maybe you could give an example of how you create the control and attach it to the node`s attributes to check your problem.



Thanks - no, no '-en 0' specific controls. Essentially, the window immediately calls a 'check' function which checks to see if the particle system exists (which consists of a particle object, and emitter, and an object from which to emit from):

global proc Check()
{
global string $Pshape[];
global string $ParticleObj[];

if (`particleExists $Pshape[0]` == 1)
{
print "Found existing Particle system.\n";
select $ParticleObj[0];
getPSAttr();
}
else if (`particleExists $Pshape[0]` == 0)
{
createPS();
}
}

The getPSAttr call goes and gets the attributes custom ones, and returns the shape[0], the Plane[0], and the Emit[0] objects. CreatePS goes and creates a new system, and then calls the getPSAttr function again, to get the custom values again. These are Per-Particle attributes like Speed, visibility, Opacity, etc.

I have a delete button, which deletes all of the objects above; a create button puts them back (calls createPS). The system gets created again, but the values in my sliders and fields remain grey.
Again, simply closing the window and calling showWindow again makes all the fields and sliders live!

the window creation sliders look something like this:

floatSliderGrp
-label "Particle Rate" -field true -cw 1 115
-value 10 -minValue 0 -maxValue 100 -step 1
-fieldMinValue 0 -fieldMaxValue 10000
PRate;

and one of the getPSAttr calls looks like this:

getAttr ($PEmit[0] + ".rate");

I'm sure its something simple, but I don't know what I'm missing. The fields go grey the moment I hit delete.

As for the nodetype command - is there an easy way to have it check the shape node?

Thanks for the help!



Last edited by lxdengar : 05-11-2007 at 01:05 AM.
 
Old 05-12-2007, 10:49 AM   #4
Buexe
Expert
 
Buexe's Avatar
portfolio
Jan Berger
Germany
 
Join Date: Apr 2003
Posts: 2,286
I think that once you want the control to control a new node and it`s attribute you simply have to use the edit mode ( -e ) to tell the control. Check this:

window -title "Attr Field Slider Groups";
string $objName[] = `sphere`;
columnLayout;

// I use a global string here so that it can be read by other procedures
global string $myAttrCtrl;
$myAttrCtrl = `attrFieldSliderGrp -min -10.0 -max 10.0 -at ($objName[0]+".tx")`;
showWindow;

// This deletes the object and the control gets greyed out
delete $objName[0]

// Create a new object
string $newObject[] = `polyCube`;

// Attach the control to the node and some attribute ( note the -e flag)
attrFieldSliderGrp -e -min -10.0 -max 10.0 -at ($newObject[0]+".tx") $myAttrCtrl;

I hope this helps
__________________
Digital Characters R&D - Suntoucher Labs
 
Old 05-12-2007, 10:49 AM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:06 PM.


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