mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
WIP: Started the input system
This commit is contained in:
committed by
Bruno Perdigão
parent
04a273c720
commit
350df4eee5
@@ -344,6 +344,13 @@ class WallPolylineDecorator:
|
|||||||
else:
|
else:
|
||||||
self.draw_batch("POINTS", point, decorator_color_selected)
|
self.draw_batch("POINTS", point, decorator_color_selected)
|
||||||
|
|
||||||
|
if snap_prop.snap_type != "Plane":
|
||||||
|
projection_point = [Vector((snap_prop.x, snap_prop.y, 0))] # TODO get height from default container
|
||||||
|
self.draw_batch("POINTS", projection_point, decorator_color_special)
|
||||||
|
edges = [[0, 1]]
|
||||||
|
self.draw_batch("LINES", point + projection_point, decorator_color_selected, edges)
|
||||||
|
self.line_shader.uniform_float("lineWidth", 0.5)
|
||||||
|
|
||||||
polyline_data = context.scene.BIMModelProperties.polyline_point
|
polyline_data = context.scene.BIMModelProperties.polyline_point
|
||||||
polyline_points = []
|
polyline_points = []
|
||||||
polyline_edges = []
|
polyline_edges = []
|
||||||
|
|||||||
@@ -300,6 +300,15 @@ class DrawPolylineWall(bpy.types.Operator):
|
|||||||
self.mousemove_count = 0
|
self.mousemove_count = 0
|
||||||
self.action_count = 0
|
self.action_count = 0
|
||||||
self.visible_objs = None
|
self.visible_objs = None
|
||||||
|
self.number_options = {'0', '1', '2', '3',
|
||||||
|
'4', '5', '6', '7', '8', '9', '.', '-'}
|
||||||
|
self.number_input = []
|
||||||
|
self.number_output = ''
|
||||||
|
self.is_input_on = False
|
||||||
|
self.input_options = {'X', 'Y', 'D', 'A'}
|
||||||
|
self.input_type = ''
|
||||||
|
self.input_value_xy = [None, None]
|
||||||
|
|
||||||
|
|
||||||
def get_visible_objects(self, context):
|
def get_visible_objects(self, context):
|
||||||
depsgraph = context.evaluated_depsgraph_get()
|
depsgraph = context.evaluated_depsgraph_get()
|
||||||
@@ -546,6 +555,7 @@ class DrawPolylineWall(bpy.types.Operator):
|
|||||||
self.snaping_movement(context, event)
|
self.snaping_movement(context, event)
|
||||||
operator_time = time() - start_time
|
operator_time = time() - start_time
|
||||||
print(f"main function was finished in {operator_time:.2f} seconds")
|
print(f"main function was finished in {operator_time:.2f} seconds")
|
||||||
|
print(len(bpy.context.scene.BIMModelProperties.polyline_point))
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
if event.value == 'RELEASE' and event.type == 'LEFTMOUSE':
|
if event.value == 'RELEASE' and event.type == 'LEFTMOUSE':
|
||||||
@@ -554,6 +564,35 @@ class DrawPolylineWall(bpy.types.Operator):
|
|||||||
if event.value == 'RELEASE' and event.type == 'BACK_SPACE':
|
if event.value == 'RELEASE' and event.type == 'BACK_SPACE':
|
||||||
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':
|
||||||
|
self.is_input_on = True
|
||||||
|
|
||||||
|
if self.is_input_on:
|
||||||
|
if event.value == 'PRESS' and event.type in self.input_options:
|
||||||
|
self.input_type = event.type
|
||||||
|
self.number_input = []
|
||||||
|
self.number_output = ''
|
||||||
|
|
||||||
|
if self.input_type:
|
||||||
|
if event.ascii and event.ascii in self.number_options:
|
||||||
|
print(self.input_type)
|
||||||
|
self.number_input.append(event.ascii)
|
||||||
|
self.number_output = ''.join(self.number_input)
|
||||||
|
print(self.number_output)
|
||||||
|
|
||||||
|
if event.value == 'PRESS' and event.type in {'RET', 'NUMPAD_ENTER'}:
|
||||||
|
if not None in self.input_value_xy:
|
||||||
|
tool.Snaping.insert_polyline_point(self.input_value_xy[0], self.input_value_xy[1])
|
||||||
|
tool.Blender.update_viewport()
|
||||||
|
self.is_input_on = False
|
||||||
|
if self.number_output and self.input_type == 'X':
|
||||||
|
print("-> ", float(self.number_output))
|
||||||
|
self.input_value_xy[0] = float(self.number_output)
|
||||||
|
if self.number_output and self.input_type == 'Y':
|
||||||
|
print("-> ", float(self.number_output))
|
||||||
|
self.input_value_xy[1] = float(self.number_output)
|
||||||
|
|
||||||
|
|
||||||
if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}:
|
if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}:
|
||||||
return {'PASS_THROUGH'}
|
return {'PASS_THROUGH'}
|
||||||
|
|||||||
@@ -76,14 +76,24 @@ class Snaping(blenderbim.core.tool.Snaping):
|
|||||||
snap_vertex.snap_type = snap_type
|
snap_vertex.snap_type = snap_type
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def insert_polyline_point(cls):
|
def insert_polyline_point(cls, x=None, y=None):
|
||||||
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_point[0]
|
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_point[0]
|
||||||
polyline_data = bpy.context.scene.BIMModelProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMModelProperties.polyline_point
|
||||||
|
|
||||||
polyline_point = bpy.context.scene.BIMModelProperties.polyline_point.add()
|
polyline_point = bpy.context.scene.BIMModelProperties.polyline_point.add()
|
||||||
polyline_point.x = snap_vertex.x
|
print(type(x))
|
||||||
polyline_point.y = snap_vertex.y
|
print(type(y))
|
||||||
polyline_point.z = 0 # TODO Update to the the default container height
|
if x is not None and y is not None:
|
||||||
|
print("Foi")
|
||||||
|
polyline_point.x = x
|
||||||
|
polyline_point.y = y
|
||||||
|
polyline_point.z = 0 # TODO Update to the the default container height
|
||||||
|
print("PL", polyline_point.x, polyline_point.y)
|
||||||
|
else:
|
||||||
|
polyline_point.x = snap_vertex.x
|
||||||
|
polyline_point.y = snap_vertex.y
|
||||||
|
polyline_point.z = 0 # TODO Update to the the default container height
|
||||||
|
print("PL", polyline_point.x, polyline_point.y)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_polyline(cls):
|
def clear_polyline(cls):
|
||||||
|
|||||||
Reference in New Issue
Block a user