Skip to content

Can't enable Preview for a node from Python #710

Closed

Description

@bonalex01dev

Natron 2.4.1 win10

when I run:
myknob = currentNode.getParam('enablePreview')
myknob.setValue(True)
print 'testtrue'
currentNode.refreshUserParamsGUI()

Expected:
preview should appear in graph. Actually only checbox change in the properties

Notes:

  • the same script for "disableNode" works ( big cross over node is drawn in graph)
  • the preview appear as soon as I MANUALLY change any knob value in the properties

Some refresh code that is run in the UI should be executed from the python backend ?

Activity

  1. devernay commented on Nov 27, 2021

    @devernay
    Member

    Here:

    if ( (reason == eValueChangedReasonUserEdited) || (reason == eValueChangedReasonSlaveRefresh) ) {

    It seems like we should have to add eValueChangedReasonNatronInternalEdited to trigger the update when set from Python. Can someone else confirm this is a good solution? @YakoYakoYokuYoku @rodlie? I can't think of a case where this would hurt

    eValueChangedReasonSlaveRefresh was added in this commit:
    f2664a2#r60978102

  2. added this to the 2.4 milestone on Nov 27, 2021
  3. changed the title [-]Bug: can't enble Preview for a node with python[/-] [+]Can't enable Preview for a node from Python[/+] on Nov 28, 2021
  4. YakoYakoYokuYoku commented on Nov 30, 2021

    @YakoYakoYokuYoku
    Member

    Could apply the change locally, although I don't know how to replicate the issue yet neither running that Python snippet, whether the script code is invoked via cli, the Python tab or elsewhere.

  5. YakoYakoYokuYoku commented on Dec 6, 2021

    @YakoYakoYokuYoku
    Member

    @devernay, managed to wrap around my mind, could replicate the issue and proved that your code was right.
    Simply added a colorwheel and then run the sample Python snippet with some tweaks in a script editor tab. First try didn't work due to previewKnobToggled not being emitted as expected. Then applied the suggested change. And last try went successfully plus I could see a pixelated yet tiny color wheel on the node.
    AFAICT I don't see any case that this would in fact hurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions