Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI : Apply user defaults to new Scripts. #1960

Merged
merged 2 commits into from Dec 22, 2016

Conversation

johnhaddon
Copy link
Member

This makes it easier to set defaults for frame range etc, using something like the following from a startup file :

Gaffer.Metadata.registerValue( Gaffer.ScriptNode, "frameRange.start", "userDefault", 1001 )
Gaffer.Metadata.registerValue( Gaffer.ScriptNode, "frameRange.end", "userDefault", 2000 )

scriptNode = Gaffer.ScriptNode()
Gaffer.NodeAlgo.applyUserDefaults( scriptNode )
self.root()["scripts"].addChild( scriptNode )
del scriptNode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to del scriptNode here, but not in FileMenu.new()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I have to admit I put it there out of superstition after seeing the existing del just above it in the same file. I've now got to the bottom of why that was there, and removed it in 1f9248c - there's some further explanation in the commit message.

This makes it easier to set defaults for frame range etc, using something like the following from a startup file :

```
Gaffer.Metadata.registerValue( Gaffer.ScriptNode, "frameRange.start", "userDefault", 1001 )
Gaffer.Metadata.registerValue( Gaffer.ScriptNode, "frameRange.end", "userDefault", 2000 )
```
This should have been removed in 45a0ff5. Prior to that commit, the `_run()` method performed a check that all ScriptNodes had been destroyed before shutdown, and it was therefore necessary to explicitly drop the reference held by the local `scriptNode` variable. Following that commit, the checks are performed after `_run()` returns, after the `scriptNode` variable has left scope anyway.
@andrewkaufman andrewkaufman merged commit 6c7cc0c into GafferHQ:master Dec 22, 2016
@johnhaddon johnhaddon deleted the scriptNodeDefaults branch January 12, 2017 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants