justin is the master ;)  ... if you dont already I suggest separating the
functions you want and dont want to change in different files.  That
usually helps me figure out better ways to write functions that dont
require updating many functions, just my 2 cents


On Wed, Apr 17, 2013 at 7:33 PM, Justin Israel <[email protected]>wrote:

> I honestly didn't understand most of what you are trying to accomplish,
> but I got a bit of an idea from your two pastebin examples.
> Seems like all you really need here is to make better use of the function
> arguments.
>
> http://pastebin.com/0qVN3FAD
>
> Just split up your code into smaller reusable functions.
> 1. a function that can clear the selected items from all sets
> 2. a function that can take either a string or a list of string set names,
> and remove the currently selected items from each one
>
> For the addSelectedToSet() function, I could have used a *setNames in the
> parameter to take 1 or more string arguments, but I decided to make it more
> like the maya.cmds api and have it check if you passed a string and just
> treat it like a list.
>
> Hopefully this is what you were aiming for. For all I know, a class
> structure may be appropriate for your overall bigger goal, but all I could
> really figure out was your small example here.
>
>
>
> On Apr 17, 2013, at 9:29 PM, Daz wrote:
>
> Heya
>
> I actually have 2 questions atm. I'm scripting some tools for studio where
> I work and I think its time for me to start thinking a bit more about
> structure and how can I get the code to look and behave better rather than
> just trying to get it to do the stuff I want it to do...
>
> So one of the tools I wrote is an semi-automatic material manager. As it
> is now it work pretty good, however any changes I want to do result in a
> lot of copy/paste and its very time consuming. Now atm each iteration that
> happen is just a copy of main code + new variables. I was wondering if
> there is a way to code some kind off (well I think it is) class so that
> script can call back to it, plug new variables and then do the magic
> trick...
>
> Now I did read about classes a while back and yesterday and my tiny brain
> still don't get it atm... - no worries I'll get there eventually...
>
> In any case here is a graphical thing I'd like to do, its better for me to
> show it rather than write it...
>
> http://imgur.com/gUbZJ2j
>
> I basically want to have a piece of main code with lets say "place
> holders" that will be fill in once I run commands. This way I hope to be
> able to add new and more parts to the script to core code as we need them
> rather than code it 1 by 1 to each iteration.
>
> So is the Classes the right thing I need or what is it the thing I need to
> research?
>
> So as to second issue. I tried to do the thing above but not much luck
> tho... I didnt use classes. I wanted to just use functions but o well...
> Any ideas why this code is not working ?
>
> NOT working:
> http://pastebin.com/h2TP6Vmm
>
> Working:
> http://pastebin.com/v02SZ7Vg
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to