Brushstroke Tools: Initial Version #328
Binary file not shown.
@ -131,6 +131,9 @@ def set_brush_style(self, value):
|
||||
ng_name = f'BSBST-brushstroke.{value}'
|
||||
ng = utils.ensure_node_group(ng_name, [bs for bs in addon_prefs.brush_styles if bs.name==value][0].filepath)
|
||||
|
||||
#if ng.preview:
|
||||
# utils.set_preview(ng.preview.image_pixels_float)
|
||||
|
||||
self.node_tree.nodes['Brush Style'].node_tree = ng
|
||||
self["brush_style"] = value
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import os, ast
|
||||
import bpy
|
||||
from bpy.app.handlers import persistent
|
||||
import math, shutil, errno
|
||||
import math, shutil, errno, numpy
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
addon_version = (0,0,0)
|
||||
@ -528,6 +528,16 @@ def round_n(val, n):
|
||||
"""
|
||||
return round(val, n-int(math.floor(math.log10(abs(val))))-1)
|
||||
|
||||
def set_preview(pixels):
|
||||
if not pixels:
|
||||
return
|
||||
preview_name = '.BSBST-preview'
|
||||
preview_img = bpy.data.images.get(preview_name)
|
||||
if not preview_img:
|
||||
preview_img = bpy.data.images.new(preview_name, width=256, height=256, float_buffer=True, is_data=True)
|
||||
|
||||
preview_img.pixels.foreach_set(pixels)
|
||||
|
||||
def register():
|
||||
bpy.app.handlers.depsgraph_update_post.append(refresh_preset)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user