Setting morph on a V4 body part

desleadeslea Posts: 27

Another question!

I have had success in setting up a morph on V4 body with -

var oNodeToMorph = Scene.getPrimarySelection( );
// var oNodeToMorph = Scene.getSelectedNode( 0 ); also works
var oObjToMorph = oNodeToMorph.getObject(  );
CreateMorph = new DzMorph(  );
// snipped deltas, setName and other customisations that all work fine
oObjToMorph.addModifier( CreateMorph );

Now I would like to make PBMs. So let's say I want to make one on the hip.

I've tried findBone, findNodeChild, findPropertyByLabel, etc but have had no luck selecting anything that is recognised as an object for the purposes of addModifier.

Can anyone help?

Many thanks!

Post edited by deslea on

Comments

  • Richard HaseltineRichard Haseltine Posts: 96,968
    edited December 1969

    Remember that in DS4 geometry belongs to the root node, so the modifier has to go there. You can of course put the controller on a body part.

  • desleadeslea Posts: 27
    edited August 2014

    Remember that in DS4 geometry belongs to the root node, so the modifier has to go there. You can of course put the controller on a body part.

    Thanks for the reply, Richard!

    *scratches head* I thought that originally, but I put a few deltas on the body controller and although it executed fine, it didn't seem to do anything. So I thought I must have to do PBMs since it was V4. So it sounds like the delta assignment is the part that doesn't work, then. *will experiment*

    Does that mean any scripted morph will need to have a Daz 4 and a Daz 3 version if I want it to be Daz 3 compatible? (I'm not sure I care about version 3 compatibility though - are there any stats on how many people still actually use it?)

    Post edited by deslea on
  • desleadeslea Posts: 27
    edited August 2014

    EDIT: I have found a solution - update at the end!

    Remember that in DS4 geometry belongs to the root node, so the modifier has to go there. You can of course put the controller on a body part.

    Hi Richard

    I've been grappling with this for a fortnight and still can't figure it out. I'm sorry to be clueless.

    The deltas I have are built on V4 PBMs (from both Daz and Poser - I've tried it both ways). So I have deltas for the hip referencing vertex 221, and the thigh referencing vertex 221, and so on (ie, the way you would use them injected into an existing set of ERC-linked channels in a PZ2).

    So presumably as soon as I add them they'll overwrite each other and/or act somewhere on V4 other than intended. If all deltas go on the root in Daz 4, then I assume she doesn't actually have multiple vertex 221s and some sort of conversion goes on in between the PBM structure and the Daz 4 structure. I don't have a single set of deltas with unique vertex IDs for every delta to add, and I can't figure out how to get one.

    I also tried making ERC links to receive the deltas, but as far as I can tell, you can only use DzMorphDeltas with morphs, not ERC links. So I don't know what that would actually achieve or even what the function of an ERC link is in scripting, if all the deltas are supposed to go onto the root.

    I'm obviously missing a concept here. Can you help me connect the dots?

    What I actually want to do is as follows:

    //Insert pseudocode
    
    function ConfirmSelection(){
      // WORKS
      // checks an object is selected, and asks the user to confirm they have selected a V4 figure
      // returns 1 if the user has selected an object and confirmed it's the right one, this triggers the rest of the functions.
      }
    
    function CreateMorph(mName, mLabel, etc etc){
     // WORKS
     // uses DzMorph to create a morph dial on Body with a label, path, min, max, hidden setting, limits
      }
    
    function ???(){
      // function to do whatever I need to do to make CreateMorph() actually accept and use the deltas I have, 
      // which are based on a master dial on Body and PBM dials on hip, abdomen, etc. I don't know whether 
      // this means doing something with DzERCLink or something else.
      // Alternatively would appreciate guidance on how I can convert the PBM-style deltas I have now into 
      // something D4-friendly that could be added straight onto the dials made in CreateMorph()
      }
    
    function InjDeltas(mName, mVert, mX, mY, mZ){
     // function to add each line of deltas, once I figure out which deltas to add and where. Haven't gotten to this yet.
     } 


    UPDATE

    So, I figured it out. As we were meandering around to above, the process is as follows:

    1. Create the morph on Body with DzMorph()
    2. Add whole-figure deltas with DzMorphDeltas() - don't try to force it into the Poser-eque ERC/PBM structure.

    I got the whole-figure deltas by writing a script (outside Daz, because TBH I really don't like QTScript much - I did it in PHP) to compare a base V4 OBJ with an OBJ with the original PBM/ERC-based morph applied. It automated a fair bit of the scripting as well.

    So...we're there!

    There were a few things I had to give up on - I couldn't figure out a way to use functions for the deltas that was any more efficient than the line-by-line addDeltas() generated by the PHP script. QTScript doesn't seem very array-friendly. I also had to give up on the colours - I got a fair bit of the way there but just couldn't justify the effort anymore. But the blasted thing does, at least, work.

    Thanks so much for all your help, Richard, much appreciated.

    Many thanks
    Deslea

    Post edited by deslea on
Sign In or Register to comment.