Results 1 to 5 of 5

Thread: [Maya][Pymel] Bug with Reference ".lock / .unlock" commands?

  1. #1
    Technical Artist
    Join Date
    Sep 2009
    Posts
    44

    Default [Maya][Pymel] Bug with Reference ".lock / .unlock" commands? [ SOLVED! ]



    Solution!

    reference = pm.createReference(referenceFile)

    referenceNode = pm.referenceQuery(reference, referenceNode=True)

    pRNode = pm.PyNode(referenceNode)

    reference.unload()
    pRNode.locked.set(True)
    reference.load()

    __________________________________________________ _________

    Hey All,

    I've encountered an issue thats frustrating me.....

    The .lock() .unlock() commands for references in PyMel dont seem to function. Can anyone else get locking & unlocking of layers working in Pymel?

    Simple reproduction steps:

    1) Open a new scene
    2) Reference a random scene of your choosing
    3) Attempt to lock the reference

    newRef = pm.system.createReference('PATHTOSCENE')
    newRef.lock()

    You will notice that you can .load() / .unload() references in the same manner and they work fine, it's just lock / unlock that seem to fall down

    I've tried locking / unlocking the reference by setting the ".locked" attribute as well but with the same results, the command executes without error but to no result.

    If anyone can reproduce this issue without a solution then I'll just have to resort to using maya.cmds for this part of my tool.......

    Thanks in advance!

    Cheers

    ~ Joe :-)
    Last edited by PirateJoe; 06-05-2013 at 01:42 PM.

  2. #2
    Technical Artist
    Join Date
    Sep 2009
    Posts
    44

    Default

    *edited*

    Interestingly the same behavior occurs when using maya.cmds you can lock the references as you create them but then you cannot lock / unlock them by using cmds.file(reference, edit=True, locked=False )
    Last edited by PirateJoe; 07-09-2012 at 09:42 AM.

  3. #3
    Co-Founder Rigging Dojo bclark's Avatar
    Join Date
    Jul 2008
    Location
    Austin
    Posts
    527

    Default

    It might help to know what Maya version?

  4. #4
    Technical Artist
    Join Date
    Sep 2009
    Posts
    44

    Default

    Quote Originally Posted by bclark View Post
    It might help to know what Maya version?
    Fair point :-)

    Maya 2011.

  5. #5
    Technical Artist
    Join Date
    Sep 2009
    Posts
    44

    Default

    So over a year & a job change later - i encounter the same problem, then find my own thread on it.

    Thankfully this time I've found a solution that I've edited into the original post :-)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •