Reforce / Renew a script in Houdini and make nodes time dependent

   4780   11   0
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
Heyho Guys,
first topic in this community, i asked the same question in odforce but nobody gave me an answer in a week.

So I'm implementing a extern solver framework in Houdini via Python.
The solver itself is packed as a SOP HDA, all attirubtes set and the actual simulation happens inside the HDA in another SOP HDA. The solver gets a geometries points, instances them, resolves them and sets the points new, so thats what happens mainly inside the HDA.

So i got two problems:

1. How can I renew a Script? The actual solvers simulation happens in the code area of the HDA inside. For that the code area gets an instance solver from the python module from the hda.
That means if I want to change or renew the solver I have to dive inside the node and accept it in the properties window, so it resets the solver.

Same goes for my node which instances the points of the geometry i want to simulate (the node is the actual input for the solver). If I want to load another geometry, i have to plug in the new geometry, have to dive inside the import Node and accept it (like the solver node), so the script resets and gets the new points.


2. At the moment I set a node time dependent like that:
hou.setFrame(hou.frame())
but I have the feeling it slows the actual simulation and isnt nice to read.

I hope you have some answers and that my german english is understandable

Thank you!
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
Smack my butt and call me Betty, is this Thread too basic or too hard?
User Avatar
Member
280 posts
Joined:
Offline
maybe if you supply us with a scene file? we can understand what u r trying todo…
User Avatar
Member
7710 posts
Joined: July 2005
Online
patar
we can understand what u r trying todo…

Yeah, I don't get the question either. If questions themselves are not clear, then it's probably going to be skipped over.

TobiasVanSautter
Smack my butt and call me Betty, is this Thread too basic or too hard?

All I understood from your question was keywords like “solver” and “time dependent”. So based on that, I say use the Solver SOP. http://www.tokeru.com/cgwiki/index.php?title=The_solver_sop [tokeru.com]
Edited by edward - Aug. 31, 2016 23:32:33
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
I cant upload a scene, because this is a custom solver from my university..

The Solver Stuff doesnt really matter at the moment. The things that matters are my two questions:

- How can I reset a script

( with python or without having to go in the properties and accept them to force reset the script)


- How can i set a Node time dependent

( with Python or whatever )


I work in a SOP Network (Geometry Level)




EDIT:
So I just made a HDA just for you guys:



My custom solver start ist like that, I plug in a geo i want to simulate. So the points of the input mesh get instanced.

But if they're instanced one time, you just cant change them anymore. Even if you plug in another geo.
So you have to fix it by messing up the script (kinda force reset it), and refix it.

I want to do that nicely, not like that. It should be a plugin, not some fucked up workflow thingy^^
One difference: I dont use a python sop, i use a Geometrie Operator for the import, so i can use the Python Module in there too.

Hope you understand it better now

Edited by TobiasVanSautter - Sept. 1, 2016 10:56:12

Attachments:
forsidefx_geoimport.hdanc (37.9 KB)

User Avatar
Member
280 posts
Joined:
Offline
I guess its just a matter of accessing the right node

Attachments:
modified.hipnc (1.3 MB)

User Avatar
Member
182 posts
Joined: April 2009
Offline
TobiasVanSautter
I
My custom solver start ist like that, I plug in a geo i want to simulate, so the points of the mesh get instanced.
But if they're instanced one time, you just can change it by messing up the script, fixing it so you kinda force reset it.

I want to do that nicely, not like that. It should be a plugin, not some fucked up workflow thingy^^
One difference: I dont use a python sop, i use a Geometrie Operator for the import, so i can use the Python Module in there too.

Hope you understand it better now


Using a solver SOP is not a
fucked up workflow thingy
It's actually the proper way to do it, if you want to be dependent on the previous frame. If I understand you correctly then you want to do everything in python ? Be aware that Python is single threaded and unless you use some extra modules like numpy or scipy it's very slow when it comes to processing large amounts of data. You'd also need a way to store data from the previous frame to use it. So why all the trouble just to avoid a solver sop ? Hell if you really want to use python, then simply put a python sop inside a solver sop.
Edited by blackpixel - Sept. 1, 2016 11:20:56
User Avatar
Member
280 posts
Joined:
Offline
yes but from the sample scene that he provide he's only setting it to the current frame so no need for sop solver.I was gonna suggest sop solver but it turned out it doesnt need one…
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
Puh where to start.
I'm writing my Bachelor Thesis about Integrating and already working C++ SPH Fluid Solver in Houdini. The Solver itself works external and is written by one of the guys here.

So I “just” need to feed this solver the information he needs. That I'm doing via Python and HDA's in Houdini.
The solver itself works okay right now, I just need to fix some issues, that the HDA Plugin can work properly.

One of the problems is (like written 3 times before):

- I need to reset the scripts externally (best with some button or something that i can integrate in the Plug-In HDA GUI).

Because I define the Solver 1 Time at the start. If i want to reset the simulation, i have to “re-define” the Solver. That I'm doing at the moment with opening the HDA properties and accept them. (Like a force re-read of the script).

Thats shitty, i dont want people to open the HDA and have such a workflow. They just should plug in a geo (in Szene Level), change some parameters and let it simulate.


My english and writing style is pretty shitty too, i know. Best to read it slowly

Edited by TobiasVanSautter - Sept. 1, 2016 11:40:08
User Avatar
Member
280 posts
Joined:
Offline
its a black box that only you can answer and solve… without the DA it self its kinda guessing of what it does. much less solving your problem..just trying to help…

sugestion: instead of making a 1 giant solver outside houdini why not break them to parts and build your custom micro solvers. do it like SESI this way its easily customizable without the need to customized the c++.
again just an idea.

best regards
Patar
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
Okay guys I got it.. I made a new function in the Python Module:
force = True
def forceRead():
   hou.Node.cook(hou.pwd(), force, (hou.frame(),hou.frame()))

and execute it via a Buttoncallback. It just cooks the frame at the moment, so it has to read the script again… It works with the import Operator, now i just need to try it with my Solver Operator

))


Edit Patar:
Thank you for the answers, the thing is it works at the moment, but that would be an enormous workload.
I have to finish in 2 Weeks, so no more testing ;(
Edited by TobiasVanSautter - Sept. 1, 2016 12:06:09
User Avatar
Member
6 posts
Joined: Aug. 2016
Offline
Okay it works with the Import Only, but it still references the same Solver Variable as before, so id doesnt work with the solver Operator..


How can I change / reset a global Variable inside a Module (HDA Module)?


At the moment i reference a solver variable in the code area (of the HDA) like this:

solver = hou.phm().iisolver


In the Module the iisolver is defined like this:

iisolver = SphSolver(fps)




How can I create a methode i can trigger by a button, that resets the iisolver or makes a new iisolver??

Thank you for your help!
  • Quick Links