Added button to conveniently edit the vector style CSS within Blender

This commit is contained in:
Dion Moult
2020-08-15 09:45:20 +10:00
parent 217098132f
commit 75b14d4c15
3 changed files with 14 additions and 0 deletions
@@ -183,6 +183,7 @@ if bpy is not None:
operator.RemoveDrawingStyle,
operator.SaveDrawingStyle,
operator.ActivateDrawingStyle,
operator.EditVectorStyle,
prop.StrProperty,
prop.Variable,
prop.Role,
@@ -3499,3 +3499,15 @@ class RemoveDrawing(bpy.types.Operator):
bpy.data.collections.remove(collection, do_unlink=True)
props.drawings.remove(self.index)
return {'FINISHED'}
class EditVectorStyle(bpy.types.Operator):
bl_idname = 'bim.edit_vector_style'
bl_label = 'Edit Vector Style'
index: bpy.props.IntProperty()
def execute(self, context):
camera = context.scene.camera
vector_style = context.scene.DocProperties.drawing_styles[camera.data.BIMCameraProperties.active_drawing_style_index].vector_style
bpy.data.texts.load(os.path.join(context.scene.BIMProperties.data_dir, 'styles', vector_style + '.css'))
return {'FINISHED'}
@@ -899,6 +899,7 @@ class BIM_PT_camera(Panel):
row = layout.row(align=True)
row.prop(drawing_style, 'vector_style')
row.operator('bim.edit_vector_style', text='', icon='GREASEPENCIL')
row = layout.row(align=True)
row.prop(drawing_style, 'include_query')
row = layout.row(align=True)