Jump to content

detect hda def changes reliably


eyevex

Recommended Posts

I thought I had stumbled across this at some time via hscript or hython...

 

Basically checking an unlocked HDA  defined node to see of any different since saved last.

 

I would think matchesDefinition() would serve this purpose but seems identical to isLocked()

Proof seems to be getting a py ref to a hda defined node, test... True, then unlock -- no other changes... test... False.

 

I could make some ugly use of modification stamp ... but this has its own issues ...

I unlocked, RMB save is always enabled even before any modification is made.

If saved anyway stamp is updated...

 

Thoughts?

 

[eyevex] (|;-D>

Link to comment
Share on other sites

The only idea I currently have that would seem reliable....

 

extract definition contents, parse contents section and compare the node graph against it.

 

This would be a bit more time than I have to gain this functionality right now and would have to assume something exosts that could get me closer as a starting point....

ir not?

 

(|;-D>

Link to comment
Share on other sites

You could try the new 'otldiff' command-line tool in Houdini 15

 

$ otldiff
otldiff: Wrong number of OTL paths specified.
otldiff 1/infinity

Description:
  Visually compare the contents of two OTLs. Similar to 'svn diff'.

Usage:
   otldiff [options] file.otl
   otldiff [options] fileA.otl fileB.otl

Options:
     -h,     --help          Print this message
     -r,     --revision      Specify revision(s) to compare.

Examples:

  Compare two OTLs:
     otldiff oldfile.otl newfile.otl

  Compare current with a previous revision:
     otldiff -r 12345 current.otl

  Compare two distinct revisions:
     otldiff -r 1234:6789 file.otl
Link to comment
Share on other sites

I'm not sure that'll work in this case. Although I was unaware and that is super useful to know …

Although it does have some possibilities but they could get ugly.. and involve a lot of definition swapping.

 

I wrote the subject  line quickly...

 

# More accurately …. lets say ….

my_node = hou.node('/some/meaningful/oppath')

my_nodes_def = my_node.type().definition()

 

# Now we edit the contents ….

my_node.allowEditingOfContents()

 

#…. Now in the net pane you can save. This would change the def and stamp ala ...

my_nodes_def.modificationTime()

# as well as potentially some other user oriented data

 

 

# these will always return the same values

 

my_node.isLocked()

my_node.matchesCurrentDefinition()

 

 

# ….. So in terms of both representation and functionality and preferably without custom parsing the contents of the different sections of …

 

my_nodes_def.sections()

 

# … and attempting to compare it to the current node graph and parameter interface, script section etc .. know if the unlocked my_node has actually changed (beyond time stamp and user etc .. that goes with saving when no changes have happened) from how it is described by my_nodes_def

 

...I spouse more options for saving and update from node mechanism would solve this too where there was a force option or wouldn't save when there were no changes… but am trying to do something that I can work with now.

 

 

Hopefully the problems a little clearer.

 

(|:-D>

Link to comment
Share on other sites

according to help hou.Node.matchesCurrentDefinition() should be doing that
as it says:

Return whether the contents of the node match its type definition. A locked digital asset instance will always match its definition, but an unlocked one may not.

so if it's not doing that maybe report a bug

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...