asset_library_remove(index) doesn't remove given index #98448

Closed
opened 2022-05-27 17:06:46 +02:00 by Félix · 5 comments

System Information
Operating system: Linux-5.13.0-44-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06

Blender Version
Broken: version: 3.2.0 Beta, branch: master, commit date: 2022-05-26 13:12, hash: bf53956914
Worked: (newest version of Blender that worked as expected)

Short description of error
asset_library_remove(index) always remove bpy.context.preferences.filepaths.asset_libraries- [x] instead of given index.

Exact steps for others to reproduce the error

  • From scratch: make sure you have no any bpy.context.preferences.filepaths.asset_libraries
  • Execute following script:
import bpy

bpy.ops.preferences.asset_library_add(directory="/root/First")
bpy.ops.preferences.asset_library_add(directory="/root/Second")
bpy.ops.preferences.asset_library_add(directory="/root/Third")

index_second = bpy.context.preferences.filepaths.asset_libraries.find("Second")

bpy.ops.preferences.asset_library_remove(index_second)

print(bpy.context.preferences.filepaths.asset_libraries[0])
  • "First" asset library has been removed instead of "Second".
  • NB: you can try with "Third", it acts the same.
**System Information** Operating system: Linux-5.13.0-44-generic-x86_64-with-glibc2.31 64 Bits Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06 **Blender Version** Broken: version: 3.2.0 Beta, branch: master, commit date: 2022-05-26 13:12, hash: `bf53956914` Worked: (newest version of Blender that worked as expected) **Short description of error** `asset_library_remove(index)` always remove `bpy.context.preferences.filepaths.asset_libraries- [x]` instead of given `index`. **Exact steps for others to reproduce the error** - From scratch: make sure you have no any `bpy.context.preferences.filepaths.asset_libraries` - Execute following script: ``` import bpy bpy.ops.preferences.asset_library_add(directory="/root/First") bpy.ops.preferences.asset_library_add(directory="/root/Second") bpy.ops.preferences.asset_library_add(directory="/root/Third") index_second = bpy.context.preferences.filepaths.asset_libraries.find("Second") bpy.ops.preferences.asset_library_remove(index_second) print(bpy.context.preferences.filepaths.asset_libraries[0]) ``` - `"First"` asset library has been removed instead of `"Second"`. - *NB: you can try with `"Third", it acts the same.`*
Author

Added subscriber: @Miadim

Added subscriber: @Miadim

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'

I don't know much about the details, but for operators, you need to specify the parameter through a keyword.
So the correct way to call this operator would be bpy.ops.preferences.asset_library_remove(index=index_second)
I'm not sure where the index_second value went, or if there should be an error message for these cases, but I don't think it's a bug.

You can see more details on how to run an operator in this manual:
https://docs.blender.org/api/current/bpy.ops.html#keywords-and-positional-arguments

In case of more doubts you can contact the developers through these channels: https://wiki.blender.org/wiki/Communication/Contact#Contact_Developers

I don't know much about the details, but for operators, you need to specify the parameter through a keyword. So the correct way to call this operator would be `bpy.ops.preferences.asset_library_remove(index=index_second)` I'm not sure where the `index_second` value went, or if there should be an error message for these cases, but I don't think it's a bug. You can see more details on how to run an operator in this manual: https://docs.blender.org/api/current/bpy.ops.html#keywords-and-positional-arguments In case of more doubts you can contact the developers through these channels: https://wiki.blender.org/wiki/Communication/Contact#Contact_Developers
Author

You're right, I missed this keyword...

The strange thing is it still removes the first item of the list without any keyword instead of raising an error. The first argument is for overriding a context, which must be a dict. Passing an int should raise an error no?

You're right, I missed this keyword... The strange thing is it still removes the first item of the list without any keyword instead of raising an error. The first argument is for overriding a context, which must be a `dict`. Passing an `int` should raise an error no?
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#98448
No description provided.