Skip to content

Commit

Permalink
Blender3.0対応
Browse files Browse the repository at this point in the history
・face_splitの引数名を与えるように
・2DViewでも右クリックによるViewのパンを行うように
  • Loading branch information
sakana3 committed Dec 5, 2021
1 parent 5160163 commit 53ffc12
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Addons/PolyQuilt/QMesh/QMeshOperators.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,13 @@ def face_split( self , face , v0 , v1 , coords = () , use_exist=True, example=No
if (mirror_v0 == v0 and mirror_v1 == v1) or (mirror_v0 == v1 and mirror_v1 == v0) :
pass
else :
new_face , new_edge = bmesh.utils.face_split( mirror_face , mirror_v0 , mirror_v1 , coords , use_exist )
new_face , new_edge = bmesh.utils.face_split( mirror_face , mirror_v0 , mirror_v1 , coords = coords , use_exist = use_exist )
if (v0 not in face.verts or v1 not in face.verts ) and (v0 not in new_face.verts or v1 not in new_face.verts ):
return
if v0 in new_face.verts and v1 in new_face.verts :
return bmesh.utils.face_split( new_face , v0 , v1 )

return bmesh.utils.face_split( face , v0 , v1 , coords , use_exist )
return bmesh.utils.face_split( face , v0 , v1 , coords = coords , use_exist = use_exist )

def __calc_split_fac( self , edge , refPos ) :
fac = 0.5
Expand Down
21 changes: 19 additions & 2 deletions Addons/PolyQuilt/pq_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,19 @@ class PQ_OT_SetupUnityLikeKeymap(bpy.types.Operator) :

def execute(self, context):
for keymap in context.window_manager.keyconfigs.user.keymaps:
if keymap.space_type == 'EMPTY':
# print( keymap.name + "----" + keymap.space_type )
if keymap.space_type == 'EMPTY' or keymap.space_type == 'NODE_EDITOR' or keymap.space_type == 'IMAGE_EDITOR' :
# Add View2D RMB pan
if keymap.name == 'Image' :
PQ_OT_SetupUnityLikeKeymap.AddKeyToKeyMap( keymap , 'image.view_pan', 'MOUSE' , 'RIGHTMOUSE' , 'CLICK_DRAG' )
if keymap.name == "View2D" :
PQ_OT_SetupUnityLikeKeymap.AddKeyToKeyMap( keymap , 'view2d.pan', 'MOUSE' , 'RIGHTMOUSE' , 'CLICK_DRAG' )

for key in keymap.keymap_items:
if True not in [ key.any , key.alt , key.ctrl ,key.shift ]:
if key.map_type == 'MOUSE' and key.type == 'RIGHTMOUSE' :
if key.map_type == 'MOUSE' and key.type == 'RIGHTMOUSE' and key.value != 'CLICK_DRAG' :
key.value = 'CLICK'

for keymap in context.window_manager.keyconfigs.user.keymaps:
if keymap.space_type == 'VIEW_3D':
for key in keymap.keymap_items:
Expand All @@ -432,3 +440,12 @@ def execute(self, context):
key.shift = False

return {'FINISHED'}

def AddKeyToKeyMap( keymap , idname ,map_type, type , value , any=False, shift=0, ctrl=0, alt=0, oskey=0, key_modifier='NONE', repeat=False, head=False) :
for key in keymap.keymap_items:
if key.idname == idname and key.map_type == map_type and key.type ==type and key.value == value and key.any == any and key.alt == alt and key.ctrl == ctrl and key.shift == shift :
key.active = True
break
else :
keymap.keymap_items.new(idname = idname, type = type , value = value , any=any, shift=shift, ctrl=ctrl, alt=alt, oskey=oskey, key_modifier=key_modifier, repeat=repeat, head=head)

0 comments on commit 53ffc12

Please sign in to comment.