small change on input from keyboard

This commit is contained in:
Bruno Perdigão
2024-08-05 17:27:47 -03:00
committed by Bruno Perdigão
parent 67b01dcd0f
commit 5e2cefee12
@@ -514,22 +514,18 @@ class DrawPolylineWall(bpy.types.Operator):
tool.Snaping.remove_last_polyline_point() tool.Snaping.remove_last_polyline_point()
tool.Blender.update_viewport() tool.Blender.update_viewport()
if event.value == 'PRESS' and event.type == 'I': # if event.value == 'PRESS' and event.type == 'I':
self.is_input_on = True # self.is_input_on = True
if self.is_input_on: # if self.is_input_on:
if event.value == 'PRESS' and event.type in self.input_options: if event.value == "PRESS" and event.type in self.input_options:
self.is_input_on = True
self.input_type = event.type self.input_type = event.type
self.number_input = [] self.number_input = []
self.number_output = '' self.number_output = ""
WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type) WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
if event.value == 'PRESS' and event.type in {'RIGHTMOUSE', 'ESC'}:
self.is_input_on = False
self.input_type = None
if self.input_type: if self.input_type:
if (event.ascii in self.number_options) or (event.value == "RELEASE" and event.type == "BACK_SPACE"): if (event.ascii in self.number_options) or (event.value == "RELEASE" and event.type == "BACK_SPACE"):
if event.ascii == "-": if event.ascii == "-":
@@ -567,18 +563,24 @@ class DrawPolylineWall(bpy.types.Operator):
WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type) WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}: if event.type in {"MIDDLEMOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE"}:
return {'PASS_THROUGH'} return {"PASS_THROUGH"}
if event.type in {'RIGHTMOUSE', 'ESC'}: if self.is_input_on:
if event.value == "PRESS" and event.type in {"RIGHTMOUSE", "ESC"}:
self.is_input_on = False
self.input_type = None
WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport()
else:
if event.value == "PRESS" and event.type in {"RIGHTMOUSE", "ESC"}:
WallPolylineDecorator.uninstall() WallPolylineDecorator.uninstall()
tool.Snaping.clear_polyline() tool.Snaping.clear_polyline()
tool.Blender.update_viewport() tool.Blender.update_viewport()
print("CANCELLED") print("CANCELLED")
return {'CANCELLED'} return {"CANCELLED"}
return {'RUNNING_MODAL'}
return {"RUNNING_MODAL"}
def invoke(self, context, event): def invoke(self, context, event):
if context.space_data.type == "VIEW_3D": if context.space_data.type == "VIEW_3D":