1. Why do you have local __version__ variables in a bunch of your methods that
serve no purpose?
2. line 33 is not correct. When you split with os.path.splitexit, the
extension will retain its leading period character. But you are joining it back
again with a period, producing duplicate period characters. That entire method
could be simplified to:
def clean_seperator(self, name):
name, ext = os.path.splitext(name)
name = re.sub(r'[^a-zA-Z0-9]+', self.seperator, name).strip()
return ''.join([name, ext ])
You do it correctly on line 85 however.
3. It's not pythonic idiom to use list comprehensions for side-effects, as
opposed to using them for the return value. Jessie's example showed it as a
normal for loop, but in Line 46, you use it to loop over the paths and add them
to a list. What is happening is that you are generating a temporary list of
None values for each loop that gets thrown away.
Python 2.7 introduced support for set comprehensions:
mySet = {i for i in xrange(10)}
In Python 2.6, you can accomplish this by passing a generator to a set()
constructor:
mySet = set(i for i in xrange(10))
4. Line 97: Did you find a need to use a windows-specific ctypes call for
creating your hard link, as opposed to the platform independent os.link() ?
On May 25, 2013, at 11:49 PM, Ævar Guðmundsson wrote:
> Thanks!
>
> Have updated my little script with my best of knowledge based off the tips
> above and further thoughts, code is here:
>
>
> http://pastebin.com/ZEDnCQWM
>
>
> And it does its thing, saves a versioned file into my offline edit
> directory and such, with format options but for the time being I’ve named it
> as such:
>
>
> C:\Users\aevar\[…]\scenes\backups in here\Maya to Unity live anim curve link
> v042.mb
>
>
> Now, to keep track of what is what and what I was doing at the time I added
> a promptDialog that writes out my notes into maya.cmds.fileInfo and scenes I
> open have my notes embedded into it. Fair enough but my issue at hand is I’m
> not a fan of popups and wish to simply type in my comment into the command
> window in the left bottom corner below the time slider. Basically just
> capture the text from there if the field starts with a + symbol.
>
> I know I can find this by querying the main window and dig for it from
> there, but my problem is I don’t know what the field itself is called :)
>
> Anyone have any ideas on how to do that?
>
> Comments and thoughts on the actual script of course welcome as well, the
> only notable thing that didn’t work as well as I’d hoped was the fact the
> save process is near instant on a small scene and it retains the current
> scene name, so I added a headsUpmessage to indicate a backup actually took
> place but am still getting to grips with how to handle the new style message
> windows in Maya 2014 (the ones that pop up the first time I open it and press
> 3,4,5 and so forth), they look a lot “cleaner” than the default
> headsUpMessage and appear to support multiple lines….
>
>
> --
> 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.