mattao Posted August 3, 2018 Share Posted August 3, 2018 (edited) Hi I just built this node to be able to "marionette" the "Crit" of Obj by Crit You have to put the "criteria" text in the String Node. It will be passed to the new node and command his action. By so you could act on the "criteria" string using marionette text and string nodes. It seems to work. Hope it will be useful. I am pretty sure DomC has published something like that but cannot get my hand on it. Hi DomC. I am a fan of your work. #COMMAND;REFFILE;[VWLibDef]/Input\Objs by Crit Mat.py; #Modified August 2018 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Objs by Crit Mat' ) this.SetDescription( 'Returns a list of objects meeting the input criteria' ) #Input Ports stringIn = Marionette.PortIn('', 's') stringIn.SetDescription( "The input string" ) #Output Ports obj = Marionette.PortOut('h') obj.SetDescription('The list of objects in the document that match the criteria') #BEHAVIOR def RunNode(self): #inputs stringIn = self.Params.stringIn.value #script out_list = [] def Add_Handle(obj): out_list.append(obj) vs.ForEachObject(Add_Handle,stringIn) wordTofind = "SEL=TRUE" searchInlist = stringIn searchInlist = searchInlist.replace(" ", "") if wordTofind.lower() in searchInlist.lower(): new_list = [] parents_list = [] for e in out_list: p = vs.GetParent(e) if vs.GetType(p) == 11 and p in out_list: parents_list.append(p) pass else: new_list.append(e) for g in parents_list: if g in new_list: new_list.remove(g) #outputs self.Params.obj.value = new_list else: #outputs self.Params.obj.value = out_list Edited August 3, 2018 by mattao 1 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.