Results 1 to 5 of 5

Thread: Wrapping my brain around it...

  1. #1

    Wrapping my brain around it...

    I have always loved the simplicity of "scripting" languages such as JavaScript, Lingo in Macromedia Director, C# in Unity, and I think it is great that LW has adopted the VFX industry standard scripting language Python. That said, does it really have to be so "elaborate" at every point and turn?

    LScript: lyrsetfg(2);

    Python: cs_options = lwsdk.marshall_dynavalues('2')
    cs_setlayer = mod_command.lookup(mod_command.data, "SETLAYER")
    result, dyna_value = mod_command.execute(mod_command.data, cs_setlayer, cs_options,lwsdk.OPSEL_USER)

    Question: is it possible to make this shorter, with some sort of dot syntax access to functions similar to lyrsetfg, or does it have to be 3 lines pr command in Modeler? It's all fine and dandy that there is extra padding on either side of the business bit of the script, but I would love to see more explanation of marshall_dynavalues and the other bits and bobs in here.

    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	PythonVsLScript.png 
Views:	91 
Size:	50.8 KB 
ID:	106404  
    Petter Sundnes
    Free LScripts

  2. #2
    Newbie Member skarloc's Avatar
    Join Date
    Apr 2008
    Location
    France
    Posts
    50
    I haven't yet done much in modeler, but I have done a fair bit in layout (which may be easier, I don't know). I did find the number of lines of code to do stuff quite high and I have done a lot of wrapping to make it easier for me.

    I'm not a great Python programmer either, but I do believe it's quite a "verbous" language. I'm not sure you could make it easier to use, with less lines...

    Maybe the SDK should include more wrappers to take the "headaches" out of the programming.

    BTW, any chance of a snippet of code that moves selected points/polygons 1mm in the X axis ? I haven't even been able to do that ! (Thanks in advance)
    Last edited by skarloc; 08-21-2012 at 01:12 PM. Reason: Typo...

  3. #3
    Worms no more! Free fun! Dodgy's Avatar
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    8,273
    I have to agree. Stuff which was very short in Lscript seems to take much longer in python. Still, as they say, it is an industry standard...

    Plus I so prefer brackets instead of indents. My favourite text editor displayed the indents incorrectly, so I was chasing my tail for half an hour trying to sort out a bug. Plus if I want to loop out a section in lscript I just comment out brackets, but I have to unindent a whole section in python, which can lead to more errors when I indent it again. Seems a pain for bug fixing :P
    Push the software, don't let it push YOU!
    My own plugins and work:www.mikegreen.name
    LaptopSetup:corei7 2.4GHz nvidia GT 650M 8Gig win8 64
    WorkSetup:core i7 3.4Ghz nvidia Quadro 2000 12Gig Ram Win7

  4. #4
    Newbie Member skarloc's Avatar
    Join Date
    Apr 2008
    Location
    France
    Posts
    50
    Quote Originally Posted by Dodgy View Post
    Plus I so prefer brackets instead of indents.
    This was one of the reasons why my former company initially rejected Python in favour of Perl - too easy to make mistakes and code is less easy to read (IMHO).

    Quote Originally Posted by Dodgy View Post
    My favourite text editor displayed the indents incorrectly, so I was chasing my tail for half an hour trying to sort out a bug.
    What do you use ? I use wscite, which seems to work well (well, I've not had any problems). At my new work, they're all Linux and Mac and they prefer vim... Which does the trick as well.

  5. #5
    LightWave documentation BeeVee's Avatar
    Join Date
    Feb 2003
    Location
    Pessac
    Posts
    5,036
    Perhaps Bob Hood's LScript to Python converter would be useful? It normally sits here: http://www.lucidgears.com:21134/ but it seems to be offline right now.

    B
    Ben Vost - NewTek LightWave 3D development
    LightWave 3D Trial Edition
    AMD Threadripper 1950X, Windows 10 Pro 64-bit, 32GB RAM, nVidia GeForce GTX 1050Ti (4GB and 768 CUDA cores) and GTX 1080 (8GB and 2560 CUDA cores) driver version 430.86
    AMD FX8350 4.2 GHz, Windows 7 SP1 Home Premium 64-bit, 16GB RAM, nVidia GeForce GTX 1050Ti (416.34, 4GB and 768 CUDA cores)
    Dell Server, Windows 10 Pro, Intel Xeon E3-1220 @3.10 GHz, 8 GB RAM, Quadro K620
    Laptop with Intel i7, nVidia Quadro 2000Mw/ 2GB (377.83 and 192 CUDA cores), Windows 10 Professional 64-bit, 8GB RAM
    Mac Mini 2.26 GHz Core 2 Duo, 4 GB RAM, 10.10.3

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
  •