Jump to content
Developer Wiki and Function Reference Links ×

Materials in Marionette?


Recommended Posts

I'm building a simple hybrid object in Marionette.

Now I'd like to use materials in the object. There seem to be no nodes for materials in Marionette.

I'm missing 2 nodes:

  • A 'materials popup' node to select a material from the available materials in the current document.
  • A 'set material' node to attach a material by name to an object by handle.

I've been able to create the latter.

But when I create the 'materials popup' node, I'm running into an issue. When I create the node, it lists the materials in the document correctly, but when I add a material to the document, it doesn't update except when I save the current document...

I'm attaching my custom nodes.

Geëxporteerd bestand Marionette.vwx

Link to comment
  • 3 weeks later...
  • 2 years later...
  • 1 year later...

@Peter Vandewalle Dit you ever solve this issue? I try to assign a material to an object in marionette, but the 'set material' node produces an error in VW2025. There also is a new 'set material' node in this version, but that one needs the handle of a material from the resources. Look complicated.

Link to comment
  • Marionette Maven

Hi guys - back in 2020 I started looking into a way to allow dynamic updating in the OIP, and landed on this workaround.

This node allows you to use a button in the OIP that shows a popup which stores the selection as a label and outputs the label value.

I've modified my old node to point at materials in the active document.

Hopefully this can help in some way!

Simple Marionette Set Material.vwx

  • Love 2
Link to comment

Hi Marissa, Great work with that node, I have a question about those drop-downs. is it possible to feed a couple of fixed lists into a node, say I have a list like ['600 standard', '800 special'] and then another node for the actual sizes [560, 760] is there a way to do that whilst still having the drop-down appear in the shape tab, would you just use something similar to how you have created the node on this or is there a way to feed the lists into a standard dropdown somehow better, I am trying to make it more simpler for the users when going in to edit the sizes so they don't see most of the marionette they only see the bits that are editable, if that makes sense. appreciate your help. Sim

Link to comment
  • Marionette Maven
4 hours ago, TSG-Sim said:

Hi Marissa, Great work with that node, I have a question about those drop-downs. is it possible to feed a couple of fixed lists into a node, say I have a list like ['600 standard', '800 special'] and then another node for the actual sizes [560, 760] is there a way to do that whilst still having the drop-down appear in the shape tab, would you just use something similar to how you have created the node on this or is there a way to feed the lists into a standard dropdown somehow better, I am trying to make it more simpler for the users when going in to edit the sizes so they don't see most of the marionette they only see the bits that are editable, if that makes sense. appreciate your help. Sim


If you have fixed lists, you could use the Popup List node in Input > Intermediate and hardcode those values into the node script. 
Let me know if you need a working example, or if I'm misunderstanding.

  • Like 1
Link to comment

Hi Marissa thank you, if possible a small working example would be great so I don't misunderstand that, I did find a partial workaround by just using comments in the popup list but it would be great if the fixed list could be separated out so the users don't need to look at any the rest of the marionette. appreciate your help with this.

 

There are two ways I was thinking of going with this one, there was 1. a fixed list input as mentioned but I was also thinking, if I fixed the lists already would there be a way to have a tickbox options in the marionette node that the user picks and that input filters the popup list to show the relevant correct lists but I think feeding the lists into the marionette node would be the better option so the user only sees the lists input and then the finish list popup is the backend.

 

I am using this in a hMaterial input in Set Material on named input items for the different parts of a storage cupboard so it displays all the materials available to the user and only the available options to the user but allows me to re-use one for all the parts

 

I hope this all makes sense:

 

appreciate the help.

 

 

 

this is a node that worked for me:

 

@Marionette.NodeDefinition

class Params(metaclass = Marionette.OrderedClass):

    # THIS IS THE LIST OF FINISHES TO ADD TO THE LIST COPY ONE OF THE EXISTING AND MAKE SURE YOU ADD THE COMMA , and SPACE IN PLEASE
    finishNames = ['(MFC 1) BH Beech MFC', '(MFC 1) DHI Dark Rockford Hickory MFC', '(MFC 1) GRO Greige Castello Oak MFC', '(MFC 1) LG Light Grey MFC', '(MFC 1) SO Strata Oak MFC', '(MFC 1) UM Urban Maple MFC', '(MFC 1) WH White MFC', '(MFC 1) WK Winter Oak MFC', '(MFC 2) ABL Alby Blue MFC', '(MFC 2) BLT Basalt MFC', '(MFC 2) COG Cobalt Grey MFC', '(MFC 2) DSA Deep Sahara MFC', '(MFC 2) PUB PUB Premium Black', '(MFC 2) PUW Premium White', '(MFC 2) SGR Smoke Green MFC', '(MFC 2) SLG Slate Grey MFC', '(MFC 2) TAG Taupe Grey Egger MFC']
    #DO NOT TOUCH ANYTHING BELOW THIS UNTIL YOU GET TO finishNameList
    
    this = Marionette.Node( "Get Texture" )
    this.SetDescription( 'Returns the selected texture from the dropdown list' )
    
    selectedTexture = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, finishNames)
    selectedTexture.SetDescription( "A list of the available finishes" )

    output = Marionette.PortOut('h')
    output.SetDescription( "The selected texture's name" )

def RunNode(self):

    # COPY THE FINISH NAME LIST ABOVE TO HERE IF YOU ADD FINISHES
    finishNameList = ['(MFC 1) BH Beech MFC - Senator', '(MFC 1) DHI Dark Rockford Hickory MFC - Senator', '(MFC 1) GRO Greige Castello Oak MFC - Senator', '(MFC 1) LG Light Grey MFC - Senator', '(MFC 1) SO Strata Oak MFC - Senator', '(MFC 1) UM Urban Maple MFC  - Senator', '(MFC 1) WH White MFC - Senator', '(MFC 1) WK Winter Oak MFC - Senator', '(MFC 2) ABL Alby Blue MFC - Senator', '(MFC 2) BLT Basalt MFC - Senator', '(MFC 2) COG Cobalt Grey MFC - Senator', '(MFC 2) DSA Deep Sahara MFC - Senator', '(MFC 2) PUB PUB Premium Black - Senator', '(MFC 2) PUW Premium White - Senator', '(MFC 2) SGR Smoke Green MFC - Senator', '(MFC 2) SLG Slate Grey MFC - Senator', '(MFC 2) TAG Taupe Grey Egger MFC - Senator']
    
    index = self.Params.selectedTexture.value
    
    getObject = vs.GetObject(finishNameList[index])

    self.Params.output.value = getObject

 

 

but I need to add all the other material finishes here: 

band1Finishes = ['(MFC 1) BH Beech MFC', '(MFC 1) DHI Dark Rockford Hickory MFC', '(MFC 1) GRO Greige Castello Oak MFC', '(MFC 1) LG Light Grey MFC', '(MFC 1) SO Strata Oak MFC', '(MFC 1) UM Urban Maple MFC', '(MFC 1) WH White MFC', '(MFC 1) WK Winter Oak MFC']

band2Finishes = ['(MFC 2) ABL Alby Blue MFC', '(MFC 2) BLT Basalt MFC', '(MFC 2) COG Cobalt Grey MFC', '(MFC 2) DSA Deep Sahara MFC', '(MFC 2) PUB PUB Premium Black', '(MFC 2) PUW Premium White', '(MFC 2) SGR Smoke Green MFC', '(MFC 2) SLG Slate Grey MFC', '(MFC 2) TAG Taupe Grey Egger MFC']

band3Finishes = ['(MFC 3) BOK Black Cassella Oak MFC - Senator', '(MFC 3) DCO Brown Casella Oak MFC - Senator', '(MFC 3) LCO Light Natural Casella Oak MFC - Senator', '(MFC 3) NCO Natural Casella Oak MFC - Senator']

stockLaminateFinishes = ['(SL) BLK  Jet Black Stock Laminate - Senator', '(SL) LTG  Light Grey Stock Laminate - Senator', '(SL) OAK  Summer Oak Stock Laminate - Senator', '(SL) PLA  Platinum Stock Laminate - Senator', '(SL) PWT  Pewter Grey Stock Laminate - Senator']

globalLaminateFinishes = ['(GL) BLK Diamond Black  - Senator', '(GL) BWN Smoky Brown - Senator', '(GL) CHC Dark Chocolate - Senator', '(GL) COF Planked Coffee - Senator', '(GL) CST Chestnut Woodline - Senator', '(GL) EBY Ebony - Senator', '(GL) FOG Fog - Senator', '(GL) FOS Fossil - Senator', '(GL) GRY Sarum Grey - Senator', '(GL) MOK Millenium Oak - Senator', '(GL) MSE Mouse - Senator', '(GL) NAS Natural Ash - Senator', '(GL) STM Storm - Senator', '(GL) WAL Oiled Walnut - Senator', '(GL) WAS White Ash - Senator', '(GL) WHT Brite White - Senator']

marbleTops = ['Bianco Carrara Honed Marble', 'Romano Bianco Vein-Cut Mastic Filled&Honed Travertine', 'Verde Oriental Honed Marble']

metalworkFinishes = ['BLK  Black Metal - Senator', 'SLV  Soft Silver Metal - Senator', 'WI  White Metal - Senator']

plasticFinishes = ['(PLA) BKP  Black Plastic - Senator', '(PLA) SLP  Silver Plastic - Senator', '(PLA) WHP  White Plastic - Senator']

 

Edited by TSG-Sim
had incorrect copied code for marionette node
Link to comment
  • Marionette Maven

I have an idea that I would need to test - theoretically you could store your list in a text file and pull it in, but the user would still need to open the node script to load the values - the OIP wouldn't register the change without that step.

Let me find time to try this out and I'll get back to you.

  • Like 1
Link to comment
  • Marionette Maven

Okay, proof of concept attached. In the top version, when you open/close the node script, you will be prompted to choose a text file. You'll have to deselect and reselect the node on the drawing area for the values to update. 
The values of the popup would then be loaded to the popup control in the OIP.
This version will require you to choose the file again to finish running the script.

 


The bottom version currently points to a file in the root of your user folder - you can play around with paths to things if you want - which will prevent the user from having to choose the file. If the file is changed between runs, the user will need to open/close the node script to reload the values in the OIP popup.

 


I'm attaching the .txt file I used for testing. 

 


There are other ways you could modify this to adapt to what you think your users need; if you have something you're considering and get stuck, let me know and I'll see if there's something we can put together.

Marionette popup load from file_MFarrell.vwx popup list items.txt

Link to comment

thank you Marissa I will have a look through and see where I get to with that, I appreciate all your help with this, it is slowly coming together but I might post you some sample files once I get to the end of what I am working on to see if what I am doing is the correct way to do what I am doing. 

Link to comment
  • Marionette Maven
6 hours ago, PvWarch said:

the view changes when selecting the material picker button when using it in a marionette object

This is currently a limitation with Marionette Objects in 3D views. In more complex objects, we were finding that things weren't being drawn in the correct position while in a 3D view, and the current fix is to switch the view to top when updating the objects and return it to the previous view.

Until we can find a better solution, this is working as intended.

  • Like 1
Link to comment

hi Marissa , thank you I have posted a new thread, is there a way for you to delete the file I uploaded in this original thread? I can't seem to find where you do that.

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

 

Member

 40

Posted Friday at 03:44 PM

Hi Marissa really appreciate you helping me with the text file I am still going to have a go at implementing that but I am struggling with something to do with material drop-downs and I think I have messed up some of my nodes in this, I am trying to create a full dynamic storage unit that will change finishes (I am sorry if any of the nodes are a bit messy I have tried to keep them clean but I got a little stuck and messed up and apologies for that)  Basically the top should be part of the credenza storage unit and the height of the top will change when the user changes the finishes and my implementation maybe really incorrect, but is there any chance you or somebody at vectorworks could have a look into this file please and let me know if this is even possible with marionette nodes and if I am going down totally the wrong route with the way I am creating it, I have implemented a dropdown with the finishes just hard coded at the moment instead of the pull in list that you sent just to try and implement it first. I appreciate any help with this, I post the file here if it helps anybody with dropdown nodes and objects if this is the correct way to do it. Appreciate the help. thank you, Sim

Credenza.vwx433.87 MB · 1 download

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...