Not sure what this would do: > cbk = > partial(module+'.'+function,float_name,attributes,lightsAll,lightsSel)
Where does 'module' and 'function' come from and how to you determine what you are passing? partial() is expecting a callable as the first argument, but you are passing something that could only be the string name of a module and the string name of a function. You would need to make sure you really just pass it a callable object. The only way i can see that you could avoid adding the callback to the slider as a second step, would be to not include any reference to the slider in the partial callback, and have the callback look up the slider at the time it is called, by some reference you use in the partial() instead. I feel like I would need to see some more complete code to comment any further about loops, and multiple sliders and whatnot. On Sep 14, 2013, at 8:14 PM, Daz wrote: > Hey Justin > > Thanks so much for that ! All works perfectly and I managed to get the rest > of my code working with it. Also thanks very much for the pointers! Will > write my upper/lower cases this way from now on. > > Also I noticed that in order for slider to work I need those 3 lines > #define > litIntensityMultiplier = cmds.floatSliderGrp(field=True, maxValue=1000, > pre=2, cw2=(60,20)) > #link to module > cbk = partial(TMPcore.lit_value, litIntensityMultiplier, "intensityMult", > lightsAll, lightsSel) > #link slider to module? > cmds.floatSliderGrp(litIntensityMultiplier, e=True, cc=cbk, dc=cbk) > > Is there a way to shorten it to 1 by any chance? I will have quite few > sliders and this simply triples the amount of code I need to manage.I tried > writing and function but partial threw me an error :) > > def > partial_callback(float_name,module,function,attributes,lightsAll,lightsSel): > cbk = > partial(module+'.'+function,float_name,attributes,lightsAll,lightsSel) > cmds.floatSliderGrp(float_name,e=True,cc=cbk,dc=cbk) > > litIntensityMultiplier = cmds.floatSliderGrp(field=True, maxValue=1000, > pre=2, cw2=(60,20)) > > partial_callback(litIntensityMultiplier,'TMP.core,"lit_value","intensityMult",lightsAll,lightsSel) > > Further more I'm not sure if function would be good. As if I were to control > 100 lights with it there might be a lot of loops and lag at the end. So maybe > having 3 lines of code is better. > > -- > 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.
