Jump to content
Sign in to follow this  
gemini

Locked Hip or Hip Clear Event working really Before Scene Clear

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×