Anyone here can merge these 2 scripts? mcjClosestVertex + Set Focal Distance

The two scripts are from here:

https://www.daz3d.com/forums/discussion/43694/mcjclosestvertex-get-a-marker-at-the-position-of-the-closest-vertex-of-something-to-your-camera-fo
https://www.daz3d.com/forums/discussion/43636/set-focal-distance-script

The first script creates a null on the closest vertex on what's selected.

The second script sets focal distance to the selected null node.

Hoping someone who knows how to script can merge these two functions so that with one click it'll just create null node on the closest vertex + sets focus distance on it.

It'll save me on a click or two and having to always look for null node after each render.

 

Comments

  • Charlie JudgeCharlie Judge Posts: 12,867
    edited October 2022

    If the combined script contains the original scripts, only the original creators can legally provide it. Since there are two different creators  permission to use the scripts would be required from both.

    Post edited by Charlie Judge on
  • DaremoK3DaremoK3 Posts: 798

    @rogersohandsome :

    Charlie Judge is not wrong, but mCasual's mcjClosestVertex script already has permissive license allowing modifications/derivatives  --  You would need to secure cwichura's permission for the combination script.

    I just studied both scripts, and it is doable.

    Neither one is encompassed by a main function, so a main one can be created with calls to both as separate functions with a do step 1, then do step 2, while respecting cwichura's error coding, adding non-existent error coding for mCasual's function, and further overall error coding for main function.

    Not exactly sure how they both fit together, as cwichura's script seems to involve a couple of steps before script is fired.

    Does mCasual's script automate cwichura's creation/selection states?

    If so, then it would be a simple one script execution call.  If not, I would suggest a modal dialog with combobox selections for camera, and possibly the null(s) if more than one is available for use, with execute/cancel buttons.

  • OmnifluxOmniflux Posts: 383

    @mCasual already licenses the mcj scripts allowing for modification and redistribution, but yes, permission would need to be obtained from @cwichura to merge these.

    Attached is a sample script to call these two scripts in sequence without merging them. You may need to edit the script locations at the top of this script to match the location you saved the others to.

    dsa
    dsa
    Set Focal Distance to Selected.dsa
    2K
  • @Omniflux Script does exactly what I wanted, thanks!

  • mCasualmCasual Posts: 4,607
    I think once my script has the distance between the camera and the target, since you already have the camera object (global?) Then you do something like foclen = camera.findPropety("focal length"); If( foclen ) foclen.setValue(distance). The only thing I'd mildly object to, would be someone selling unmodified code.
Sign In or Register to comment.