KingChaos Posted July 8, 2024 Share Posted July 8, 2024 hi there, chatGPT is not able to give me (not a programmer) a working code of the delete node, with an additional boolean input that decides wether to delete or not. is that possible in general or does this somehow not work in this way? BR KC Quote Link to comment
KingChaos Posted July 8, 2024 Author Share Posted July 8, 2024 this told me CHATgpt @Marionette.NodeDefinition class Params(metaclass=Marionette.OrderedClass): # APPEARANCE # Name this = Marionette.Node('Delete') this.SetDescription( 'Deletes an object if the condition is met.\nNote: Objects to be deleted are saved in a list and are deleted at the end of the network execution. So, there is no risk of referencing an object that no longer exists' ) # Input Ports obj = Marionette.PortIn(vs.Handle(0), 'hObj') obj.SetDescription('The object to delete') delete_flag = Marionette.PortIn(False, 'DeleteFlag') delete_flag.SetDescription('Boolean flag to decide whether to delete the object or not') # OIP Controls # Output Ports # BEHAVIOR def RunNode(self): # inputs obj = self.Params.obj.value delete_flag = self.Params.delete_flag.value # script if delete_flag: vs.Marionette_DisposeObj(obj) # outputs Quote Link to comment
FranAJA Posted July 30, 2024 Share Posted July 30, 2024 (edited) Just wondering why you do not use a IF node rather than modifying an existing node. Edited July 30, 2024 by FranAJA typos 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.