Results 1 to 4 of 4

Thread: Set item shape in lscript?

  1. #1
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    799

    Set item shape in lscript?

    Is there any way to set an item shape on a null in lscript?

  2. #2
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,612
    Yes there is, but it's not for the weak of heart.
    1) Apply the "CustomObjHandler" "LW_ItemShape" to the null.
    2) Get the data fields required by using itemshapedata();
    3) Attach to the comring
    4) Encode an empty data block using comringencode
    5) Send a comringmsg to the plugin requesting to send it's current data. (msg code 100)
    6) Decode the data.
    7) Fill the array with your data.
    8) Encode your data
    9) Send your comringmsg to set the data. (msg code 200)
    10) Detach from the comring.

    I found it easier to encapsulate all of the above into a single UDF, so in your main loop, you simply have
    Code:
    result = addItemShapeToObject(ObjectID, paramArray);
    instead of 200 lines of code in the middle of your script.

    I have a lscript out there that redoes the Add Item Shape menu that's not compiled. Most of the code involved deals with setting the item shape, the rest deals with the UI. go here and tear it apart and see if you can figure it out. I'd post it here, but I might get in trouble since the data structure for LW_ItemShape handler is private to NewTek, and no longer open to the public. IMHO, that's kind of dumb. There's a couple of old lscipts that broke that have the basic code there as will.

    go here -> https://tlhea.org/files/LayoutTools.zip to get the zip containing the script, It's smp_BuildNullObject3.ls. I'll try to answer any questions I can.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  3. #3
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    799
    Jiminy Christmas! That comring stuff is no joke! I think i understand more or less what is going on there, and I very much appreciate you sharing that with me! For the time being I think I might try to avoid spinning off into that tangent, since item shapes are not absolutely vital to what I am working on at the moment, but would merely be nice to have. Thanks!

  4. #4
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,612
    Also, keep in mind that you may need to trap different versions of Lightwave in your script; the contents of the array returned by itemshapedata() differs between 2019.1.5 and 2020.; there is one less item in 2020.

    Also, what that field does has also changed.

    The first 24 fields remain the same.

    Prior to LW2020:
    Field 25 contained a duplicate of the null's label text.
    Field 26 was a string field, and was not used.
    Field 27 was a numeric field, set to 0
    Field 28 was a string field, and was not used.
    Field 29 was a string field, and contained the name of the object a dashed line was drawn to.
    Field 30 was a numeric field, containing a value indicating how the null label was positioned.

    In LW2020:
    Field 25 contains the name of the null's item shape. It will not be applied unless it is present here.
    Field 26 is a numeric field, set to 0.
    Field 27 is a string field, and is not used (set to "").
    Field 28 is a string field, and contains the name of the item a dashed line is drawn to.
    Field 29 is a numeric field, containing a value indicating how the null label was positioned.

    Hope this helps someone.
    Last edited by Kryslin; 04-29-2020 at 03:57 PM.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

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
  •