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

Startup safety - for nodes with side effects #144

Closed
ly29 opened this issue May 6, 2014 · 15 comments
Closed

Startup safety - for nodes with side effects #144

ly29 opened this issue May 6, 2014 · 15 comments

Comments

@ly29
Copy link
Collaborator

ly29 commented May 6, 2014

If a node access external data it must fail gracefully if the external data is not ready. Either by failing or using a cached state stored in a bpy.prop

Possible cause includes trying to acces bpy.data.node_groups which will fail during startup. In general most nodes should avoid bpy.ops and bpy.data. For many mesh operations bmesh provides all needed functionality and data exists independent for the blender scene.

This also makes for an easy quick safety fix.

        try:
            l=bpy.data.node_groups[self.id_data.name]
        except Exception as e:
            print(self.name, "cannot run during startup, press update.")
            return
@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

Exactly what works and what doesn't I don't know...
One solution is to turn off the auto start of sverchok

@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

I guess the general solution is to fail during load and have post load handler that triggers on the first update event.

@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

@zeffii
Let us try to resolve the startup issue with node groups in default file.

  • What nodes does your node groups contain, have in that start up file?

@zeffii
Copy link
Collaborator

zeffii commented May 6, 2014

I'm glad to see whatever you've done over the past 2 days has fixed that particular startup problem. So it won't reproduce anymore. Weird stuff enzyme is experiencing :( -- i'll stay out of that troubleshooting

@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

This is also a potential issue with script node. I guess the best solution is to defer update until the file is loaded and then do it. I want a better way to detect init than try to trigger an exception however.

@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

Good that the bug fixing of other issues resolved this one also.
Not good that we don't what it was or if really has been resolved.

enzyme is doing a heros work as our tester.

@zeffii
Copy link
Collaborator

zeffii commented May 6, 2014

yeah, wish enzyme would report errors/features here and successes on WIP thread tho

@ly29
Copy link
Collaborator Author

ly29 commented May 6, 2014

I think that is good idea, suggest it to him.

@ly29 ly29 closed this as completed May 7, 2014
@ly29 ly29 mentioned this issue May 7, 2014
18 tasks
@nortikin
Copy link
Owner

nortikin commented May 7, 2014

is it mean, that operators have to be replaced in viewers and oter nodes? With what?

@ly29
Copy link
Collaborator Author

ly29 commented May 8, 2014

No this doesn't affect operators.
Just that bpy.data and can't be be accessed during startup, since operator don't run during startup they work fine.

http://wiki.blender.org/index.php/Extensions:2.6/Py/API_Changes#Restricted_Context

@nortikin
Copy link
Owner

nortikin commented May 8, 2014

yes, about data i remember, thanks

@zeffii
Copy link
Collaborator

zeffii commented May 8, 2014

maybe an 'on_load' or 'on_reload' could take care of this further up the chain, if this solves it? The problem is a little vague in my mind.

@ly29
Copy link
Collaborator Author

ly29 commented May 8, 2014

I think I have good solution for this that doesn't require that ugly code, and that removes this problem from the nodes but for now just insert that right after update.

@ly29
Copy link
Collaborator Author

ly29 commented May 8, 2014

but yes an app handler is the right solution but for that to work we have to do whole rename all functions thing because update is called by blender...

@zeffii
Copy link
Collaborator

zeffii commented May 8, 2014

OK that code does indeed let the .blend load. Cool!

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

No branches or pull requests

3 participants