Mechanical Blender - Fork https://mechanicalblender.org
Go to file
Jaume Bellet 217992d312 modified README.md 2023-11-28 06:50:38 +01:00
.gitea Gitea: add note that developers must opt-out of inclusion in AUTHORS 2023-08-18 09:23:43 +10:00
.github Docs: change Git URLs to point projects.blender.org instead of git.blender.org 2023-02-07 14:23:05 +01:00
build_files CMake: Allow building with system Vulkan and ShaderC 2023-11-10 18:10:41 +01:00
doc Merge branch 'blender-v4.0-release' 2023-11-01 10:33:27 +02:00
extern Merge branch 'blender-v4.0-release' 2023-10-31 18:17:46 +01:00
intern Merge branch 'blender-v4.0-release' 2023-11-10 09:19:03 +01:00
locale I18N: Updated translations from git/weblate repository. 2023-11-06 13:09:17 +01:00
mblender files moved to utils 2023-11-20 19:14:10 +01:00
release Merge branch 'blender-v4.0-release' 2023-11-08 14:59:16 +01:00
scripts applied mb-0014 2023-11-19 11:08:58 +01:00
source added ID file 2023-11-19 19:35:52 +01:00
tests Build: correct package name & code-comment for WESTON in lib/ 2023-11-09 14:57:09 +11:00
tools Cleanup: spelling in comments 2023-11-09 09:54:28 +11:00
.clang-format clang-format: set BraceWrapping::AfterControlStatement to "MultiLine" 2023-05-02 09:37:08 +10:00
.clang-tidy Clang-tidy: Ignore variable name length and .c/.cc include warnings 2022-05-06 15:26:54 +02:00
.editorconfig pyproject: add configuration for autopep8 2022-04-22 10:13:39 +10:00
.git-blame-ignore-revs Cleanup: add commit to .git-blame-ignore-revs 2023-05-03 20:31:11 +10:00
.gitignore Ignore build files for VS and VS Code 2023-03-07 17:38:34 +01:00
AUTHORS AUTHORS: add 3 new developers 2023-11-02 16:09:11 +11:00
CMakeLists.txt Tests: add WIITH_TESTS_BATCHED option to execute Blender once per test 2023-11-08 18:41:33 +01:00
COPYING == docs == 2010-10-13 14:44:22 +00:00
GNUmakefile Makefile: remove redundant directory changing 2023-09-29 16:44:31 +10:00
README.md modified README.md 2023-11-28 06:50:38 +01:00
make.bat Windows: Propagate errors in make.bat 2023-08-16 19:29:47 +02:00
pyproject.toml pyproject: remove tools/pyproject.toml 2023-03-01 22:18:28 +11:00

README.md

Mechanical Blender

Allows to show an image loaded using bpy.utils.images on UI.

This branch includes the changes on MB-0014-bpy-images branch

The images loaded using bpy.utils.images can be shown on ui using the template_image_ui layout function.

Example Python Script

import os
import bpy
import bpy.utils.images

img = None

class PreviewsExamplePanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Image Example Panel"
    bl_idname = "OBJECT_PT_previews"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        row = self.layout.row()
        row.template_image_ui(image_value = img['id'], scale= 1)

def register():
    global img

    # Set path to an existing file        
    path = os.path.join(os.path.dirname(bpy.app.binary_path), 'image.png')
    img = bpy.utils.images.load('my_image', path)

    bpy.utils.register_class(PreviewsExamplePanel)

def unregister():
    global img
    bpy.utils.unregister_class(PreviewsExamplePanel)
    bpy.utils.images.release(img['id'])   

if __name__ == "__main__":
    register()

More info on project's website