Make Materials Library Read Only

We have a laser that serval people can access and we are running into the issue that they are accidently changing the material library when they are trying to change the layer settings. Is there a way to lock the Library so no one change change it? Maybe lock it with a PIN?

I don’t believe there’s any way to do this within LightBurn.

However, you may be able to prevent writing changes to the file at the OS level.

Go to File Explorer in Windows and locate the material library. Right-click the file and go to Properties. Enable the “Read-only” attribute for that file. That should prevent any changes to that file.

I’ve done a quick POC and it seems to work but not sure if there would be any side effects not seen immediately.

So I tried what you said it It is still changing the files however it shows an error saying “The Library failed to save” but then it saves it. So is there anything else I can try?

Did you actually confirm that the file has changed? I don’t think it does.

However, it seems the UI in LightBurn reflects the change so is out of sync with the file but the library contents are preserved.

LightBurn will then keep complaining about not being able to save. Restarting LightBurn restores the unmodified library.

I had exactly the same thought when I read the initial post. However, when I tried it LB totally ignored the fact that the file was read-only and overwrote the file with the new settings. It also disabled the read-only flag on the file. I keep my libraries and settings on a file share on my NAS but I wouldn’t expect that to make any difference.

Interesting. I wasn’t able to get the file to be overwritten at all. And I couldn’t load a different library because it kept complaining of not being able to save the file. Restarting LightBurn put it back right and with no changes to the Library.

In any case, maybe not the best solution.

I used local storage so definitely a potential variable.

Very odd indeed.

I thought I’d perform a test with a local library file. It still saved the changes but what it did was add a .old extension and save a new copy.

You can see that the Read-only attribute was retained for the renamed original file.

BTW, I don’t get any errors such as @ACSlaser is experiencing.

I was writing a response asking about steps to reproduce. Then tried again to get you the error message that you weren’t getting.

Somehow I was able to get the exact behavior as you. .old file created.

Tried it again and now can get the error message. Not sure exactly what’s going on.

Here’s the error message when the file isn’t saved:
image

Yes, I can confirm that behaviour. The second change I make elicits the same error. I must admit I did wonder whether a second edit would do this. I expect it’s because LB can’t delete the original file (now with the .old extension) because of the Read-only attribute. If I delete the .old file LB will now save the next change. I have also noticed that if I don’t set the Read-only attribute then the .old file doesn’t get created (well, it probably does but very briefly).

Anyway, it’s obviously not a solution to @ACSlaser’s issue.

Not certain but I don’t think that’s the primary issue since I’m almost certain I got this error on my very first test.

Agreed. Not nearly predictable enough. Shelve this one.

Any other method do you have in mind?

:+1:
This stupid 10 character minimum is a nuisance!

Can’t really think of one. Maybe we can take a step back and rethink the problem.

What is your actual goal in doing this? If it’s only in preserving a pristine version of the library then perhaps you don’t bother trying to prevent changes. Maybe you set something up that recovers a fresh version of a pristine copy on a regular interval. Perhaps daily, or every login, or at restart of LightBurn.

A workable answer will depend on the actual constraints and the scale of the problem you’re trying to solve for.

My thoughts exactly. It could be something as simple as a batch file that can be run manually or triggered by a specific event set up in Windows Task Scheduler.

So that is a start but how would we save new materials to the library? We want to be able to save new materials as well as keep the ones that are default.

I assume this would only be done by sanctioned “power users” or administrator, correct? If so, those people can update directly to the pristine copy that will then get propagated to the working copy.

So nobody should be working directly in the pristine copy.

The LightBurn ‘Material Library’ has a little know option that might be helpful in this case.

Entry Thickness=“3.0000” Locked=“1” Desc=“Line”

Adding the Locked=“1” property to any entry in the material library will lock it. You can continue to add new entries to the library, but not edit the locked entries. :slight_smile:

Would this work for your requirements?

2 Likes

Very clever LightBurn team…

Just tested this and can confirm that it indeed prevents changes. Makes it a little difficult to see the current settings as basically it prevents the editor from coming up.

Doesn’t prevent new adds which may or may not be desired.

Example. Note that the “locked” entry has a shaded background.
image

Was responding to this request. :slight_smile:

Yes Adding Locked=“1” in front of each entry using notepad++ locks that material from being edited and still able to assign and use it. I am still able to make new material too. Thank you for the help

1 Like