[Maya-Python] Re: Simple program with complicated problem! InternalVar issue?
Are you kidding me? That's it! Thank you so much, haha. I was using an american set keyboard and a small screen. The two obviously don't mix well. Perfect answer. On Sunday, August 9, 2015 at 4:41:43 PM UTC+1, ABHIRAJ KK wrote: *Hi, kate * *check the icons i in ur code i think u have used some special characters * *imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* *mc.image(image=imagePath)* -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
First thing don't use your style formatting to post code, its totally not readable :(. Can you put your code in pastebin or some other https://gist.github.com/ . It will much better. On Mon, Aug 10, 2015 at 9:41 AM, Kate Sendall kate.alicia.send...@googlemail.com wrote: Here's my code so far. Ignore some of the code that doesn't seem to 'do' anything. It's a work in progress! The problem lies in a complete piece of code/script that *should *run. I'm putting blue lines in where I think the issue might be: *1.import maya.cmds as mc* * import pymel.core.datatypes as pym * * #clearing up the scene * * mc.select(all=True)* * mc.delete()* * #defining my User Interface window* *10.* * def createSUI():* * #checking to see if my window exists and deleting* * if mc.window('myWin', exists=True):* * mc.deleteUI('myWin')* * #creating window and setting layout* * windowID = mc.window('myWin', rtf=True, t=Can't Stop Stairing - Stair Maker 2015, backgroundColor=(0.2, 0.2, 0.2), mnb=False, mxb=False, sizeable=True)* * mc.columnLayout(w=400, h=600)* *20.* * #placing banner image* * imagePath = mc.internalVar(userPrefDir=True) +'icons/stairImage.png'* * mc.image(image=imagePath)* * mc.separator(h=5)* * #creating my physical in-window sliders* * mc.intSliderGrp('stepWidthSlider', l = 'Step Width', v=20, min=1, max=40, field=True)* * mc.separator(h=5)* *30. mc.floatSliderGrp('stepHeightSlider', l = 'Step Height', v=4.2, min=0.5, max=8.0, field=True)* * mc.separator(h=5)* * mc.floatSliderGrp('stepDepthSlider', l = 'Step Depth', v=5.2, min=0.5, max=10, field=True)* * mc.separator(h=5)* * mc.intSliderGrp('numSteps', l = 'Number of Steps', v=50, min=2, max=100, field=True)* * mc.separator(h=5)* * #creating my physical in-window button* * mc.button(l= 'Make Step', backgroundColor=(0.25, 0.25, 0.25), w=400, h=50, c = 'myStep()')* *40. mc.separator(h=5)* * mc.button(l= 'Make Spiral Stairs', backgroundColor=(0.3, 0.3, 0.3), w=400, h=50, c='makeSpiralStairs()')* * mc.separator(h=5)* * mc.button(l= 'Make Straight Stairs', backgroundColor=(0.35, 0.35, 0.35), w=400, h=50, c='makeStraightStairs()')* * mc.separator(h=5)* * mc.button(l= 'Change Stair Material', backgroundColor=(0.4, 0.4, 0.4), w=400, h=50, c='applyMaterial()')* * mc.separator(h=5)* * mc.button(l= 'Delete All', backgroundColor=(0.45, 0.45, 0.45), w=400, h=50, c='deleteStairs()')* * mc.showWindow('myWin')* *50.#fetching data from User Interface sliders* * def myStep():* * mc.polyCube(w = myStepWidth(), h = myStepHeight(), d = myStepDepth(), n = 'myStep')*** * def myStepDepth():* * return mc.floatSliderGrp('stepDepthSlider', q = True, value = True) *** * def myStepHeight():* * return mc.floatSliderGrp('stepHeightSlider', q = True, value = True)* *60.* * def myStepWidth():* * return mc.intSliderGrp('stepWidthSlider', q = True, value = True)* * def numOfMySteps():* * return mc.intSliderGrp('numSteps', q = True, value = True)* * #calculating rotate integer for Spiral Stairs from step dimension slider values * * def rotationRadian():* *70. return pym.atan((myStepDepth()-(0.15*myStepDepth()))/myStepWidth()) * * print rotationRadian()* * def rotationFactor():* * return pym.degrees(rotationRadian())* * print rotationFactor() * * def makeSpiralStairs():* * i=0* *80. myStep()* * while i 80:* * mc.duplicate()* * mc.move(0, myStepHeight(), 0, relative=True)* * mc.rotate(0, rotationFactor(), 0, relative=True) * ** * i+=1* * def makeStraightStairs():* * myStep()* *90. mc.duplicate (rr = True)* * mc.move (0, 0.8*myStepHeight(), -0.8*myStepDepth(), relative = True) *** * for i in range (numOfMySteps()):* * #Duplicates the step again using the previous transform* * mc.duplicate (rr = True, st = True)* * def applyMaterial():* * myShader = mc.shadingNode('mia_material_x', asShader=True)* * mc.select('myCube*')* *100. mc.hyperShade(assign = myShader) * * def deleteStairs():* * mc.select(all=True)* * mc.delete() * * createSUI()* 110. The error code is exactly: #Error: RuntimeError: file maya console line 56: Object 'stepDepthSlider' not found. I don't know what could be wrong? The
Re: [Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
Alrighty, here we go. I'm not sure how to use these embed things. I hope it works. XD script src=https://gist.github.com/anonymous/7e7324f48fec4f041b8b.js;/script -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7d00ec33-bb92-41a3-b308-f9c053a97d45%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
Here's my code so far. Ignore some of the code that doesn't seem to 'do' anything. It's a work in progress! The problem lies in a complete piece of code/script that *should *run. I'm putting blue lines in where I think the issue might be: *1.import maya.cmds as mc* * import pymel.core.datatypes as pym * * #clearing up the scene * * mc.select(all=True)* * mc.delete()* * #defining my User Interface window* *10.* * def createSUI():* * #checking to see if my window exists and deleting* * if mc.window('myWin', exists=True):* * mc.deleteUI('myWin')* * #creating window and setting layout* * windowID = mc.window('myWin', rtf=True, t=Can't Stop Stairing - Stair Maker 2015, backgroundColor=(0.2, 0.2, 0.2), mnb=False, mxb=False, sizeable=True)* * mc.columnLayout(w=400, h=600)* *20.* * #placing banner image* * imagePath = mc.internalVar(userPrefDir=True) +'icons/stairImage.png'* * mc.image(image=imagePath)* * mc.separator(h=5)* * #creating my physical in-window sliders* * mc.intSliderGrp('stepWidthSlider', l = 'Step Width', v=20, min=1, max=40, field=True)* * mc.separator(h=5)* *30. mc.floatSliderGrp('stepHeightSlider', l = 'Step Height', v=4.2, min=0.5, max=8.0, field=True)* * mc.separator(h=5)* * mc.floatSliderGrp('stepDepthSlider', l = 'Step Depth', v=5.2, min=0.5, max=10, field=True)* * mc.separator(h=5)* * mc.intSliderGrp('numSteps', l = 'Number of Steps', v=50, min=2, max=100, field=True)* * mc.separator(h=5)* * #creating my physical in-window button* * mc.button(l= 'Make Step', backgroundColor=(0.25, 0.25, 0.25), w=400, h=50, c = 'myStep()')* *40. mc.separator(h=5)* * mc.button(l= 'Make Spiral Stairs', backgroundColor=(0.3, 0.3, 0.3), w=400, h=50, c='makeSpiralStairs()')* * mc.separator(h=5)* * mc.button(l= 'Make Straight Stairs', backgroundColor=(0.35, 0.35, 0.35), w=400, h=50, c='makeStraightStairs()')* * mc.separator(h=5)* * mc.button(l= 'Change Stair Material', backgroundColor=(0.4, 0.4, 0.4), w=400, h=50, c='applyMaterial()')* * mc.separator(h=5)* * mc.button(l= 'Delete All', backgroundColor=(0.45, 0.45, 0.45), w=400, h=50, c='deleteStairs()')* * mc.showWindow('myWin')* *50.#fetching data from User Interface sliders* * def myStep():* * mc.polyCube(w = myStepWidth(), h = myStepHeight(), d = myStepDepth(), n = 'myStep')*** * def myStepDepth():* * return mc.floatSliderGrp('stepDepthSlider', q = True, value = True) *** * def myStepHeight():* * return mc.floatSliderGrp('stepHeightSlider', q = True, value = True)* *60.* * def myStepWidth():* * return mc.intSliderGrp('stepWidthSlider', q = True, value = True)* * def numOfMySteps():* * return mc.intSliderGrp('numSteps', q = True, value = True)* * #calculating rotate integer for Spiral Stairs from step dimension slider values * * def rotationRadian():* *70. return pym.atan((myStepDepth()-(0.15*myStepDepth()))/myStepWidth()) * * print rotationRadian()* * def rotationFactor():* * return pym.degrees(rotationRadian())* * print rotationFactor() * * def makeSpiralStairs():* * i=0* *80. myStep()* * while i 80:* * mc.duplicate()* * mc.move(0, myStepHeight(), 0, relative=True)* * mc.rotate(0, rotationFactor(), 0, relative=True) * ** * i+=1* * def makeStraightStairs():* * myStep()* *90. mc.duplicate (rr = True)* * mc.move (0, 0.8*myStepHeight(), -0.8*myStepDepth(), relative = True) *** * for i in range (numOfMySteps()):* * #Duplicates the step again using the previous transform* * mc.duplicate (rr = True, st = True)* * def applyMaterial():* * myShader = mc.shadingNode('mia_material_x', asShader=True)* * mc.select('myCube*')* *100. mc.hyperShade(assign = myShader) * * def deleteStairs():* * mc.select(all=True)* * mc.delete() * * createSUI()* 110. The error code is exactly: #Error: RuntimeError: file maya console line 56: Object 'stepDepthSlider' not found. I don't know what could be wrong? The only difference in stepDepthSlider is that it is used in my rotate function... but so is stepWidthSlider! Thanks Kate -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To unsubscribe from this
Re: [Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
Please just give the normal url to a pastebin or gist. I'm using a mobile email client and can't use HTML embed codes On Tue, 11 Aug 2015 5:17 AM Kate Sendall kate.alicia.send...@googlemail.com wrote: Wow. Just clicked it. Scratch that. On Monday, 10 August 2015 18:13:56 UTC+1, Kate Sendall wrote: Alrighty, here we go. I'm not sure how to use these embed things. I hope it works. XD script src=https://gist.github.com/anonymous/7e7324f48fec4f041b8b.js /script -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2f341d83-271d-42f2-b125-0dbd65b7301f%40googlegroups.com https://groups.google.com/d/msgid/python_inside_maya/2f341d83-271d-42f2-b125-0dbd65b7301f%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1%2BwrZp2WBPzitPXfShUAPNCwX4nVVg1C-riVSHbwi3OA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
Oh... ok. I'm very new to all this. I think this is what you're asking for? http://pastebin.com/sRdhU5HV -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a6b1dc88-2480-480a-8824-26980df4cc03%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Procedural programming stairs. Have a RuntimeError saying my object is not found?
On Tue, Aug 11, 2015 at 7:52 AM Kate Sendall kate.alicia.send...@googlemail.com wrote: Oh... ok. I'm very new to all this. I think this is what you're asking for? http://pastebin.com/sRdhU5HV Yep, the URL is exactly what you should use, like this. But now you need to do it one more time and not use a private paste :-) Can you use public that never expires? -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a6b1dc88-2480-480a-8824-26980df4cc03%40googlegroups.com https://groups.google.com/d/msgid/python_inside_maya/a6b1dc88-2480-480a-8824-26980df4cc03%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0xm3nV12_4DgELtZVU3rqcL2MD6q%3DUJpJJXWAr_SbTpg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Pyblish By Example
Hey Marcus, Just a list of feedback as I read through it: * The quickstart showed 4 different plugin classes that were used. It would be nice if you first just quickly said something like pyblish has a number of task oriented classes to derive from. these 4 do xyz. Just a short sentence on the purpose of each one. * In the quick start, you might not want to use an assert as an official example of a validator implementation. I believe assert statements can be optimised away from code if the code is run under a python optimisation flag. Might be an edge case, but people may just take your example and always do it. Is there another way to fail the validation? Is it only AssertionError? Or is it any exception raised? Might be good to be absolutely clear about what is expected to communicate a validation failure that will be properly handled by the framework. * Files - can PYBLISHPLUGINPATH take multiple paths? I. e. : or ; separated? * Branching 2 - I actually had to read that example a couple times to get the fact that PrintAssets operates on each asset. I know you mentioned earlier that it uses dependency injection, but I have rarely (if ever) seen it used like this in a dynamic language. Normally it is much clearer in a statically typed language where you can read the exact type, as opposed to how this is magical based on the attribute names. The part I found confusing is that not only is it based purely on magic variable names, but in addition to injecting the dependencies, it also changes the behaviour of the function. It was hard for me to get that from reading the code. Two plugins derived from the same plugin base class, implementing the same process() function, with the same number of arguments... but different argument names... will behave differently. What happens if I do process(self, context, asset)? That is legal right? Are there any illegal combinations that will be ambiguous as to what the plugin will actually want to do? * Validating 1/2 - More use of assert as an official example, which might not be a good idea: https://wiki.python.org/moin/UsingAssertionsEffectively Assertions should *not* be used to test for failure cases that can occur because of bad user input or operating system/environment failures, such as a file not being found. Instead, you should raise an exception, or print an error message, or whatever is appropriate. One important reason why assertions should only be used for self-tests of the program is that assertions can be disabled at compile time. * Report 4 - Let's get cackin'. typo? Hope that feedback is useful! Justin On Tue, 11 Aug 2015 12:17 AM Marcus Ottosson konstrukt...@gmail.com wrote: Added a getting started guide to Pyblish, the test-driven content creation framework, that I'd like to share. It includes a Maya-specific example of a basic asset - a rig - along with how it can be published. - http://forums.pyblish.com/t/learning-pyblish-by-example I'm looking for insight on first impressions and whether there are things too easy, too difficult, too quickly explained or too slow and mundane for a technical directory or pipeline developer to follow. Enjoy and let me know what you think! -- *Marcus Ottosson* konstrukt...@gmail.com -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCsh6GHa-2gnVkr5qyA2LYTCv%3DpxnZYfUNVL3efhiEqnQ%40mail.gmail.com https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCsh6GHa-2gnVkr5qyA2LYTCv%3DpxnZYfUNVL3efhiEqnQ%40mail.gmail.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA21QavJTO%3D4Ykgbq_-fgMQNa5VjkOEyQRHhY36W%2B%2BQUig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Re: Simple program with complicated problem! InternalVar issue?
Or, if you're like me and don't ever remember how the %s formatting works: imagePath={pth}icons/staircon.jpg.format(pth=mc.internalVar(userPrefDir=True)) or better yet, because it's a file path: import os imagePath= os.path.join(mc.internalVar(userPrefDir=True), 'icons', 'staircon.jpg') That last one is often best, because it will handle os specific things like whether directories are split by '/' or by '\'. On Monday, August 10, 2015 at 3:49:34 PM UTC-5, larry wrote: *I would use python string formatting instead of the + operator.* *Try something like:* *imagePath=%sicons/staircon.jpg%**mc.internalVar(userPrefDir=True)* *instead of:imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* *More info:* *http://www.diveintopython.net/native_data_types/formatting_strings.html http://www.diveintopython.net/native_data_types/formatting_strings.html* On Mon, Aug 10, 2015 at 9:13 AM, Kate Sendall kate.alic...@googlemail.com javascript: wrote: Are you kidding me? That's it! Thank you so much, haha. I was using an american set keyboard and a small screen. The two obviously don't mix well. Perfect answer. On Sunday, August 9, 2015 at 4:41:43 PM UTC+1, ABHIRAJ KK wrote: *Hi, kate * *check the icons i in ur code i think u have used some special characters * *imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* *mc.image(image=imagePath)* -- 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 python_inside_maya+unsubscr...@googlegroups.com javascript:. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0e34b1fe-7332-443c-bb05-662d20ea3892%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Re: Simple program with complicated problem! InternalVar issue?
*I would use python string formatting instead of the + operator.* *Try something like:* *imagePath=%sicons/staircon.jpg%**mc.internalVar(userPrefDir=True)* *instead of:imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* *More info:* *http://www.diveintopython.net/native_data_types/formatting_strings.html http://www.diveintopython.net/native_data_types/formatting_strings.html* On Mon, Aug 10, 2015 at 9:13 AM, Kate Sendall kate.alicia.send...@googlemail.com wrote: Are you kidding me? That's it! Thank you so much, haha. I was using an american set keyboard and a small screen. The two obviously don't mix well. Perfect answer. On Sunday, August 9, 2015 at 4:41:43 PM UTC+1, ABHIRAJ KK wrote: *Hi, kate * *check the icons i in ur code i think u have used some special characters * *imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* *mc.image(image=imagePath)* -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAJJjd4JfyQOBkr03Jzzc%3DLpNmWyPBJF6EJ5k-a7PcOqnG4auig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Pyblish By Example
Added a getting started guide to Pyblish, the test-driven content creation framework, that I'd like to share. It includes a Maya-specific example of a basic asset - a rig - along with how it can be published. - http://forums.pyblish.com/t/learning-pyblish-by-example I'm looking for insight on first impressions and whether there are things too easy, too difficult, too quickly explained or too slow and mundane for a technical directory or pipeline developer to follow. Enjoy and let me know what you think! -- *Marcus Ottosson* konstrukt...@gmail.com -- 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 python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCsh6GHa-2gnVkr5qyA2LYTCv%3DpxnZYfUNVL3efhiEqnQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.