Feedback

Please leave feedback and comments. I am always interested to hear how people get on using these LScripts!

Monday 18 February 2013

LScript - Generic_Blueprint


LScript (Layout) to quickly setup a scene to produce a blueprint look.

Please be aware this script overrides objects surfaces settings.

Compatible with Newtek LightWave 9.6 and above.

// LScript Generic - www.StephenCulley.co.uk
//
// web   address: http://www.stephenculley.co.uk
// email address: email@stephenculley.co.uk

/*  
    LScript Generic - Blueprint

    Generic_Blurprint.ls

*/

@version 2.2
@warnings
@script generic
@name *Blurprint

    sTitle = "*Blueprint";
    sVersion = "v1.0";    

generic
{
    reqbegin(sTitle + " " + sVersion);

    ctrl_c0 = ctlcolor("Background",<60,100,200>);
    ctrl_c1 = ctlcolor("Lines",<255,255,255>);
    ctrl_c2 = ctlnumber("Opacity",0.2);
    ctrl_c3 = ctlchoice("Show",1,@ "Edge","All" @,false);

    // Developer
    ctlsep();
    ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk");

    return if !reqpost();   

    vBackgroundColor = getvalue(ctrl_c0);
    vLineColor = getvalue(ctrl_c1) * (1/255);
    nOpacity = getvalue(ctrl_c2);
    if(getvalue(ctrl_c3) == 2){iPolygonEdgeFlag = 31;}else{iPolygonEdgeFlag = 15;}
    
    // Background Color
    if(Scene().backdroptype == GRADIENT){CommandInput("GradientBackdrop");}
    CommandInput("BackdropColor " +  (vBackgroundColor.x * (1/255)) + " " + (vBackgroundColor.y * (1/255)) + " " + (vBackgroundColor.z * (1/255)));

    // Item
    Item = Mesh();
    while(Item)
      {

      if(Item.isMesh())
        {
        SelectItem(Item.id);
        CommandInput("PolygonEdgeFlags " + iPolygonEdgeFlag);
        CommandInput("PolygonEdgeThickness 1 1 1 1 1");
        CommandInput("PolygonEdgeColor " + vLineColor.x + " " + vLineColor.y + " " + vLineColor.z);

        // Surface
        Surface = Surface();
        while(Surface)
          {
          Surface.setValue(SURFCOLR,vBackgroundColor); // Color
          Surface.setValue(SURFLUMI,1.0); // Luminosity
          Surface.setValue(SURFDIFF,0.0); // Diffuse
          Surface.setValue(SURFSPEC,0.0); // Specularity
          Surface.setValue(SURFREFL,0.0); // Reflection
          Surface.setValue(SURFTRAN,nOpacity); // Transparency
          Surface.setValue(SURFTRNL,0.0); // Translucency
          Surface.setValue(SURFBUMP,0.0); // Bump
          Surface.setValue(SURFSIDE,1); // Sided
          Surface = Surface.next();
          }

        }

      Item = Item.next();
      }

    info(sTitle + " " + sVersion + " - developer: Stephen Culley - http://www.stephenculley.co.uk");
}


All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs

2 comments: