Announcement

Collapse
No announcement yet.

Material Lister

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Material Lister

    ---------------------------------------------------------------------------

    Download the latest version of this script here :-
    http://www.reformstudios.com/03-reso...atList_0_41.ms

    -----------------------------------------------------------------------------



    I've started work on a vray material lister, so you can easily find rougue parameters.

    Its early days yet, so excuse the poor coding...but can anyone help?

    I can't get the table to scale with the size of the window it sits in.

    Are there any good tutorials on controlling the ui of a rollout?

    Any suggestions appreciated!

    The script so far is....

    Code:
    ---------------------------------------------------------------------------
    --MATERIAL LISTER
    --Beta 0.0.1
    --Started 21.02.06
    --Code By Patrick Macdonald
    [email]--mail@reformstudios.com[/email]
    ---------------------------------------------------------------------------
    --SHORT DESCRIPTION:
    --Listing of all scene materials with control over all material properties.
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    
    
    
    --------------------------
    --Define a default layout--
    ---------------------------
    
    macroScript SceneListView category:"HowTo"
    
    (
    global listview_rollout
    rollout listview_rollout "Scene Vray Materials"
    
    (
    
    
    -- Initialise spreadsheet
    -- Courtesy of Bobo's Spreadsheet Editor
    
    fn initListView lv =
    
    (
        enableAccelerators = false
        lv.ListItems.clear()
        lv.Arrange = #lvwAutoLeft
        lv.View = #lvwReport
        lv.Appearance = #cc3D             --: AppearanceConstants( #ccFlat | #cc3D )
        lv.fullRowSelect = true
        lv.BorderStyle =     #ccNone     --: BorderStyleConstants( #ccNone | #ccFixedSingle )
        lv.FlatScrollBar = false
        lv.HoverSelection = false
        lv.TextBackground = #lvwOpaque     --: ListTextBackgroundConstants( #lvwTransparent | #lvwOpaque )
        lv.gridLines = true
        lv.view = #lvwReport
        lv.fullRowSelect = true
        lv.multiSelect = true
        lv.labelEdit = #lvwManual
        lv.hideSelection = false
        lv.sorted = false
        lv.sortorder = #lvwAscending
        lv.hideColumnHeaders = false
        lv.allowColumnReorder = true
        lv.HotTracking = false
        lv.checkboxes = false
        textColor = ((colorman.getColor #text)*255) as color
        windowColor = ((colorman.getColor #window)*255) as color
        lv.backColor = (color windowColor.b windowColor.g windowColor.r)
        lv.foreColor = (color textColor.b textColor.g textColor.r)
        
        cnt = lv.ColumnHeaders.count
        for i = 1 to cnt do
        (
            lv.ColumnHeaders.remove 1
        )
    
        layout_def = #(#("Material Name",120), #("Material Class",120), #("Refl. Glossiness",50), #("Subdivs",50))
    
        for i in layout_def do
        (
            column = lv.ColumnHeaders.add()
            column.text = i[1]
        )
        
        LV_FIRST = 0x1000
        LV_SETCOLUMNWIDTH = (LV_FIRST + 30)
        for i = 0 to layout_def.count-1 do
            windows.sendMessage lv.hwnd LV_SETCOLUMNWIDTH i layout_def[1+i][2]
    )
    
    
    
    
    
    --------------------------
    -- Enter values into table
    --------------------------
    fn fillInSpreadSheet lv =
    (
        cnt=1
        for o in sceneMaterials do
        (
        
            if isProperty sceneMaterials[cnt] "category" do -- is category defined?
            (
                if sceneMaterials[cnt].category == #VRay do
                (
                    li = lv.ListItems.add()
                    li.text = o.name
                    sub_li = li.ListSubItems.add()
                    sub_li.text = (classof o) as string
                    sub_li = li.ListSubItems.add()
                    sub_li.text = try((o.reflection_glossiness) as string)catch("--")
                    sub_li.tooltipText = "reflection_glossiness"
                    sub_li = li.ListSubItems.add()
                    sub_li.text = try((o.reflection_subdivs) as string)catch("--")
                    sub_li = li.ListSubItems.add()
                    
                )    
            )
        cnt+=1
        )
    )
    
    
    ----------
    -- MAIN --
    ----------
    
    activeXControl lv_objects "MSComctlLib.ListViewCtrl" width:490 height:490 align:#center
    
    on listview_rollout open do
    
    (
        initListView lv_objects
        fillInSpreadSheet lv_objects
    )
    
    
    )
    
    try(destroyDialog listview_rollout)catch()
    
    createDialog listview_rollout width:500 height:500 style:#(#style_titlebar, #style_sysmenu, #style_resizing, #style_minimizebox, #style_maximizebox )
    
    )
    At the moment, I've just got a few parameters listed, but the final script will have a filter to choose whatever relevant parameters you are looking for.

    Also, I hope to add the function to edit parameters once I suss it out.

    If anyone has any other ideas to make this better, please let me know!
    Patrick Macdonald
    Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/




  • #2
    Ahar, I've managed to fix the table scaling....

    Script here:
    http://www.reformstudios.com/03-reso...MatList_0_1.ms
    Patrick Macdonald
    Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



    Comment


    • #3
      good start and nice idea.

      If we can edit the table content by double click each cell. That will be perfect.

      Have you see the metin7's vray automator.
      --Muzzy--

      Comment


      • #4
        Dang.... I did a search for material utils and didn't come across that one....
        Looks like it does everything you would need.

        I guess it would still be handy to have a list showing material parameters.

        Thanks for pointing that script out!
        Patrick Macdonald
        Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



        Comment


        • #5
          An editable list would be great! Nice start though. Looking at your script led me to Bobo's Spreadsheet editor but I wasn't all that impressed by it. The editing seems very clunky, meaning I'd love to just be able to edit right in the text boxes. My formal training was in Maya and I loved the attribute spreadsheet editor there. Is there anything else/better/comparable for Max?
          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

          Comment


          • #6
            Yea, I'm a bit stuck trying to work out how to make the fields in the list editable. It might not be possible with activex (as I'm sure Bobo would have done it neater if it was possible) ...

            The hunt for code continues
            Patrick Macdonald
            Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



            Comment


            • #7
              the spreadsheet editor works fairly well for this.. i've got one that i made, but never quite finished mabye i'll throw a couple minutes into that real quick hehe

              Edit: closer.

              You can get the SpreadSheet editor here:
              http://www.scriptspot.com/bobo/darkmoon/sse/
              extract into the Max/Scripts directory. Read some of the page, specifically the part from 'selecting objects' to 'quickly changing booleans' to see how to use it to mass edit properties.

              For Vray Materials use:
              put these two files in their respective dirs under that spreadsheet dir.
              http://www.buchhofer.com/files/downl...Vraymtl.filter
              http://www.buchhofer.com/files/downl...Vraymtl.layout

              For Vray Lights use:
              http://www.buchhofer.com/files/downl...ayLight.filter
              http://www.buchhofer.com/files/downl...ylights.layout
              Dave Buchhofer. // Vsaiwrk

              Comment


              • #8
                dbuchhofer, thanks for those. I had tried to setup the spreadsheet editor to work with vray materials, but my scripting wasn't up to it.

                I haven't had a chance to check your script yet, but if it has the same non-wired approach that bobo's has, then its not quite what I'm looking for.

                I've started from scratch with my script, ditching the activex listview approach, and going for wired controllers.

                So far I've limited functionality to vray materials only. The script filters out multiple copies of materials, and only the diffuse picker and glossiness spinners are linked to the materials so far.

                This could develop into something really handy I think... but its going to take some time (and no doubt alot of help from more experience scripters out there) to get it finished.

                The latest version of the script can be found here :-
                http://www.reformstudios.com/03-reso...MatList_0_3.ms

                edit - I think this will only work on max8
                Patrick Macdonald
                Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



                Comment


                • #9
                  Further progress update.

                  I've ripped alot of code from the lightlister macroscript.... but I'm having a problem getting the controls and labels to appear in the rollout. Can someone take a look and see if they can see the obvious mistake?

                  I've got a thread on cgtalk where the code is posted. Please take a look if you have a chance

                  http://forums.cgsociety.org/showthread.php?t=321945
                  Patrick Macdonald
                  Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



                  Comment


                  • #10
                    OK... things are coming along nicely.

                    I may redesign the interface if anyone can suggest a more logical way to organise things.... but for the basic parameters, it does the trick.

                    The script currently only works with Max version 8 and only vray materials. Support for more materials types will be added in due course.

                    Let me know if you experience any bugs.

                    The Script: http://www.reformstudios.com/03-reso...atList_0_15.ms

                    The Interface.


                    The slots visible are : diffuse colour, diffuse map, reflection colour, reflection map, reflection glossiness, refraction colour, refraction map, refraction glossiness.
                    Patrick Macdonald
                    Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



                    Comment


                    • #11
                      great idea and start.
                      =:-/
                      Laurent

                      Comment


                      • #12
                        re:FORM-

                        Thanks for your time in putting this script together. Having the reflective spinner amounts all in one view is already helpfull.

                        Suggestions: Add group lines around multimaterials with the name above. I have lots of multimaterials with the same sub material names.

                        Problems that I ran into after 5 min. test:
                        1. Do you need a refresh button to update your settings?
                        2. Is the select button working? I got an error in the selectbynamefilter.
                        3. What is that little button next to the material name for?

                        Comment


                        • #13
                          Nicely done patrick - will have a look at this later when I get home.

                          Comment


                          • #14
                            Thanks for taking the time to check out the script.

                            Yes... its a very early work in progress script, so errors will abound.

                            1. No, the settings should all update immediately. Spinners update the material in realtime in the material editor preview. (I may add a preview image to the lister at a later date if possible).... ah.. but I will need to add a refresh button though... as if you change params in the material editor, they dont show up in the MatLister.

                            2.The select script isn't working at the moment.... I am hoping someone on the cgtalk maxscript forum will have a look and help me out with filtering the object selection window.

                            3. This button is a selection button so some time in the future I can add utilities to make changes to multiple materials simultaneously.

                            For multimaterials, I'll be building a different interface.... but your suggestiong of putting them in groups sounds like a good way to go.

                            Another thing I was hoping to do, but looks like I cant (correct me if I'm wrong ) is to be able to use drag and drop, or right-click-copy/paste to copy parameters between materials.

                            SO much to do, so little time.

                            It does amaze me that something like this hasn't been done before.
                            Patrick Macdonald
                            Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



                            Comment


                            • #15
                              Another update.

                              I've got the filters working now, so you can pick and choose which material types to list. (although I have't implimented the display of any materials other than vray mats).

                              I've added buttons beneath each material:

                              S = Select objects with this material applied (not working ... see cgtalk thread for the problem if you want to help )

                              A = Apply material to selected objects (not implimented)

                              E = Edit material in material editor in selected slot.

                              and for the map slots...

                              V = View map in viewports.

                              E = Edit map in material editor in selected slot.


                              This already feels quite nice to use, even with such limited functionality.

                              So... no-one has any suggestions ?


                              Here's the latest interface:

                              Patrick Macdonald
                              Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



                              Comment

                              Working...
                              X