Missing documentation for image_user parameter in template_image #105215

Closed
opened 2023-02-26 06:10:27 +01:00 by Harry McKenzie · 2 comments

System Information
Operating system: N/A
Graphics card: N/A

Blender Version
Broken: N/A
Worked: N/A

Short description of error
Missing documentation for image_user parameter in template_image in https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.template_image

This documentation is crucial because we don't know what is to be passed as ImageUser. There was a question on Blender Stack Exchange asking the same thing: https://blender.stackexchange.com/questions/287185/what-should-be-the-value-of-image-user-in-template-user#287185

For example in this code, we wouldn't know what to pass as image_user

import bpy

class SetImageOperator(bpy.types.Operator):
    bl_idname = "my.set_image"
    bl_label = "Set Image"

    image_name: bpy.props.StringProperty()

    def execute(self, context):
        prop_group = context.scene.prop
        prop_group.image = bpy.data.images.get(self.image_name)
        return {'FINISHED'}

class MyPanel(bpy.types.Panel):
    bl_idname = "MY_PT_panel"
    bl_label = "My Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def __init__(self):
        bpy.ops.my.set_image(image_name="Untitled")

    def draw(self, context):
        layout = self.layout
        prop_group = context.scene.prop
        row = layout.row()
        #==================================================
        image_user = ??? # What do you pass here???
        row.template_image(prop_group, "image", image_user)
        #==================================================

class Prop(bpy.types.PropertyGroup):
    image : bpy.props.PointerProperty(type=bpy.types.Image)

def register():
    bpy.utils.register_class(MyPanel)
    bpy.utils.register_class(Prop)
    bpy.utils.register_class(SetImageOperator)
    bpy.types.Scene.prop = bpy.props.PointerProperty(type=Prop)

def unregister():
    del bpy.types.Scene.prop
    bpy.utils.unregister_class(SetImageOperator)
    bpy.utils.unregister_class(Prop)
    bpy.utils.unregister_class(MyPanel)

if __name__ == "__main__":
    register()
**System Information** Operating system: N/A Graphics card: N/A **Blender Version** Broken: N/A Worked: N/A **Short description of error** Missing documentation for `image_user` parameter in `template_image` in https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.template_image This documentation is crucial because we don't know what is to be passed as `ImageUser`. There was a question on Blender Stack Exchange asking the same thing: https://blender.stackexchange.com/questions/287185/what-should-be-the-value-of-image-user-in-template-user#287185 For example in this code, we wouldn't know what to pass as image_user ``` import bpy class SetImageOperator(bpy.types.Operator): bl_idname = "my.set_image" bl_label = "Set Image" image_name: bpy.props.StringProperty() def execute(self, context): prop_group = context.scene.prop prop_group.image = bpy.data.images.get(self.image_name) return {'FINISHED'} class MyPanel(bpy.types.Panel): bl_idname = "MY_PT_panel" bl_label = "My Panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" def __init__(self): bpy.ops.my.set_image(image_name="Untitled") def draw(self, context): layout = self.layout prop_group = context.scene.prop row = layout.row() #================================================== image_user = ??? # What do you pass here??? row.template_image(prop_group, "image", image_user) #================================================== class Prop(bpy.types.PropertyGroup): image : bpy.props.PointerProperty(type=bpy.types.Image) def register(): bpy.utils.register_class(MyPanel) bpy.utils.register_class(Prop) bpy.utils.register_class(SetImageOperator) bpy.types.Scene.prop = bpy.props.PointerProperty(type=Prop) def unregister(): del bpy.types.Scene.prop bpy.utils.unregister_class(SetImageOperator) bpy.utils.unregister_class(Prop) bpy.utils.unregister_class(MyPanel) if __name__ == "__main__": register() ```
Harry McKenzie added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-02-26 06:10:28 +01:00
Iliya Katushenock added the
Interest
Development Management
Interest
Python API
labels 2023-02-26 09:49:24 +01:00

Please note to report documentation issues in the Documentation repository https://projects.blender.org/blender/documentation

you can move it there

Please note to report documentation issues in the Documentation repository https://projects.blender.org/blender/documentation you can move it there

From what I can see, image_user can be any of these members:
https://docs.blender.org/api/current/search.html?q=image_user&check_keywords=yes&area=default

In fact many parameters in the API are without documentation.

Some of them can be understandable not having documentation (they are very obvious).

But the fact of not having documentation is not considered a bug (as it would require manual work to add support for each one that is missing).

If you intend to improve the documentation, we suggest creating a Pull Request:
https://wiki.blender.org/wiki/Process/Contributing_Code

For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

From what I can see, `image_user` can be any of these members: https://docs.blender.org/api/current/search.html?q=image_user&check_keywords=yes&area=default In fact many parameters in the API are without documentation. Some of them can be understandable not having documentation (they are very obvious). But the fact of not having documentation is not considered a bug (as it would require manual work to add support for each one that is missing). If you intend to improve the documentation, we suggest creating a Pull Request: https://wiki.blender.org/wiki/Process/Contributing_Code For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2023-03-02 16:24:46 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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
3 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#105215
No description provided.