Page 2 of 5 FirstFirst 1234 ... LastLast
Results 16 to 30 of 72

Thread: Lscript Question

  1. #16
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Well, my prototype rig writer & reader scripts will import some fairly complex stuff, and get things connected up correctly; It handles the standard humanoid from Rhiggit2 flawlessly, or at least good enough to work with Tischbein's weighting plug in.
    I've got a whole bunch of these things I need to get refined - If I find them useful, someone else might as well...

    You know, if the cmdseq("SetTag", "PART " + string); sets the part on a skelegon, it should set the part name on any polygon...
    That makes something a bit easier to do in another tool... (Make hair - generates spline curves for hair guides, with the root below the scalp object, an optional point at the scalp, and the tip of the stubble. Along with either Sensei's Extend Spline, or my crude lScript version, you can pull hair guides along, and manipulate the CP's with any number of modeler tools...)
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  2. #17
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    On to the next question...

    It appears that LSID needs some attention (and I'll report the nastiness I just came across). Are there _any_ other options for generating a UI for an lscript besides LSID?
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  3. #18
    Quote Originally Posted by Kryslin View Post
    On to the next question...

    It appears that LSID needs some attention (and I'll report the nastiness I just came across). Are there _any_ other options for generating a UI for an lscript besides LSID?
    I make mine manually...prolly not the most efficient process...

    If you save out templates or bits of code to recycle then it helps the process.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  4. #19
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Something I came up with that might help... I'm a sucker for grid layouts. So, to make things much easier, I did the following:
    1) Defined 3 global variables - GRID_SIZE, SKEW, and OFFSET
    2) Added a UDF called gbox (x,y,h,w) - (x,y) being the grid coordinates, (h,w) being the height and width of the control. it returns an array of 4 numbers [1] & [2] being equal to (x,y) * GRID_SIZE + OFFSET, and [3] & [4] = (h,w) * GRID_SIZE.

    3) those 4 numbers are fed into ctlposition(c1,[1],[2],[3],[4]);

    4) Repeat many, many times, and you get this:
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  5. #20
    Hm interesting. Can you post example code? I'd be interested in finding a way to organize uis better. Manually plotting where the ctl items go gets old quickly.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  6. #21
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Here we go...
    Code:
    //Globals for UI Helper function
    var GRIDSIZE = 22;
    var SKEW = floor(GRIDSIZE / 2);
    var OFFSET = floor(SKEW / 2);
    
    //Global UI Helper Function
    gbox : w_x, w_y, w_h, w_w
    {
          //All units are in grid coordinates
          //w_x = x coordinate, w_y = y coordinate
          //w_h = height, w_w = width
          //This UDF converts from grid coordinates to screen coordinates
    	var retv[4];  //Return Values
    	retv[1] = (w_x * GRIDSIZE) + OFFSET;
    	retv[2] = (w_y * GRIDSIZE) + OFFSET;
    	retv[3] = (w_h * GRIDSIZE);
    	retv[4] = (w_w * GRIDSIZE);
    	return(retv);
    }
    
    //Code Snippets...
    var a[4]; //array to hold the return values from gbox()
    //Sizing your requester panel...
    //You only need Height and Width...
    reqbegin("My Panel"); a = gbox(0,0,24,18);reqsize(a[3]+OFFSET,a[4]);
    
    //A text box example
    a = gbox(5,0,14,1); c1 = ctlstring("Item Name",itemname); ctlposition(c1,a[1],a[2],a[3],a[4]);
    
    //A separator example
    //Skew is used to offset the line to the middle of the box
    a = gbox(0,1,24,1); s1 = ctlsep(a[1],a[3]); ctlposition(s1,a[1],a[2] + SKEW,a[3],a[4]);
    gbox() makes things easier to move around and resize, though it doesn't make for very readable code. The function itself could use some tweaking; I could give it a "mode" setting, so it automatically adds offset and/or skew values for the main panel and separators, and maybe some variants, for centering things a little nicer.

    This got the job done, though.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  7. #22
    Thanks!
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  8. #23
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Another question:

    While working on my Splines on Strips script, I had to write a bit of code that basically duplicated the "w" panel in modeler, for points -showing how many polygons each point was referenced by. Is there a native function that does this (like polycount() does for polygons)?
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  9. #24
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,884
    Quote Originally Posted by Kryslin View Post
    Is there a native function that does this (like polycount() does for polygons)?
    In C/C++ LWSDK you have to call pointEdges, then edgePolys, in double loop, and make list.

  10. #25
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Question time... This has to do with 'publishing', aka releasing scripts to the public, especially work alike scripts.

    Story : Sometime back in the LW 10 days, I wrote a handy little script for a friend called "Extend Spline", which does exactly what the name says... it adds a control point to the end of a lightwave spline, which you can use LW's tools on - it's really handy for styling hair guide curves. I did this shortly after I had purchased the Trueart True Hair tools, which includes a subset of the Easyspline tools... including Extend Spline (mainly both for my friend, and as a challenge for myself - A "Can this be done in lscript?" challenge).

    A problem, possibly several, arise - I am planning on releasing an entire set of hair tools, written in lscript, for free. They're stable, reliable, a bit slow sometimes, but they do work, and work well. Unfortunately, they do some things that some of Truearts's plugins do, and I want to avoid what could be some very unpleasant business.

    These tools include:
    1) Make Hair (creates little stub hair curves bases on a polygonal selection, one to a polygon).
    2) Extend Spline (mentioned above)
    3) Select Spline Start/End Point
    4) Select Spline Next CP/Prev CP
    5) Smooth Spline
    6) Trim Spline
    7) Quad Strips to Splines (yes, I've got it working.)

    As you can easily see, most duplicate functionality that exists in commercial plugins, and I don't want to be seen as someone who is taking business away from others in an already tight market...

    Any suggestions or advice?
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  11. #26
    Quote Originally Posted by Kryslin View Post
    Question time... This has to do with 'publishing', aka releasing scripts to the public, especially work alike scripts.

    Story : Sometime back in the LW 10 days, I wrote a handy little script for a friend called "Extend Spline", which does exactly what the name says... it adds a control point to the end of a lightwave spline, which you can use LW's tools on - it's really handy for styling hair guide curves. I did this shortly after I had purchased the Trueart True Hair tools, which includes a subset of the Easyspline tools... including Extend Spline (mainly both for my friend, and as a challenge for myself - A "Can this be done in lscript?" challenge).

    A problem, possibly several, arise - I am planning on releasing an entire set of hair tools, written in lscript, for free. They're stable, reliable, a bit slow sometimes, but they do work, and work well. Unfortunately, they do some things that some of Truearts's plugins do, and I want to avoid what could be some very unpleasant business.

    These tools include:
    1) Make Hair (creates little stub hair curves bases on a polygonal selection, one to a polygon).
    2) Extend Spline (mentioned above)
    3) Select Spline Start/End Point
    4) Select Spline Next CP/Prev CP
    5) Smooth Spline
    6) Trim Spline
    7) Quad Strips to Splines (yes, I've got it working.)

    As you can easily see, most duplicate functionality that exists in commercial plugins, and I don't want to be seen as someone who is taking business away from others in an already tight market...

    Any suggestions or advice?
    Since your stuff is lscript and TrueArt's tools are actual C plugins, TrueArt's stuff will always be faster. So if the user wants better tools then they would go the commercial plug-in route. But if someone can get the functionality they want, free is always more popular than commercial.

    I don't know if that helps clarify your situation. I'm sure you're coming with good intentions.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  12. #27
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    My hope is that the TA stuff does more than what my simple, basic stuff does; I do intend to put a note to that effect in the zip archive; "If you want more capable tools (that do more than the basics), go here..."
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  13. #28
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    You could include text in any dialogs pointing to the commercial plugin suppliers, and make the point that their offerings WILL be faster (generally).
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  14. #29
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,461
    Next up...

    This is less a lscript question, and more of a vector math question...
    I've been playing around with writing a bias map generator that emulates what Sasquatch's combing panel does, to a certain degree...

    Here are the results, so far...


    In the picture on the left, there is a noticeable area that pokes straight up in the center, and one on the right hand side of the frame. This is a FiberFX issue, caused by an unforseen interaction between the bias map and gravity (gravity appears to be applied before the bias map is - when gravity is set to zero, issue goes away) that I will be reporting. The main problem I'm having is generating my combing vector; I make a vector from an effector point, to the vertex, then normalize it. Using the vertex normal, make a perpendicular vector, and add that to the surface normal. It actually works quite nicely, up until the combing vector has less of a slope than the vertex normal, causing the perpendicular vector to flip.

    Any suggestions on how to keep that flip from happening? It's quite visible in the right hand frame. If it wasn't for that, this would be quite a handy little script.

    I've included a code snippet, so my explanation above will make more sense...
    Code:
       //The vertex map's base name...
       mapname = "fur_bias";
    
       //The effector point, to brush away from...
       var away_s = <0.00, 1.806, 0.1561569>; 
    
       //In the future, this will be transparent;
       //effector point will be determined by surface, along
       //with any falloff needed.
    
       //halfvec is used for remapping purposes.
       var halfvec = <.5,.5,.5>;
    
       //Our vertex maps...
       mymap = VMap(VMRGB, mapname, 3); //Straight up bias map
       mymapalt = VMap(VMRGB, mapname+"_rm",3); // bias map remapped to 0...1 range
    
       vc = verts.count(); //verts[] is an array containing vertex IDs
       //Adds a perpendicular vector to the vertex normal,
       //based on a vector between the effector point and
       //the vertex being evaluated.
    		
       for(i = 1; i<=vc; i++){
          vn = vnorms[i]; // Array containing vertex normals
          av = pointinfo(verts[i]) - away_s;  //Make a vector from the effector point to the vertex
          bv = normalize(av); // Normalize it
          pv = makeperp(bv,vn);  // Make a perpendicular vector pv = bv - (bv dot vn) * vn;  since ||bv|| = 1, ||bv||^2 = 1, division term not needed.
          nv = normalize(vn + pv );//Normalize it
          mymap.setValue(verts[i],normalize(nv));  //Set the map value to it.
          rmv = (nv * halfvec) + halfvec; //Remap the value to 0...1
          mymapalt.setValue(verts[i], rmv);  //set the alternate map value to that.
       }
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  15. #30
    Goes bump in the night RebelHill's Avatar
    Join Date
    Nov 2003
    Location
    jersey
    Posts
    5,763
    Off the top of my head... it might be your use of dot in make perp. Dot gives you the angle between 2 vectors (or comparison rather as a 1 to -1 range)... But that function (sin) only occupies half the unit circle, so at some point you get the same value but from the flip side.

    Try cross instead...

    pv = cross3d(vec1,vec2);
    LSR Surface and Rendering Tuts.
    RHiggit Rigging and Animation Tools
    RHA Animation Tutorials
    RHR Rigging Tutorials
    RHN Nodal Tutorials
    YT Vids Tuts for all

Page 2 of 5 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •