Jump to content
Developer Wiki and Function Reference Links ×

delete node with bool check wether delete or not?


Recommended Posts

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

Link to comment

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
 

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...