Re: [Maya-Python] 'module' object has no attribute
glad it helped! On Friday, February 23, 2018 at 9:18:07 AM UTC-5, Jason Huang wrote: > > Works like a charm, Zeth. I am able to add, delete, move order of python > paths in a nice little GUI. Awesome! Thanks so much! > > -Jason > > On Wednesday, February 21, 2018 at 12:43:07 PM UTC-8, zeth willie wrote: >> >> Hey Jason- >> >> I've attached a script that I wrote a while back that may be useful for >> stuff like this. Put it in your scripts folder (instructions for executing >> in the header) and it will help manage your python paths (add, remove, >> reorder). The first tab lets you save/load paths for quickly loading common >> paths you use, the second tabs show the item in your python path in order >> and lets you change a few things. Nothing too fancy, but might be helpful >> for seeing what's going on. >> I assume dropping a file here isn't an issue. I'm sure I have it handy >> online (somewhere other than in a big repo on github) if this doesn't work >> >> Zeth >> > -- 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/ec526de2-f016-4e5f-8706-cd28afb9bfc1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] 'module' object has no attribute
Hey Jason- I've attached a script that I wrote a while back that may be useful for stuff like this. Put it in your scripts folder (instructions for executing in the header) and it will help manage your python paths (add, remove, reorder). The first tab lets you save/load paths for quickly loading common paths you use, the second tabs show the item in your python path in order and lets you change a few things. Nothing too fancy, but might be helpful for seeing what's going on. I assume dropping a file here isn't an issue. I'm sure I have it handy online (somewhere other than in a big repo on github) if this doesn't work Zeth -- 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/d8f71a56-2a0a-405c-bd0e-0d127804077f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. #file: zbw_appendPath.py #Author: zeth willie #Contact: zethwil...@gmail.com, www.williework.blogspot.com #Date Modified: 04/27/13 #To Use: type in python window "import zbw_appendPath as zap; zap.appendPath()" #Notes/Descriptions: use to add paths to the python path attribute, which allows you to import scripts from additional locations on your computer/network import sys, os import maya.cmds as cmds import maya.mel as mel from functools import partial widgets = {} def appendUI(): """UI for appendPath script""" #create window with 3 text fields, buttons call up proc to add path if cmds.window("appendPath", exists=True): cmds.deleteUI("appendPath") widgets["win"] = cmds.window("appendPath", t="zbw_appendPath", w=500, h=5, s=False, rtf=True) #create some menus for saving and loading cmds.setParent(widgets["win"]) widgets["menu"] = cmds.menuBarLayout() widgets["menuFile"] = cmds.menu(label="file") cmds.menuItem(l='Clear Values', c=clearValues) cmds.menuItem(l="Save Add Paths", c=saveValues) cmds.menuItem(l="Load Add Paths", c=loadValues) widgets["tabLO"] = cmds.tabLayout(h=210) widgets["columnLO"] = cmds.columnLayout("Add Paths", w=500) widgets["path1"] = cmds.textFieldButtonGrp(l="path1", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 1)) widgets["path2"] = cmds.textFieldButtonGrp(l="path2", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 2)) widgets["path3"] = cmds.textFieldButtonGrp(l="path3", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 3)) widgets["melCBG"] = cmds.checkBoxGrp(ncb=1, l1="also add to mel path (MAYA_SCRIPT_PATH)", v1=1, cal=[(1, "left"), (2, "left")], cw = [(1, 100), (2,25)]) cmds.separator(h=10, st="single") widgets["buttonRCL"] = cmds.rowColumnLayout(nc=3, w=500, cw=[(1,123),(2,247 ),(3,123)]) widgets["addCloseBut"] = cmds.button(l="Add and Close", w=120, h=30, bgc=(.6, .8, .6), c=applyClose) widgets["addBut"] = cmds.button(l="Add Paths!", w=245, h=30, bgc=(.8, .8, .6), c=apply) widgets["closeBut"] = cmds.button(l="Close", w=120, h=30, bgc=(.8,.6,.6), c=close) cmds.setParent(widgets["columnLO"]) cmds.separator(h=5, style="single") cmds.text("Click the '<<<' buttons to browse for paths to add. Click the 'Add' button to add those \npaths to the 'sys.path' list. Use the 'ViewPath' tab to view current list of paths.", al="center") cmds.text("Use 'file->save' to save the selected paths. Use 'file->load' to load previously saved paths") #back to window cmds.setParent(widgets["tabLO"]) widgets["columnLO2"] = cmds.columnLayout("View Paths", w=500) cmds.text("Double-click to display full path in script editor") widgets["listTSL"] = cmds.textScrollList(w=500, h=120, fn="smallPlainLabelFont", append=["click button below",
Re: [Maya-Python] Creating a curve-based wireframe
Sorry for a second post, but also wanted to mention that I've used the Houdini Asset system in Maya for things like this with some success (I wasn't doing the Houdini bits on those jobs). So you can make pretty complicated actions automated with variable inputs. . . On Friday, June 2, 2017 at 3:58:24 PM UTC-4, zeth willie wrote: > > Just as an aside, since I know this a python for maya group and don't want > to derail this into some kind of flame war, but stuff like this is > ridiculously easy in Houdini as compared to Maya. Don't know if you're > there yet, but at some point, it just becomes easier to say "f*** it" and > bite the bullet for certain things and do them in another app. There's a > free version, I believe, and the learning curve isn't too bad for > relatively simple things like making procedure geo/curves and spitting them > out as objs to use in Maya. Check out these guys for some interesting > recipes and walkthroughs of stuff that I can't picture doing reasonably in > Maya. Entagma: https://vimeo.com/174958114 (I can't remember if this > specific video has exactly what you need, but it's in the neighborhood, I > believe). > > -- 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/4473c8a5-c0f8-4b2a-b3a2-4bf365f0e5b8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Creating a curve-based wireframe
Just as an aside, since I know this a python for maya group and don't want to derail this into some kind of flame war, but stuff like this is ridiculously easy in Houdini as compared to Maya. Don't know if you're there yet, but at some point, it just becomes easier to say "f*** it" and bite the bullet for certain things and do them in another app. There's a free version, I believe, and the learning curve isn't too bad for relatively simple things like making procedure geo/curves and spitting them out as objs to use in Maya. Check out these guys for some interesting recipes and walkthroughs of stuff that I can't picture doing reasonably in Maya. Entagma: https://vimeo.com/174958114 (I can't remember if this specific video has exactly what you need, but it's in the neighborhood, I believe). -- 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/9f65595e-0dce-4bb2-9d07-8e06a58ca68a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: how many lines per function
I actually made a video about refactoring python for maya basics a little while ago where I talk about some of that exact stuff! Never got around to uploading it, I'll do that soon, maybe there will be something helpful in it (depending on your coding prowess). To echo Marcus, it's hard to be really specific, but once you have a little bit of an eye for it, it can become more clear what the threshold is for extracting stuff. The example I think I used was: say you're codifying your day and you have a function called "waking up". It may seem totally reasonable to put all the steps for making and drinking coffee in that "waking up" function. Related process and you do it almost every morning. But what happens if you want to make a cup of coffee after dinner? It's not "wrong" to include coffee-making in the wake-up function, but it can be objectively better to extract it into its own function so that you can use it later in a different way or in a different script. Turns out it's easier to inspect, test and revise later also. I LOVE Marco's work, his tutorials and all that are awesome. So I don't want to sound like I'm contradicting what he did. But it's also often the case that when writing something, one can't be bothered to break everything up into the most perfectly efficient chunks. That's why there's a word for refactoring:) Sometimes you have to see how things work in the wild and how other might use it. Overthinking this stuff can lead to wasting time by designing for use-cases that never happen. . . again, that's why we refactor. In the case you mention, it might be worth looking into ways to dissect the comparison and filtering process, maybe the traversal process too. Loads of levels of indents, etc can indicate that maybe you're trying to do too much in one method or function and some of that sorting can be broken out. Hope that helps! -- 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/1417521d-dd46-4e64-8e76-2067062818b6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] Re: triple switch node
I recently did a bunch of stuff scripting stuff into triple switches and it's tricky largely bc of the area Andres is talking about. If all you're doing is setting it up once, it's probably fine and not too hard, but all of those index numbers start to get a little harder to manage if you're accessing/changing it later via scripts bc you'll have to clean some stuff up yourself. You can end up with the same thing going into multiple indexes, empty indexes that become confusing in terms of the numbering (bc you'll have to line up the inTriple with the same index), indexes with something in the triple, but nothing in the input shape, etc. Not a deal breaker, but more confusing than most simple hook ups. Writing a separate function that just cleans up the triple switch (or any given entry) might be helpful. HTH. Z -- 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/e43f9b77-8bff-4dc8-9199-6e2c9ff02af8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Maya-Python] Getting the original shader assignment
I would look at message attributes. i.e. create a message attribute somewhere on the rig (top level?) and plug the "message" attr of the shader or shading group into that. Then it's persistent across maya sessions,etc. Should be pretty easy to add to your script, too. #create and connect message attr cmds.addAttr(YOUR_RIG_OBJ, at="message", ln="origShader") cmds.connectAttr("{0}.message".format(YOUR_SHDR), "{0}.origShader".format(YOUR_RIG_OBJ)) # getting object back from the message attr is bit weird, maybe there's an easier way? I'm getting the attr then getting the object from that orig = cmds.connectionInfo("{0}.origShader".format(YOUR_RIG_OBJ), sfd=True).partition(".")[0] Z -- 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/ea9581ec-f36c-4089-b99b-5e933b58e32c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Maya-Python] How can I change a curve's display color when it is used as a controller?
I wrote a little thing a while back called "zbw_attributes" that should do most of what you want (http://www.williework.blogspot.com/p/downloads.html). I think the problem is the color change is happeing on the shape node, not the transform (shape node is typically a better way to do things). Feel free to either use the script or use some of the code from it. Z -- 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 post to this group, send email to python_inside_maya@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Maya-Python] Re: UI questions
Jeremy Ernst has a series of videos on vimeo about maya ui stuff. They're very good. They start here: https://vimeo.com/42848594 -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe