Completions: fix Blender completions when it prints to stderr

Some of the completions recently introduced called Blender itself to query some
arguments, and Blender sometimes prints messages to stderr. This output was not
filtered, resulting in the shell printing irrelevant messages during completion.
This commit is contained in:
Damien Picard 2024-01-03 11:49:29 +01:00 committed by Fabian Boehm
parent a36ff7d143
commit 4f3e7ddef0

View file

@ -16,25 +16,25 @@ end
function __blender_list_scenes function __blender_list_scenes
blender --background (__blender_echo_input_file_name) --python-expr 'import bpy blender --background (__blender_echo_input_file_name) --python-expr 'import bpy
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
print(f"\t{scene.name}")' | print(f"\t{scene.name}")' 2>/dev/null |
string replace -r -f '^\t' '' string replace -r -f '^\t' ''
end end
function __blender_list_texts function __blender_list_texts
blender --background (__blender_echo_input_file_name) --python-expr 'import bpy blender --background (__blender_echo_input_file_name) --python-expr 'import bpy
for text in bpy.data.texts: for text in bpy.data.texts:
print(f"\t{text.name}")' | print(f"\t{text.name}")' 2>/dev/null |
string replace -r -f '^\t' '' string replace -r -f '^\t' ''
end end
function __blender_list_engines function __blender_list_engines
blender --background --engine help | string replace -r -f '^\t' '' blender --background --engine help 2>/dev/null | string replace -r -f '^\t' ''
end end
function __blender_list_addons function __blender_list_addons
blender --background --python-expr 'import addon_utils blender --background --python-expr 'import addon_utils
for mod in addon_utils.modules(): for mod in addon_utils.modules():
print(f"\t{mod.__name__}")' | print(f"\t{mod.__name__}")' 2>/dev/null |
string replace -r -f '^\t' '' string replace -r -f '^\t' ''
end end