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

Update it for 3.4+? #5

Open
BUGProtectionAssociation opened this issue Apr 10, 2023 · 6 comments
Open

Update it for 3.4+? #5

BUGProtectionAssociation opened this issue Apr 10, 2023 · 6 comments

Comments

@BUGProtectionAssociation
Copy link

BUGProtectionAssociation commented Apr 10, 2023

May too old...3.4 3.5 can't use as normal

`Traceback (most recent call last):
  File "G:\blender\35\3.5\scripts\modules\addon_utils.py", line 369, in enable
    mod.register()
  File "G:\blenderplus\3.0\addons\blender-lightfield-addon-main\__init__.py", line 130, in register
    bpy.utils.register_class(cls)
ValueError: register_class(...): already registered as a subclass 'LightfieldVisual'

image

@mcourteaux
Copy link
Contributor

Thanks for reporting this. I don't find immediately a fix, but I can confirm it still works in Blender 3.4.

@mavills
Copy link

mavills commented Apr 16, 2023

https://wiki.blender.org/wiki/Reference/Release_Notes/3.5/Python_API#Breaking_changes

Overriding of default operators appears to be unconventional and caused some problems when having registered a lot of overrides. They removed this functionality.

In addition to that, the error we see here is due to the class already being registed, but this is simply a consequence of the addon failing the first time. The error is different right after startup, and continues to show this one in subsequent tries.

  1. The workaround here is to customize the user's keymapping by looking up their keymap settings and copying those over to your addon ones (with the operator name changed ofcourse). Disable the default (user mapping) -> good to go.
    https://docs.blender.org/api/current/bpy.types.KeyConfigurations.html#bpy.types.KeyConfigurations

Not the cleanest, but does the trick.

Here, the default delete action is disabled (x) and I added (manually) our custom, renamed, delete action.
image
For code, see https://blender.stackexchange.com/questions/196483/create-keyboard-shortcut-for-an-operator-using-python

  1. Another option is to re-add the commented depgraph handler and check if the dependency graph updated the lightfield object, but this is probably pretty heavy performance wise.

Option 1 seems best and simplest here, don't see a reason not to go for it. do not forget to override both outliner and 3d view delete.

@mavills
Copy link

mavills commented Apr 16, 2023

I see that you can even override the default delete action in the preferences,
image

This way you do not have to mess with the users bindings! Just search through all keymaps for object.delete and outliner.delete, and change the respective KeyMap's action to your custom operator delete.

@3020
Copy link

3020 commented Aug 8, 2023

Any news or updates for 3.6?

@mavills
Copy link

mavills commented Aug 23, 2023

Unfortunately no, I am no longer active on this project. What would be your usecase? Maybe I can see if we can fix what you need/get you a head start in fixing it!

@stanthemaker
Copy link

I see that you can even override the default delete action in the preferences, image

This way you do not have to mess with the users bindings! Just search through all keymaps for object.delete and outliner.delete, and change the respective KeyMap's action to your custom operator delete.

Hi. I am using blender 4.0.2. I followed the instructions and overrode 4 keymaps delete settings in object mode, as well as 2 in outliner. However, it doesn't do the trick.
image
I have also looked up the source file (operator.py) and found an operator that looks relevant to your solution.
image
I am new to the blender, and I hope you can provide a more detailed solution.

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

5 participants