Changeset View
Changeset View
Standalone View
Standalone View
measureit/measureit_main.py
| Show First 20 Lines • Show All 1,338 Lines • ▼ Show 20 Lines | class AddLinkButton(Operator): | ||||
| # Poll | # Poll | ||||
| # ------------------------------ | # ------------------------------ | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| o = context.object | o = context.object | ||||
| if o is None: | if o is None: | ||||
| return False | return False | ||||
| else: | else: | ||||
| if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LAMP": | if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LIGHT": | ||||
| if bpy.context.mode == 'OBJECT': | if bpy.context.mode == 'OBJECT': | ||||
| return True | return True | ||||
| else: | else: | ||||
| return False | return False | ||||
| else: | else: | ||||
| return False | return False | ||||
| # ------------------------------ | # ------------------------------ | ||||
| ▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | class AddOriginButton(Operator): | ||||
| # Poll | # Poll | ||||
| # ------------------------------ | # ------------------------------ | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| o = context.object | o = context.object | ||||
| if o is None: | if o is None: | ||||
| return False | return False | ||||
| else: | else: | ||||
| if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LAMP": | if o.type == "MESH" or o.type == "EMPTY" or o.type == "CAMERA" or o.type == "LIGHT": | ||||
| if bpy.context.mode == 'OBJECT': | if bpy.context.mode == 'OBJECT': | ||||
| return True | return True | ||||
| else: | else: | ||||
| return False | return False | ||||
| else: | else: | ||||
| return False | return False | ||||
| # ------------------------------ | # ------------------------------ | ||||
| ▲ Show 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | class AddNoteButton(Operator): | ||||
| # ------------------------------ | # ------------------------------ | ||||
| # Execute button action | # Execute button action | ||||
| # ------------------------------ | # ------------------------------ | ||||
| def execute(self, context): | def execute(self, context): | ||||
| if context.area.type == 'VIEW_3D': | if context.area.type == 'VIEW_3D': | ||||
| bpy.ops.object.empty_add(type='PLAIN_AXES') | bpy.ops.object.empty_add(type='PLAIN_AXES') | ||||
| myempty = bpy.data.objects[bpy.context.active_object.name] | myempty = bpy.data.objects[bpy.context.active_object.name] | ||||
| myempty.location = bpy.context.scene.cursor_location | myempty.location = bpy.context.scene.cursor_location | ||||
| myempty.empty_draw_size = 0.01 | myempty.empty_display_size = 0.01 | ||||
| myempty.name = "Annotation" | myempty.name = "Annotation" | ||||
| # Add properties | # Add properties | ||||
| scene = context.scene | scene = context.scene | ||||
| mainobject = myempty | mainobject = myempty | ||||
| if 'MeasureGenerator' not in mainobject: | if 'MeasureGenerator' not in mainobject: | ||||
| mainobject.MeasureGenerator.add() | mainobject.MeasureGenerator.add() | ||||
| mp = mainobject.MeasureGenerator[0] | mp = mainobject.MeasureGenerator[0] | ||||
| ▲ Show 20 Lines • Show All 336 Lines • Show Last 20 Lines | |||||