Jump to content

Locked Hip or Hip Clear Event working really Before Scene Clear


gemini

Recommended Posts

Hi,

I would simply ceate a script which creates  lock file when a hip is opened for the reason more users should not overwrite their scenes.

The lock file should be deleted when a new hip is about to open. So i created a hip event in my scene and check which event is fired (i check the opening hip name).

My problem is that I can not fire an event before the new hip is opened ( to clear the lock file ) the event always shows the opened hip not the hip which is being closed.

Any idea ?

thx!!! G

 

My scripts:

---Registering the event-----

hipFileEvent_script = """
def hipFileEventsFired(  event_type):
    import houdini.illessz.events as ev
    reload( ev)
    ev.hipFileEvents( event_type)
"""
hou.setSessionModuleSource( hipFileEvent_script )
hou.hipFile.addEventCallback( hou.session.hipFileEventsFired)

 

---- The event ----

def hipFileEvents( event_type):
    # print kwargs
    if event_type == hou.hipFileEventType.BeforeClear:
        if not hou.hipFile.isLoadingHipFile() and not hou.hipFile.name()=='untitled.hip':
            print 'clear event %s' % hou.hipFile.name()
        else:
            # print 'clear ?'
            pass
    print event_type, hou.hipFile.name()
    if event_type == hou.hipFileEventType.BeforeLoad:
        print 'before load event %s' % hou.hipFile.name()
        # hou.hipFile.removeEventCallback( hou.session.hipFileEventsFired)

 

OUTPUTS:

hipFileEventType.BeforeLoad X:/temp/saveTest.hip
before load event X:/temp/saveTest.hip
hipFileEventType.BeforeClear X:/temp/saveTest.hip
hipFileEventType.AfterClear X:/temp/saveTest.hip
hipFileEventType.AfterLoad X:/temp/saveTest.hip


hipFileEventType.BeforeLoad X:/temp/saveTestB.hip
before load event X:/temp/saveTestB.hip
hipFileEventType.BeforeClear X:/temp/saveTestB.hip
hipData deleted X:/temp/saveTestB.hip
hipFileEventType.AfterClear X:/temp/saveTestB.hip
hipFileEventType.AfterLoad X:/temp/saveTestB.hip

Edited by gemini
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...