Add collada_import routine to Python API that is usable from batch mode #33157
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#33157
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%I recently wanted to do batch conversion of Collada files to .blend files. However, the existing bpy.ops.wm.collada_import operator is unusable from batch mode: it fails with “RuntimeError: Operator bpy.ops.wm.collada_import.poll() failed, context is incorrect” when you try invoking it from a script.
Therefore, I came up with the enclosed patch, which adds a bpy.utils.collada_import routine that doesn’t try to do any UI of its own, it just imports the file specified.
I had to make some minor changes to the definitions of the args passed to the collada_import/export routines, because I couldn’t figure out where the “Scene” typedef was defined, so I just used “struct Scene” instead.%%%
Changed status to: 'Open'
Added subscriber: @Sergey
I think operator itself could be changed in a way to be usable for the batch import/export by just using some default values for whatever setting it expects to be pulled form the context. Or, alternatively, if they're really crucial for operator thy can be properties initialzied form context on operator invoke().
The issue with your approach is that it adds rather specific function to rather generic module.
Changed status from 'Open' to: 'Archived'
No activity in quite some time now and current state of the patch can not be accepted. But if it is changed to use operator properties instead it'll be all fine.