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

Use postprocessing scripts without copying them #1

Closed
fieldOfView opened this issue Jan 18, 2021 · 10 comments
Closed

Use postprocessing scripts without copying them #1

fieldOfView opened this issue Jan 18, 2021 · 10 comments
Labels
Status : Fixed/Solved Issue fixed or solved Type : Cura upstream Issue due to Cura bug/limitation

Comments

@fieldOfView
Copy link

It should be possible to use your postprocessing scripts without first having to copy them over and restart Cura. Cura should be able to find the scripts from inside your plugin folder if you move your scripts folder to into a folder named resources, and add this to your plugin initialisation:

Resources.addSearchPath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources"))

This will add that resources folder to the paths Cura checks for script files.

@5axes
Copy link
Owner

5axes commented Jan 18, 2021

Unfortunatly no it doesn't work. Your solution is correct but as the PostProcessingPlugin is launched before my custom plugin, even if the code is correct the scripts are not loaded byt the PostProcessingPlugin via the function : def loadScripts(self, path: str) -> None:

2021-01-18 14:36:53,431 - INFO - [MainThread] UM.Logger.info [122]: Loaded plugin PostProcessingPlugin
...
2021-01-18 14:36:54,382 - INFO - [MainThread] UM.Logger.info [122]: Loaded plugin SimpleShapes

@fieldOfView
Copy link
Author

It doesn't work, but that is not because the PostProcessingPlugin loads before your plugin, but because the PostProcessingPlugin does not use the resource search paths correctly :-(

https://github.com/Ultimaker/Cura/blob/4.8/plugins/PostProcessingPlugin/PostProcessingPlugin.py#L145
Instead of using getStoragePath, it should be using getAllPathsForType. Oh well, it was worth the try.

@nallath
Copy link

nallath commented Jan 19, 2021

Whoops, that's our bad :(

@fieldOfView
Copy link
Author

@fieldOfView
Copy link
Author

Here's a fix: Ultimaker/Cura#9147

@nallath
Copy link

nallath commented Jan 19, 2021

It just might be my bad ;-)

nallath/PostProcessingPlugin@12d4d17#diff-29915b71ed69033c978493b7def0019f64e3064ac80c4ab127d74ac5d3c3628bR159

Well, we were still paying you at that time, so it's our fault :P

@fieldOfView
Copy link
Author

Nope, this was a year and 2 days after my last day on the team... But it was your fault for not spotting it in the review ofcourse. It is always your fault.

@nallath
Copy link

nallath commented Jan 19, 2021

It is always your fault.

Damn right! :D

@5axes 5axes added the Type : Cura upstream Issue due to Cura bug/limitation label Jan 28, 2021
@nallath
Copy link

nallath commented Feb 12, 2021

I just merged the PR.

@5axes
Copy link
Owner

5axes commented Jun 2, 2021

Ok I have modified the source code V1.3.0. Don't need to use the Copy scripts function anymore. Have been removed from the menu thanks for your help @nallath and @fieldOfView

@5axes 5axes closed this as completed Jun 2, 2021
@5axes 5axes added the Status : Fixed/Solved Issue fixed or solved label Jun 2, 2021
5axes added a commit that referenced this issue Jun 2, 2021
Solved #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status : Fixed/Solved Issue fixed or solved Type : Cura upstream Issue due to Cura bug/limitation
Projects
None yet
Development

No branches or pull requests

3 participants