Skip to content

Commit

Permalink
Merge pull request #24 from atticus-lv/feat-tool
Browse files Browse the repository at this point in the history
Feat tool
  • Loading branch information
atticus-lv authored Jul 12, 2024
2 parents 600427b + 52aea53 commit 745b3e5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
37 changes: 35 additions & 2 deletions bl_operator/op_icon_viewer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bpy
import re
from bpy.props import StringProperty
from .functions import get_icons, has_edit_tree, is_valid_workspace_tool
from .functions import get_icons, has_edit_tree, is_valid_workspace_tool, get_edit_tree_gp_data

ICONS = []

Expand Down Expand Up @@ -45,7 +45,6 @@ def draw(self, context):
layout = self.layout
filter: str = context.window_manager.est_gp_icon_filter


col = layout.box().column(align=True)
gird = col.grid_flow(row_major=True, columns=8, even_columns=True, even_rows=True, align=True)
for icon in ICONS:
Expand All @@ -54,11 +53,45 @@ def draw(self, context):
gird.operator("est.set_icon", text='', icon=icon, emboss=False).icon = icon


class EST_PT_active_layer(bpy.types.Panel):
bl_idname = "EST_PT_active_layer"
bl_label = ""
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_category = "Tool"
bl_options = {'HEADER_LAYOUT_EXPAND'}

@classmethod
def poll(cls, context):
return has_edit_tree(context) and is_valid_workspace_tool(context) and get_edit_tree_gp_data(context)

def draw_header(self, context):
layout = self.layout
layer_name = get_edit_tree_gp_data(context).layers.active.info
layout.label(text=layer_name, icon='GP_SELECT_STROKES')

def draw(self, context):
layout = self.layout
layout.use_property_split = True
gp_data = get_edit_tree_gp_data(context)

if not gp_data.layers: return
col = layout.column(align=True)
layer = gp_data.layers.active

if not layer: return
col.prop(layer, "color", text="Color")
col.prop(layer, "thickness", text="Thickness")
col.prop(layer, "annotation_opacity", text="Opacity")


def register():
bpy.utils.register_class(EST_OT_set_icon)
bpy.utils.register_class(EST_PT_icon_viewer)
bpy.utils.register_class(EST_PT_active_layer)


def unregister():
bpy.utils.unregister_class(EST_OT_set_icon)
bpy.utils.unregister_class(EST_PT_icon_viewer)
bpy.utils.unregister_class(EST_PT_active_layer)
2 changes: 1 addition & 1 deletion bl_operator/ops_gp_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def execute(self, context: bpy.types.Context):
icon_obj = load_icon_svg(self.icon)
if not icon_obj: return {'CANCELLED'}
font_gp_data = CreateGreasePencilData.from_gp_obj(icon_obj, self.size, euler=ShootAngles.FRONT)

CreateGreasePencilData.del_later(icon_obj)
if not font_gp_data: return {'CANCELLED'}

color = context.scene.est_palette_group.palette.colors.active.color
Expand Down
2 changes: 1 addition & 1 deletion bl_workspace_tool/tool_gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def draw_settings(self, layout, tool):
box.template_palette(scene.est_palette_group, "palette", color=True)

box = layout.box()
box.label(text="New")
box.label(text="New", icon='ADD')
row = box.row()
row.prop(scene, "est_gp_add_type", text='Source', expand=True)
box.prop(scene, "est_gp_size")
Expand Down

0 comments on commit 745b3e5

Please sign in to comment.