script not finding the model in the scene

Hey Fellow Daz entousiast !

i'm following the tutorial here (https://www.deviantart.com/3dstrobist/journal/Transfering-Mixamo-Animations-to-Daz-Genesis-8-1-906594358) to import mixamo animation into Daz and apply it to a G8 model, but when I try to execute the script from this tutorial to fix the messed up rotation, i get this error:

TypeError: Result of expression 't2' [null] is not an object.
Stack Trace: ()@F:/daz2unity/g8mixamo fix.dsa:11
Error executing script on line: 11
Script executed in 0 secs 7 msecs.

it seems that the script is not able to grab t2 (the genesis 2 model)

here is the script if you dont need to go through the tutorial:

<span style="color:inherit"><em>function transferY(a,b){</em></span>

<span style="color:inherit"><em>var t8,t2;</em></span>

<span style="color:inherit"><em>t8=Scene.findNodeByLabel(a);</em></span>

<span style="color:inherit"><em>t2=Scene.findNodeByLabel(b);</em></span>

<span style="color:inherit"><em>var valr=t2.getYRotControl().getValue ();</em></span>

<span style="color:inherit"><em>t8.getYRotControl ().setValue (valr); </em></span>

<span style="color:inherit"><em>}</em></span>

<span style="color:inherit"><em>function transferX(a,b){</em></span>

<span style="color:inherit"><em>var t8,t2;</em></span>

<span style="color:inherit"><em>t8=Scene.findNodeByLabel(a);</em></span>

<span style="color:inherit"><em>t2=Scene.findNodeByLabel(b);</em></span>

<span style="color:inherit"><em>var valr=t2.getXRotControl().getValue ();</em></span>

<span style="color:inherit"><em>print (valr);</em></span>

<span style="color:inherit"><em>t8.getXRotControl ().setValue (valr); </em></span>

<span style="color:inherit"><em>}</em></span>

<span style="color:inherit"><em>var nframes=Scene.getAnimRange().getDuration ().valueOf()/Scene.getTimeStep().valueOf();</em></span>

<span style="color:inherit"><em>for( var fr = 0; fr &lt;= nframes; fr+=1 ){</em></span>

<span style="color:inherit"><em>Scene.setFrame( fr );</em></span>

<span style="color:inherit"><em>transferY(&quot;Left Thigh Twist&quot;,&quot;lThigh&quot;);</em></span>

<span style="color:inherit"><em>transferY(&quot;Right Thigh Twist&quot;,&quot;rThigh&quot;);</em></span>

<span style="color:inherit"><em>transferX(&quot;Right Shoulder Twist&quot;,&quot;rShldr&quot;);</em></span>

<span style="color:inherit"><em>transferX(&quot;Left Shoulder Twist&quot;,&quot;lShldr&quot;);</em></span>

<span style="color:inherit"><em>transferX(&quot;Left Forearm Twist&quot;,&quot;lForeArm&quot;);</em></span>

<span style="color:inherit"><em>transferX(&quot;Right Forearm Twist&quot;,&quot;rForeArm&quot;);</em></span>

<span style="color:inherit"><em>} </em></span>

thank you in advance for your help!

Comments

  • You need to insert soem error checking, for example make sure that t2.inherits( "DzSkeleton" ) is true before trying to access its members - in this case I think the label you are using is not matching the figure and so t2 is null, which of course fails to find any members. Error checking and, in develppement stage at least, printing notes to the output are always a good idea.

  • ironsnakefeoironsnakefeo Posts: 0
    edited December 2022

    私も同じ問題を抱えていました。
    私は解決策を見つけました。
    スクリプトの問題ではありません。
    3DStorobist のコードは一文字たりとも間違っていません。
    まず、前提として FBX to Mixamo を作成しておく必要があります。
    次に、アニメーションを Genesis2 から Genesis8 に転送できます。
    ここからが本題です。
    みなさん、共同編集に切り替えてスクリプトを適用していますか?
    これは私たち全員が陥る罠です。
    ほとんどの人はそれをユニバーサルにしてスクリプト化します。
    共同エディターでスクリプトを実行してみましょう。

    (Edited by mod to add translation)

    i had the same problem. i found a solution. It's not a script issue. 3DStorobist's code is not a single letter wrong. First, you need to create FBX to Mixamo as a prerequisite. Then you can transfer the animation from Genesis2 to Genesis8. Here is the main issue. Have you all switched to co-authoring and applied scripts? This is a trap we all fall into. Most people make it universal and script it. Let's run the script in co-editor.

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