Having trouble with DzFacetMesh.addPolyline() [PARTLY SOLVED]
I posted a thread with an attached Add_Structure.dsa script showing how to add a Polyline dForce Add-On Modifier using just DAZ Script. It works, but uses an intermediate .obj file - which should not be necessary.
If you execute that script while holding down the Alt key, then instead of creating and importing an.obj file, the script uses DzFacetMesh::addPolyline() to create the Add-On (coloring it orange instead of white, so you can tell the difference) - but I cannot get this to work correctly, so I've started this separate thread to ask for help:
It all works OK, except that when DzAddDForceModifierDynamicSurfaceAddOnAction is done on the resulting structure, it adds the "Simulation" section to the Add-On Node's "General" section in the Parameters Pane, but it does not add the "Simulation" section for the Add-On Node in the Surfaces Pane, so Simulation does not work with it.
And doing this manually makes no difference: Edit > Object > Geometry > Add dForce Modifier: Dynamic Surface Add-On.
It seems that there is something in the way the Add-On is being generated in function local_BuildStructureDirectly() that prevents DzAddDForceModifierDynamicSurfaceAddOnAction from working correctly with its output. Perhaps some things need to be done in a different order? I've tried changing things around, with no success.
The function local_BuildStructureDirectly() uses code from these DAZ Samples (Thanks again Rob!) (of course, they work correctly):
- http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_plane/start
- http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_polyline_dynamic_surface_addon/start
For convenience, I've attached to this post the same files as the other thread: Add_Structure.dsa and Bouncing_Ball_01b.duf
Any help or suggestions will be much appeciated.
P.
Comments
Be sure you are referencing the most recent version of the Generate Polyline Dynamic Surface AddOn script sample. I made a change to it several weeks (months?) ago to address the issue described.
-Rob
Many thanks for your quick response Rob - I'll check it out and (hopefully) tag this thead as "Solved" today.
P.
I incorporated Rob's changes into my script - the updated version is attached to this post as Add_Structure_v2.dsa
The changes per Rob's update are marked in it by \\\Mod_2019-01-19a, and they result in the dForce Simulation now working as desired. Thank you Rob!
However, it still does not add the "Simulation" section for oAddOnNode in the Surfaces Pane - so I'm still hoping for help in this respect.
P.
I'm not in a position to look at your script right now, but this sounds like it could be an order of operations issue with regard to when UVs are created/initialized vs when editing of the mesh begins. I know that may seem an odd relation... until you consider that UV space is a valid space for various calculations to take place in. I'll also point out that I updated the primitive generation script samples not long ago to address a similar issue with them.
-Rob
Thanks for another quick response. I'll check thru the current primitive generation samples for "order of operations" differences with my script, and report back.
P.
Okay... I've checked the current primitive generation samples, and also tried changing the order of things around some more, and the problem persists, as demonstrated by the attached minimalist test.dsa: Create e.g. a primitive Cube, select it, and execute test.dsa:
It creates a structure via DzFacetMesh::addPolyline() OK, but any attempt to add a dForce Dymamic Surface add-On Modifier to the structure (whether by the Menu option or by programmatically by DzAddDForceModifierDynamicSurfaceAddOnAction) adds a "Simulation" item only in the Parameters Pane "General" section, and not in the Surface Pane.
But a structure Imported from a .obj file does not have this problem.
Any ideas?...
P.