Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
84 lines
2.2 KiB
Python
84 lines
2.2 KiB
Python
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
import bpy
|
|
from bpy.types import Panel, Menu
|
|
|
|
|
|
class DataButtonsPanel:
|
|
bl_space_type = 'PROPERTIES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_context = "data"
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
return hasattr(context, "grease_pencil") and context.grease_pencil
|
|
|
|
|
|
class DATA_PT_context_grease_pencil(DataButtonsPanel, Panel):
|
|
bl_label = ""
|
|
bl_options = {'HIDE_HEADER'}
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
ob = context.object
|
|
grease_pencil = context.grease_pencil
|
|
space = context.space_data
|
|
|
|
if ob:
|
|
layout.template_ID(ob, "data")
|
|
elif grease_pencil:
|
|
layout.template_ID(space, "pin_id")
|
|
|
|
|
|
class GREASE_PENCIL_MT_grease_pencil_add_layer_extra(Menu):
|
|
bl_label = "Add Extra"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
layout.operator("grease_pencil.layer_group_add", text="Add Group")
|
|
|
|
|
|
class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
|
|
bl_label = "Layers"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
ob = context.object
|
|
grease_pencil = context.grease_pencil
|
|
layer = grease_pencil.layers.active
|
|
|
|
row = layout.row()
|
|
row.template_grease_pencil_layer_tree()
|
|
|
|
col = row.column()
|
|
sub = col.column(align=True)
|
|
sub.operator("grease_pencil.layer_add", icon='ADD', text="")
|
|
sub.menu("GREASE_PENCIL_MT_grease_pencil_add_layer_extra", icon='DOWNARROW_HLT', text="")
|
|
|
|
col.operator("grease_pencil.layer_remove", icon='REMOVE', text="")
|
|
|
|
# Layer main properties
|
|
if layer:
|
|
layout.use_property_split = True
|
|
layout.use_property_decorate = True
|
|
col = layout.column(align=True)
|
|
|
|
col = layout.row(align=True)
|
|
col.prop(layer, "opacity", text="Opacity", slider=True)
|
|
|
|
|
|
classes = (
|
|
DATA_PT_context_grease_pencil,
|
|
DATA_PT_grease_pencil_layers,
|
|
GREASE_PENCIL_MT_grease_pencil_add_layer_extra,
|
|
)
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
from bpy.utils import register_class
|
|
for cls in classes:
|
|
register_class(cls)
|