Delete Bone

ironcheeseironcheese Posts: 72

Hello,
I am trying to write a script to replicate the JointEditor side bar command ToolSetting>(rightclick)>Delete>Delete Bone.
I need a script since said command only works on one single bone even if I select multiple bones and even if I try to delete the upper parent (ie upper parent is deleted, but all children bones are still there)

I cameup with this, which executes fine (ie the selected bone is indeed removed), but when I switch from ScriptIDE to Viewport or when I try to re-export the FBX, DS crashes:

var startNode = Scene.getPrimarySelection() ;
if ( startNode ) {
Scene.removeNode(startNode);
}

I also tried replacing getPrimarySelection() with getSelectedNode(0), but nothing changes much
 

Any suggestions?
Thank you
 

Post edited by ironcheese on

Comments

  • I would suspect you need to do a lot more cleanup, removing the bone from the hierarchy and possibly zeroing its weight influences, before you can delete the node. Deleting without the cleanup is probably leaving sundry unresolved links.

  • ironcheeseironcheese Posts: 72
    edited December 2016

    well, the command ToolSetting>(rightclick)>Delete>Delete Bone works just fine
    (I mean it correctly removes the bones that I am trying to remove like, for example, the face rig bones of the FBX version of G3M).
    So what I am trying to script is just the command "ToolSetting>(rightclick)>Delete>Delete Bone",
    I wish we had a "record macro" function like in MS Office

     

    Post edited by ironcheese on
  • DAZ_JoshDAZ_Josh Posts: 1,367

    What I would do is iterate through all the bones and use the Action samples to call the delete bone action on each one. Then you can let DS do the thinking for you on whatever cleanup needs to happen.

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_find_classname/start

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_trigger/start

  • Hello,
    I am trying to write a script to replicate the JointEditor side bar command ToolSetting>(rightclick)>Delete>Delete Bone.
    I need a script since said command only works on one single bone even if I select multiple bones and even if I try to delete the upper parent (ie upper parent is deleted, but all children bones are still there)

    I cameup with this, which executes fine (ie the selected bone is indeed removed), but when I switch from ScriptIDE to Viewport or when I try to re-export the FBX, DS crashes:

    var startNode = Scene.getPrimarySelection() ;
    if ( startNode ) {
    Scene.removeNode(startNode);
    }

    I also tried replacing getPrimarySelection() with getSelectedNode(0), but nothing changes much
     

    Any suggestions?
    Thank you
     

     

    Hello,
    I am trying to write a script to replicate the JointEditor side bar command ToolSetting>(rightclick)>Delete>Delete Bone.
    I need a script since said command only works on one single bone even if I select multiple bones and even if I try to delete the upper parent (ie upper parent is deleted, but all children bones are still there)

    I cameup with this, which executes fine (ie the selected bone is indeed removed), but when I switch from ScriptIDE to Viewport or when I try to re-export the FBX, DS crashes:

    var startNode = Scene.getPrimarySelection() ;
    if ( startNode ) {
    Scene.removeNode(startNode);
    }

    I also tried replacing getPrimarySelection() with getSelectedNode(0), but nothing changes much
     

    Any suggestions?
    Thank you
     

    unlink (unparent) anything you want to delete first!

Sign In or Register to comment.