LScript "Wish List"

I have been using The Semware Editor (TSE) for more than twenty years.. It started out back in the computer BBS days.. BEFORE there was a worldwide web. It really kicks a**

http://www.semware.com

regards,
William
 
I would like a script that will convert "parts" to "weight maps"

I have an OBJ that has all the "parts" named but I would like to convert them to weight maps so I can assign each part to its skelegon.
 
Wishlist for LScript

How about fixing recursion so it works correctly?

How about access to new features such as Advanced cameras? (correct me if I'm wrong, but I haven't found that if it's there).
 
How about fixing recursion so it works correctly?

How about access to new features such as Advanced cameras? (correct me if I'm wrong, but I haven't found that if it's there).

Nope it is not, I tried long ago to access to the advanced cameras, and they only way is parsing the scene file! :(

David
 
Matt, a long overdue thanks for posting your documented scripts.
+1 to the Javascript request - I played around with it in Adobe software with good results. And Javascript continues to bear fruit as it ages, seems like a good way to go. If we could write scripts in Javascript I think we'd increase the amount of plugins very quickly.
Also a +1 to the RealBasic suggestion - I used the demo on Mac years ago and it kicks butt.
Someone also requested the ability to make popups on mousing over a button so that they could write popup help. I would love to mouseover a tool, have a popup after a couple of seconds with a brief description, and a link to read more that takes you to that item's documentation in help directly, and/or a list of samples or tutorials related to that item.
 
CAUTION: Rant ahead

How about this for a couple of requests:

1) Fix the damn bugs.
2) Update the documentation.

I've just spent three days writing my first, and probably my last, lscript. The implementation is so buggy and the documentation so old (copyright=2002, file date=2005!), incomplete and just plain wrong that I will probably junk it and if I ever need to extend lightwave again I'll either write a plugin or move to a different package.

Some examples for my (non)amusement:

mystring.indexOf() SHOULD work, but always returns 0! Nice.

myarray.length once again SHOULD work, but does not.

My whole script depends on being able to copy one surface to a new surface, yet copysurface(oldsurface,newsurface) DOES NOT WORK and there does not appear to be a workaround!!!

Thanks for wasting my time. XOXOX.
 
Some examples for my (non)amusement:

mystring.indexOf() SHOULD work, but always returns 0! Nice.

you could provide a sample code. indexOf() works in certain cases, but i believe that's been somewhat explicit in the docs: you can specify only a single character into the indexOf method.

myarray.length once again SHOULD work, but does not.

i don't believe there is a length member (that's javascript, i believe). to get the length in lscript there are two ways: use myarray.size(), which also gets elements containing nils, or use size(myarray) which only counts the non-nil elements.

My whole script depends on being able to copy one surface to a new surface, yet copysurface(oldsurface,newsurface) DOES NOT WORK and there does not appear to be a workaround!!!

Thanks for wasting my time. XOXOX.

you could provide sample code to demonstrate how it doesn't work. i've used surface editing commands extensively in Janus so i know it does work. but it may require some familiarity with how LW operates. it's not always an lscript problem, but rather how plugins operate within the context of LW.
 
Knock yourself out: Script is supposed to append the name of the layer to each surface in the layer, so if you have two surfaces in two layers, you can edit them each independently:

Surf1
Surf2

becomes

Surf1:Layer1
Surf2:Layer1
Surf1:Layer2
Surf2:Layer2

Problem is, it doesn't copy the surface settings over. Near-useless as is....




Code:
//-----------------------------------------
// LScript Modeler template

@version 2.7
@warnings
@script modeler
@name "SurfaceNameLayers"


main
{
    selmode(USER);
    aryLayers = lyrdata();                                                  				// Get layers in object
    objMesh = Mesh(0);                                                      				// Magic LW obj has all kinds of stuff in it
    n = 1;                                                      
    // must use sizeof(aryLayers) instead of aryLayers.length because lscript is not Javascript compliant????
    while (n < 10 
    && n <= sizeof(aryLayers) ) {                                     							// For each layer in object

        strLayer = objMesh.layerName(aryLayers[n]);
        info("Layer Name = "+strLayer );
        lyrsetfg(aryLayers[n]);                                             				// select layer n
        strSurf = nextsurface();                                            				// get first surface in this layer
        info("First strSurf="+strSurf);
        // Must use sizeOf(parse()) because lscript blows (should support string.indexOf()
        if (strSurf != nil ) f = parse(":",strSurf);
        while (strSurf !=nil ) {                																		// For each surface in layer n

            if (sizeof(f)==1 ) {                                  									// No colons in filename
                info("strSurf="+strSurf);
                selpolygon(SET, SURFACE, strSurf);                              		// Select all polys with surface m
                selmode(DIRECT);                                              			// Lameness - must change selmode() to get correct count
                aryPolyCount = polycount();                                 				//Check if any polys selected
                selmode(USER);
                info("aryPolyCount[1]=", aryPolyCount[1]);
                if (aryPolyCount[1] > 0 ) {
                    strSurfNew =  strSurf+":"+strLayer;                    					// surface name + ":" + layer name
                    changesurface( strSurfNew );                                    // change surface to surface name + ":" + layer name
                    copysurface(strSurf, strSurfNew );                              // create new surface and copy original surface to it
                }
                selpolygon(CLEAR);
            }
            strSurf = nextsurface(strSurf);                                 				//Next
            if (strSurf != nil ) f = parse(":",strSurf);
        }

        n++;                                                                				//  Next
    }
}
 
Code:
main
{
	aryLayers = lyrdata();// Get layers in object
	objMesh = Mesh(0);// Magic LW obj has all kinds of stuff in it
	surfNames = Surface(objMesh);
	selmode(DIRECT);

	for(i=1;i<=aryLayers.size();i++)
	{
		lyr = aryLayers[i];
		lyrsetfg(lyr);
		//append layer name
		layername = objMesh.layerName(lyr);
		if(layername == nil)
			layername = string("Layer ",lyr);
		// process per surface name
		
		for(j=1;j<=surfNames.size();j++)
		{
			selpolygon(CLEAR);
			selpolygon(SET, SURFACE, surfNames[j]);
			(polyc) = polycount();
			if(polyc)
			{
				newsurfname = string(surfNames[j],layername);
				createsurface(newsurfname);
				
				str = string("Surf_SetSurf \"",surfNames[j],"\" \"",objMesh.name,"\"");
				CommandInput(str);
				
				str = string("Surf_Copy \"",newsurfname,"\" \"",objMesh.name,"\"");
				CommandInput(str);
				//~ copysurface(surfNames[j],newsurfname);
				changesurface(newsurfname);
				
			}
			
		}	
	}
}
I could not run your script without going into an infinite loop; I hadn't time to see why it was doing it so I just knocked up a script based on your requirements.

Just as you said, there is a problem with copysurface(), and even on a simpler situation than this, it does not work. Looking at Janus, I realised that I did not use any of these Modeler surface commands; I had used Surface Editor commands such as Surf_SetSurf and Surf_Copy to achieve the same functionality.

Note that I had to create a surface first (which I think can be done using the Surface() constructor, but in this case I just used createsurface()). Then using the Surf_ commands I switch to the 'active' surface, and do a surface transfer using Surf_Copy.
 
It really works!

Wow, thanks! I can see the hand of a real expert in the way you coded this thing. I really appreciate your help.

I fixed the infinite loop by doing a test for the added surfaces (I put a colon in the name and then use parse() to look for that:

f = parse(":",surfNames[j]);
if(polyc && (f.size()==1))
{
newsurfname = string(surfNames[j],":",layername);


Here's the completed procedure, which really works!

Code:
@version 2.7
@warnings
@script modeler
@name "SurfaceNameLayers2"

main
{
  aryLayers = lyrdata();// Get layers in object
  objMesh = Mesh(0);// Magic LW obj has all kinds of stuff in it
  surfNames = Surface(objMesh);
  selmode(DIRECT);

  for(i=1;i<=aryLayers.size();i++)
  {
    lyr = aryLayers[i];
    lyrsetfg(lyr);
    //append layer name
    layername = objMesh.layerName(lyr);
    if(layername == nil)
      layername = string("Layer ",lyr);
    // process per surface name
    
    for(j=1;j<=surfNames.size();j++)
    {
      selpolygon(CLEAR);
      selpolygon(SET, SURFACE, surfNames[j]);
      (polyc) = polycount();
      f = parse(":",surfNames[j]);
      if(polyc && (f.size()==1))
      {
        newsurfname = string(surfNames[j],":",layername);
        createsurface(newsurfname);
        
        str = string("Surf_SetSurf \"",surfNames[j],"\" \"",objMesh.name,"\"");
        CommandInput(str);
        
        str = string("Surf_Copy \"",newsurfname,"\" \"",objMesh.name,"\"");
        CommandInput(str);
        //~ copysurface(surfNames[j],newsurfname);
        changesurface(newsurfname);
        
      }
      
    } 
  }
}
 
1) Make the lscompiler remember the last settings.
2) Or give us an executable or command sequence that can setup and run the lscompiler.

It's frigging annoying having to go through the compiler gui, click the same boxes, pick the same file, rename the output file... over and over and over. Give us tools for developers not toys for robots with nothing better to do.
 
1) Make the lscompiler remember the last settings.
2) Or give us an executable or command sequence that can setup and run the lscompiler.

It's frigging annoying having to go through the compiler gui, click the same boxes, pick the same file, rename the output file... over and over and over. Give us tools for developers not toys for robots with nothing better to do.

+1. I prefer # 2 suggestion, of course.
 
a request.
I will like more functions to access all Panels size and position.
Actually only a few are accessible (GraphEd, SurfEd, Layout, etc..)
I would like no size limitation too.
We need a more conformed size panels and not so floating everywhere...
 
Some months ago, I've started to work on a passes manager tool. (which is working without the need to remap all functions in the script ui, nor reloading the scene to set up each passe)
It was promising until I had to face the too many inconsistencies in the LW ui functions
For this, a better (and exhaustive) set of functions would be needed to clearly be able to get and set every value and ui element state (colors, checkboxes, etc...)
For now, we have sometimes only getters, or only setters, or only toggles, or nothing ! This is REALLY annoying :(
Any hope to see this one day ?
 
Some months ago, I've started to work on a passes manager tool. (which is working without the need to remap all functions in the script ui, nor reloading the scene to set up each passe)
It was promising until I had to face the too many inconsistencies in the LW ui functions
For this, a better (and exhaustive) set of functions would be needed to clearly be able to get and set every value and ui element state (colors, checkboxes, etc...)
For now, we have sometimes only getters, or only setters, or only toggles, or nothing ! This is REALLY annoying :(
Any hope to see this one day ?

I don't know if it will help your specific situation, but a couple of really annoying bugs in Compositing Buffer Export were fixed in 2015.2, and it actually works quite well now.
 
Back
Top