Results 1 to 7 of 7

Thread: How to edit surfaces in layout (with example)

  1. #1

    How to edit surfaces in layout (with example)



    I figured this is information people might want, so i'm providing a sample script with scene file. Modifying plugins and surface data must be performed through a combination of:

    1) Commands which produce a text file with plugin/surface data (Example: lwsdk.command("Surf_LoadText C:\\mytextfile.txt")
    2) Having the script edit (or replace) those text files through parsing
    3) Commands which load a text file onto a target plugin entry or surface (Example: lwsdk.command("Surf_SaveText C:\\mytextfile.txt")

    The RR_PBR_Surface_Setup.py contained within the zip file will look for files containing key words like "Diffuse" or "Metallic" and automatically set up the nodes on the selected surface. It will save a surface file to the same directory the plugin is run from. Note that this plugin works off of the location of the scene file loaded to find the images and assumes a standard folder structure.
    It serves as an example as to how you can avoid having to work in the node editor through scripting. Feel free to pick apart and modify this script to suit your needs.

    RR_PBR_Script_Example.zip
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Image4.jpg 
Views:	175 
Size:	52.0 KB 
ID:	146429  
    Attached Files Attached Files
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

  2. #2
    Super Member JohnMarchant's Avatar
    Join Date
    Mar 2003
    Location
    Murcia, Spain
    Posts
    3,095
    Thanks very much Ryan.
    Dell XPS 15
    15.6-inch (3840 x 2160) 4K 282ppi IPS LCD
    Intel i7 7700HQ 2.8GHz
    Windows 10 64Bit
    NVidia GeForce GTX 1050 Ti
    1TB SDD
    32Gb Ram

    LightWave 2019.03

    Very nice Laptop

  3. #3

    Neat! 

    note, .py opens in Notepad++
    or open in regular Notepad if you are really-really hardcore.  
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  4. #4
    Frequenter
    Join Date
    Sep 2003
    Location
    Munich
    Posts
    391
    Cool. Thanks for sharing, Ryan! :-)
    ______________
    lorenz

  5. #5
    Registered User dlvphoto's Avatar
    Join Date
    Feb 2018
    Location
    Atlanta, GA
    Posts
    31
    This helps me tremendously in my attempts to write a linker between Quixel Bridge and LW. ***thank you***.

  6. #6
    Registered User Oldcode's Avatar
    Join Date
    Jan 2004
    Location
    Boston
    Posts
    437
    Ryan,

    Very cool!

    Is this the same basic idea of the old Surface file from 2015 and previous?

  7. #7
    No. Starting with LW 2018, the SDK for lightwave gained a few key commands that allows deeper access to data:

    - Enables the user to extract, parse, and write information regarding surfaces, including node connections, envelopes, etc. NOTE: These commands operate relative to the currently selected surface (or the first surface is none is selected). You can manipulate the surface selection through python.
    Surf_LoadText "filename" (filename must be in quotes)
    Surf_SaveText "filename"

    - Enables the user to extract, parse, and write information regarding motion modifiers, item shapes, geometry modifiers, etc.
    SaveServerDataByItemID <itemid> <class> <index> <optional_format> "filename"
    LoadServerDataByItemID <itemid> <class> <index> <optional_format> "filename"

    So, essentially you extract a text file which contains all the information about a surface or plugin, make changes to that data, then re-apply it. Granted, this is very similar to just parsing the scene file itself, the major exception to this is the fact that you can inject changes into the scene *without* needing the user to reload the scene entirely.
    Last edited by Ryan Roye; 01-06-2020 at 09:21 AM.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

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
  •