The changes I made and was talking about were to different scripts that are not chained together.
Again, I am not so sure that your are entirely correct.
I believe that you setup this SetTreminationFlag at the beginning of a block of if statements with a return
Code: Select all
// check if new object selection has been made and if it is object with matrix
currentSelected = Node.FirstSelected();
if ((lastSelected == currentSelected) || (currentSelected == "") || !Node.ConExists(currentSelected, 'ObjMatrix'))
{
params.SetTerminationFlag();
return; //-->
}
// check replacement object
if (replacName == "") {
System.Alert("No replacement object selected !");
return; //-->
}
if (!Node.Exists(replacName)) {
System.Alert("Invalid replacement object selected !");
return; //-->
}
if (!Node.ConExists(replacName, 'ObjMatrix')) {
System.Alert("Replacement object does't have transform matrix attribute!");
return; //-->
}
If any of the if statements are incorrect then the script stops here.
If correct then from here you can process any of the above attributes.
Code: Select all
// get target matrix
matrixT = Node.Value(currentSelected, 'ObjMatrix')
// get replacement matrix
matrixR = Node.Value(replacName, 'ObjMatrix')
// copy object
pureCurrName = Node.ShortName(currentSelected);
Node.Delete(currentSelected);
newName = Node.Copy(replacName, Space.CurrentScene());
Node.Rename(newName, pureCurrName);
// update target matrix
if (!keepOrient)
{
matrixT.SetRoll(matrixR.GetRoll());
matrixT.SetYaw(matrixR.GetYaw());
matrixT.SetPitch(matrixR.GetPitch());
}
if (!keepScale)
{
matrixT.SetScaleX(matrixR.GetScaleX());
matrixT.SetScaleY(matrixR.GetScaleY());
matrixT.SetScaleZ(matrixR.GetScaleZ());
}
Node.Value(currentSelected, 'Matrix') = matrixT;
params.Param("lastSelectedObject") = currentSelected;
My thought is, if you have more code from here in the same script with different attributes, you would need to setup another SetTreminationFlag with a return, etc..
This would include separate functions as well.