Skip to content

Commit

Permalink
New version release
Browse files Browse the repository at this point in the history
  • Loading branch information
chsh2 committed Apr 28, 2023
1 parent 969bbe9 commit 1e5ee2a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In **Draw**, **Edit** and **Sculpt** modes of a Grease Pencil object, a group of

Some of the operations are demonstrated in the following videos:

https://www.youtube.com/watch?v=xRzwWkjkBUY
https://www.youtube.com/playlist?list=PLEgTVZ2uBvPMM0sGzzQTyoV0or8_PTs6t

https://www.bilibili.com/video/bv1tg411C77g

Expand All @@ -64,6 +64,9 @@ NijiGPen provides with the following functions:
- Paste SVG Shapes: extend the built-in SVG module with clipboard reading and hole detection
- Paste XML Palette: convert XML codes from services such as Adobe Color to a Blender palette
- Raster Image Tracing: line art and multi-color support
- ABR/GBR Brushes: extract textures of GIMP/Adobe Photoshop brushes
- Export
- Render PSD: keep layer structure and blending modes
- UI
- A group of shortcut buttons for better touchscreen control

Expand Down
5 changes: 4 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Blender 3.3以上版本

演示视频:

https://www.youtube.com/watch?v=xRzwWkjkBUY
https://www.youtube.com/playlist?list=PLEgTVZ2uBvPMM0sGzzQTyoV0or8_PTs6t

https://www.bilibili.com/video/bv1tg411C77g

Expand All @@ -67,6 +67,9 @@ https://www.bilibili.com/video/bv1tg411C77g
- 从剪贴板粘贴XML色卡:将Adobe Color等工具生成的XML格式色卡或Hex代码转换为Blender调色板
- 从剪贴板粘贴SVG代码:在Blender自带SVG模块的基础上增加了检测孔洞的功能
- 图片转换为矢量图:在Blender自带模块的基础上增加了线稿导入与彩色图片导入
- GBR/ABR笔刷:提取GIMP/Adobe Photoshop笔刷中的贴图并转为Blender可用的格式
- 导出
- 渲染为PSD:保持图层结构与混合模式

其它功能将陆续添加。

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author" : "https://github.com/chsh2/nijiGPen",
"description" : "Tools modifying Grease Pencil strokes in a 2D plane",
"blender" : (3, 3, 0),
"version" : (0, 4, 1),
"version" : (0, 4, 2),
"location" : "View3D > Sidebar > NijiGP, in Draw and Edit mode of Grease Pencil objects",
"warning" : "This addon is still in an early stage of development",
"category" : "Object"
Expand Down
10 changes: 3 additions & 7 deletions operators/operator_io_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,7 @@ def get_info(v, u):
kdt = kdtree.KDTree(2*len(segments))
tip_info, tip_map = [], {}
for i,seg in enumerate(segments):
if len(seg)==1:
kdt.insert((seg[0][0], seg[0][1], 0), len(tip_info))
tip_info.append(( (seg[0][0], seg[0][1]), Vector((0, 0, 0))))
tip_map[(seg[0][0], seg[0][1])] = i
else:
if len(seg) > 1:
tip_length = int(max(1, len(seg)*tip_factor))
start_point_co = Vector((seg[0][0], seg[0][1], 0))
start_direction = start_point_co - Vector((seg[tip_length][0], seg[tip_length][1], 0))
Expand All @@ -232,7 +228,7 @@ def get_info(v, u):
joint_info = []
tip_pair_set = set()
for i,tip1 in enumerate(tip_info):
candidates = kdt.find_range((tip1[0][0],tip1[0][1],0), max(dist_mat[tip1[0]],1) )
candidates = kdt.find_range((tip1[0][0],tip1[0][1],0), max(dist_mat[tip1[0]], 1.5) )
for candidate in candidates:
tip2 = tip_info[candidate[1]]
if tip1[0]!=tip2[0] and (tip1[0], tip2[0]) not in tip_pair_set and (tip2[0], tip1[0]) not in tip_pair_set:
Expand Down Expand Up @@ -278,7 +274,7 @@ def get_info(v, u):
if len(line) < self.min_length:
continue
point_count = len(line) // self.sample_length
if len(line)%self.sample_length != 1:
if self.sample_length > 1 and len(line)%self.sample_length != 1:
point_count += 1

frame_strokes.new()
Expand Down
5 changes: 4 additions & 1 deletion operators/operator_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def distance_to_another_stroke(co_list1, co_list2, kdt2 = None, angular_toleranc
contact_idx1 = min(contact_idx1, n1-2)
direction1 = Vector(co_list1[contact_idx1+1]) - Vector(co_list1[contact_idx1])
direction2 = Vector(co_list2[contact_idx2+1]) - Vector(co_list2[contact_idx2])
angle_diff = direction1.angle(direction2)
if math.isclose(direction1.length, 0) or math.isclose(direction2.length, 0):
angle_diff = 0
else:
angle_diff = direction1.angle(direction2)

# Three cases of directions: similar, opposite or different
end2 = n2-1
Expand Down

0 comments on commit 1e5ee2a

Please sign in to comment.