RitchieTheBrit Posted April 16, 2023 Share Posted April 16, 2023 Still tinkering. This time I have cobbled together a custom node to run VS:BuildResourceList2. It seems to work fine, except the SUBFOLDER option. The search doesn't appear to ever be limited to the subfolder. I want to limit the list to a very specific folder in the document resource library. Is this behaving correctly? #Modified by RB April 2023 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( "List Resources" ) this.SetDescription( 'Builds a list of resources based on the OIP input' ) #Input Ports #OIP Controls ObjectTypeIn = Marionette.OIPControl( 'Object Type', Marionette.WidgetType.Int, 0) ObjectTypeIn.SetDescription('Integer that corresponds with Vectorworks Object Type') FolderIndexIn = Marionette.OIPControl( 'Folder Index', Marionette.WidgetType.Int, 0) FolderIndexIn.SetDescription('Integer that corresponds with the folder name constants') SubfolderIn = Marionette.OIPControl( 'Subfolder', Marionette.WidgetType.Text, 'Textures') SubfolderIn.SetDescription('Limit the list to the contents of this subfolder') DefContentIn = Marionette.OIPControl( 'Default Content', Marionette.WidgetType.Bool, False ) DefContentIn.SetDescription('Tick to enable default content') #Output Ports list = Marionette.PortOut('List') list.SetDescription( "List of the specified resources" ) #BEHAVIOR def RunNode(self): #functions #inputs #script ResType = self.Params.ObjectTypeIn.value; # The resource type: https://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix_D FolderIndex = self.Params.FolderIndexIn.value; # The index of the folder path: https://developer.vectorworks.net/index.php/VS:BuildResourceList2 SubFolder = self.Params.SubfolderIn.value; # A subfolder of the folder path to which the list is limited DefContent =self.Params.DefContentIn.value; # Toggle display of default content resList = [] # Populate the resource list resListID, numItems = vs.BuildResourceList2(ResType, FolderIndex, SubFolder, DefContent) for i in range(1, numItems + 1): resList.append(vs.GetNameFromResourceList(resListID, i)) #outputs self.Params.list.value = resList Quote Link to comment
RitchieTheBrit Posted April 16, 2023 Author Share Posted April 16, 2023 I've tidied the node up a little. I still can't understand why the SubFolder doesn't do anything. https://developer.vectorworks.net/index.php/VS:BuildResourceList2 List Resources.vwx Quote Link to comment
Recommended Posts
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.