2018-07-31 10:22:19 +02:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
import bpy
|
|
|
|
from bpy.types import Menu, Panel, UIList
|
|
|
|
from rna_prop_ui import PropertyPanel
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# Base-Classes (for shared stuff - e.g. poll, attributes, etc.)
|
|
|
|
|
2018-07-31 21:06:08 +10:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class DataButtonsPanel:
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "data"
|
|
|
|
|
2019-02-26 19:40:07 -03:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
return context.gpencil
|
2019-02-26 19:40:07 -03:00
|
|
|
|
|
|
|
|
|
|
|
class ObjectButtonsPanel:
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "data"
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
ob = context.object
|
|
|
|
return ob and ob.type == 'GPENCIL'
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
class LayerDataButtonsPanel:
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "data"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpencil = context.gpencil
|
|
|
|
return gpencil and gpencil.layers.active
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# GP Object Properties Panels and Helper Classes
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_context_gpencil(DataButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = ""
|
|
|
|
bl_options = {'HIDE_HEADER'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
ob = context.object
|
|
|
|
space = context.space_data
|
2018-07-31 10:22:19 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
if ob:
|
|
|
|
layout.template_ID(ob, "data")
|
|
|
|
else:
|
|
|
|
layout.template_ID(space, "pin_id")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
2019-03-12 10:59:57 +11:00
|
|
|
class GPENCIL_MT_layer_context_menu(Menu):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Layer"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2019-07-01 13:24:27 +02:00
|
|
|
ob = context.object
|
|
|
|
gpd = ob.data
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-08-23 23:01:06 +02:00
|
|
|
layout.operator("gpencil.layer_duplicate", icon='DUPLICATE')
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2018-10-01 10:45:50 +02:00
|
|
|
layout.operator("gpencil.reveal", icon='RESTRICT_VIEW_OFF', text="Show All")
|
|
|
|
layout.operator("gpencil.hide", icon='RESTRICT_VIEW_ON', text="Hide Others").unselected = True
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
layout.operator("gpencil.lock_all", icon='LOCKED', text="Lock All")
|
|
|
|
layout.operator("gpencil.unlock_all", icon='UNLOCKED', text="UnLock All")
|
2018-10-31 14:18:16 +01:00
|
|
|
layout.prop(gpd, "use_autolock_layers", text="Autolock Inactive Layers")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2018-10-01 10:45:50 +02:00
|
|
|
layout.operator("gpencil.layer_merge", icon='SORT_ASC', text="Merge Down")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2018-08-27 16:29:19 +02:00
|
|
|
layout.separator()
|
|
|
|
layout.menu("VIEW3D_MT_gpencil_copy_layer")
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Layers"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
#layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
# Grease Pencil data...
|
|
|
|
if (gpd is None) or (not gpd.layers):
|
|
|
|
layout.operator("gpencil.layer_add", text="New Layer")
|
|
|
|
else:
|
|
|
|
self.draw_layers(context, layout, gpd)
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_layers(self, _context, layout, gpd):
|
2018-10-11 18:27:09 +02:00
|
|
|
|
2019-08-23 23:01:06 +02:00
|
|
|
gpl = gpd.layers.active
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-08-23 23:01:06 +02:00
|
|
|
row = layout.row()
|
2018-09-28 15:47:36 +02:00
|
|
|
layer_rows = 7
|
2019-08-23 23:01:06 +02:00
|
|
|
|
|
|
|
col = row.column()
|
2018-10-11 18:27:09 +02:00
|
|
|
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
|
2019-01-09 15:48:09 +01:00
|
|
|
rows=layer_rows, sort_reverse=True, sort_lock=True)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
col = row.column()
|
|
|
|
sub = col.column(align=True)
|
2018-10-01 10:45:50 +02:00
|
|
|
sub.operator("gpencil.layer_add", icon='ADD', text="")
|
|
|
|
sub.operator("gpencil.layer_remove", icon='REMOVE', text="")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
if gpl:
|
2019-03-12 10:59:57 +11:00
|
|
|
sub.menu("GPENCIL_MT_layer_context_menu", icon='DOWNARROW_HLT', text="")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
if len(gpd.layers) > 1:
|
|
|
|
col.separator()
|
|
|
|
|
|
|
|
sub = col.column(align=True)
|
2018-10-12 09:08:41 +02:00
|
|
|
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
|
|
|
|
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
col.separator()
|
|
|
|
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.operator("gpencil.layer_isolate", icon='LOCKED', text="").affect_visibility = False
|
2018-10-01 10:45:50 +02:00
|
|
|
sub.operator("gpencil.layer_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
|
2019-08-23 23:01:06 +02:00
|
|
|
|
|
|
|
# Layer main properties
|
|
|
|
row = layout.row()
|
|
|
|
col = layout.column(align=True)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-08-23 23:01:06 +02:00
|
|
|
if gpl:
|
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = True
|
|
|
|
col = layout.column(align=True)
|
|
|
|
|
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "blend_mode", text="Blend")
|
|
|
|
|
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "opacity", text="Opacity", slider=True)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-08-23 23:24:07 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Adjustments"
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
bl_parent_id = 'DATA_PT_gpencil_layers'
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
2018-10-25 16:50:42 +02:00
|
|
|
scene = context.scene
|
2018-07-31 10:22:19 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
|
|
|
gpl = gpd.layers.active
|
2018-07-31 10:22:19 +02:00
|
|
|
layout.active = not gpl.lock
|
|
|
|
|
|
|
|
# Layer options
|
|
|
|
# Offsets - Color Tint
|
|
|
|
layout.enabled = not gpl.lock
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.prop(gpl, "tint_color")
|
2018-07-31 15:13:08 +02:00
|
|
|
col.prop(gpl, "tint_factor", text="Factor", slider=True)
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
# Offsets - Thickness
|
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "line_change", text="Stroke Thickness")
|
|
|
|
|
2018-10-24 11:02:52 +02:00
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "pass_index")
|
|
|
|
|
2018-10-25 16:50:42 +02:00
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop_search(gpl, "viewlayer_render", scene, "view_layers", text="View Layer")
|
|
|
|
|
2018-09-24 22:26:21 +02:00
|
|
|
col = layout.row(align=True)
|
2018-09-27 08:51:26 +10:00
|
|
|
col.prop(gpl, "lock_material")
|
2018-09-24 22:26:21 +02:00
|
|
|
|
2019-08-23 23:24:07 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Relations"
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
bl_parent_id = 'DATA_PT_gpencil_layers'
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
|
|
|
gpl = gpd.layers.active
|
|
|
|
|
2018-07-31 15:13:08 +02:00
|
|
|
col = layout.column()
|
2018-07-31 10:22:19 +02:00
|
|
|
col.active = not gpl.lock
|
2018-07-31 15:13:08 +02:00
|
|
|
col.prop(gpl, "parent")
|
|
|
|
col.prop(gpl, "parent_type", text="Type")
|
2018-07-31 10:22:19 +02:00
|
|
|
parent = gpl.parent
|
|
|
|
|
|
|
|
if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE':
|
|
|
|
col.prop_search(gpl, "parent_bone", parent.data, "bones", text="Bone")
|
|
|
|
|
|
|
|
|
2019-04-03 10:25:49 +02:00
|
|
|
class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, Panel):
|
|
|
|
bl_label = "Display"
|
|
|
|
bl_parent_id = 'DATA_PT_gpencil_layers'
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
|
|
|
gpd = context.gpencil
|
|
|
|
gpl = gpd.layers.active
|
|
|
|
|
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "channel_color")
|
|
|
|
|
2019-08-23 23:01:06 +02:00
|
|
|
col = layout.row(align=True)
|
|
|
|
col.prop(gpl, "use_solo_mode", text="Show Only On Keyframed")
|
2019-04-03 10:25:49 +02:00
|
|
|
|
2019-08-23 23:24:07 +02:00
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_onion_skinning(DataButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Onion Skinning"
|
|
|
|
|
|
|
|
def draw(self, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
2018-12-10 16:42:40 +01:00
|
|
|
layout.enabled = gpd.users <= 1
|
2018-08-15 16:07:16 +02:00
|
|
|
|
2018-12-10 16:42:40 +01:00
|
|
|
if gpd.users > 1:
|
2018-08-28 12:34:51 +10:00
|
|
|
layout.label(text="Multiuser datablock not supported", icon='ERROR')
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-03-07 14:56:31 +01:00
|
|
|
col = layout.column()
|
|
|
|
col.prop(gpd, "onion_mode")
|
|
|
|
col.prop(gpd, "onion_factor", text="Opacity", slider=True)
|
2019-05-16 14:00:31 +02:00
|
|
|
col.prop(gpd, "onion_keyframe_type")
|
2019-03-07 14:56:31 +01:00
|
|
|
|
|
|
|
if gpd.onion_mode == 'ABSOLUTE':
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.prop(gpd, "ghost_before_range", text="Frames Before")
|
|
|
|
col.prop(gpd, "ghost_after_range", text="Frames After")
|
2019-03-08 02:43:33 +11:00
|
|
|
elif gpd.onion_mode == 'RELATIVE':
|
2019-03-07 14:56:31 +01:00
|
|
|
col = layout.column(align=True)
|
|
|
|
col.prop(gpd, "ghost_before_range", text="Keyframes Before")
|
|
|
|
col.prop(gpd, "ghost_after_range", text="Keyframes After")
|
|
|
|
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_onion_skinning_custom_colors(DataButtonsPanel, Panel):
|
|
|
|
bl_parent_id = "DATA_PT_gpencil_onion_skinning"
|
2019-03-07 14:56:31 +01:00
|
|
|
bl_label = "Custom Colors"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw_header(self, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2019-03-07 14:56:31 +01:00
|
|
|
|
|
|
|
self.layout.prop(gpd, "use_ghost_custom_colors", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2019-03-07 14:56:31 +01:00
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.enabled = gpd.users <= 1 and gpd.use_ghost_custom_colors
|
|
|
|
|
|
|
|
layout.prop(gpd, "before_color", text="Before")
|
|
|
|
layout.prop(gpd, "after_color", text="After")
|
|
|
|
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_onion_skinning_display(DataButtonsPanel, Panel):
|
|
|
|
bl_parent_id = "DATA_PT_gpencil_onion_skinning"
|
2019-03-07 14:56:31 +01:00
|
|
|
bl_label = "Display"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2019-03-07 14:56:31 +01:00
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.enabled = gpd.users <= 1
|
|
|
|
|
|
|
|
layout.prop(gpd, "use_ghosts_always", text="View In Render")
|
|
|
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.prop(gpd, "use_onion_fade", text="Fade")
|
2019-03-08 02:47:00 +11:00
|
|
|
sub = layout.column()
|
|
|
|
sub.active = gpd.onion_mode in {'RELATIVE', 'SELECTED'}
|
|
|
|
sub.prop(gpd, "use_onion_loop", text="Loop")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
class GPENCIL_MT_gpencil_vertex_group(Menu):
|
|
|
|
bl_label = "GP Vertex Groups"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
layout.operator_context = 'EXEC_AREA'
|
|
|
|
layout.operator("object.vertex_group_add")
|
|
|
|
|
|
|
|
ob = context.active_object
|
|
|
|
if ob.vertex_groups.active:
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
layout.operator("gpencil.vertex_group_assign", text="Assign to Active Group")
|
|
|
|
layout.operator("gpencil.vertex_group_remove_from", text="Remove from Active Group")
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
|
|
|
|
layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
|
|
|
|
layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
layout.operator("gpencil.vertex_group_select", text="Select Points")
|
|
|
|
layout.operator("gpencil.vertex_group_deselect", text="Deselect Points")
|
|
|
|
|
|
|
|
|
|
|
|
class GPENCIL_UL_vgroups(UIList):
|
2019-04-19 07:32:24 +02:00
|
|
|
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
|
2018-07-31 10:22:19 +02:00
|
|
|
vgroup = item
|
|
|
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
|
|
|
layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon)
|
2019-04-16 11:27:36 +02:00
|
|
|
icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED'
|
|
|
|
layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False)
|
2018-07-31 10:22:19 +02:00
|
|
|
elif self.layout_type == 'GRID':
|
|
|
|
layout.alignment = 'CENTER'
|
|
|
|
layout.label(text="", icon_value=icon)
|
|
|
|
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_vertex_groups(ObjectButtonsPanel, Panel):
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_label = "Vertex Groups"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
ob = context.object
|
|
|
|
group = ob.vertex_groups.active
|
|
|
|
|
|
|
|
rows = 2
|
|
|
|
if group:
|
|
|
|
rows = 4
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.template_list("GPENCIL_UL_vgroups", "", ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
|
|
|
|
|
|
|
|
col = row.column(align=True)
|
2018-10-01 10:45:50 +02:00
|
|
|
col.operator("object.vertex_group_add", icon='ADD', text="")
|
|
|
|
col.operator("object.vertex_group_remove", icon='REMOVE', text="").all = False
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
if ob.vertex_groups:
|
|
|
|
row = layout.row()
|
|
|
|
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.operator("gpencil.vertex_group_assign", text="Assign")
|
|
|
|
sub.operator("gpencil.vertex_group_remove_from", text="Remove")
|
|
|
|
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.operator("gpencil.vertex_group_select", text="Select")
|
|
|
|
sub.operator("gpencil.vertex_group_deselect", text="Deselect")
|
|
|
|
|
|
|
|
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
|
|
|
|
|
|
|
|
|
2019-02-25 21:59:35 +01:00
|
|
|
class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
|
|
|
|
bl_label = "Strokes"
|
2018-07-31 10:22:19 +02:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
2018-10-05 10:39:02 +02:00
|
|
|
layout.use_property_decorate = False
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
ob = context.object
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-03-04 17:05:44 +01:00
|
|
|
col = layout.column(align=True)
|
|
|
|
col.prop(gpd, "stroke_depth_order")
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
|
|
|
|
if ob:
|
|
|
|
col.enabled = not ob.show_in_front
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
col = layout.column(align=True)
|
2019-02-25 21:59:35 +01:00
|
|
|
col.prop(gpd, "stroke_thickness_space")
|
2018-07-31 10:22:19 +02:00
|
|
|
sub = col.column()
|
2019-02-25 21:59:35 +01:00
|
|
|
sub.active = gpd.stroke_thickness_space == 'WORLDSPACE'
|
2018-08-22 15:41:26 +10:00
|
|
|
sub.prop(gpd, "pixel_factor", text="Thickness Scale")
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2019-02-25 21:59:35 +01:00
|
|
|
layout.prop(gpd, "use_force_fill_recalc", text="Force Fill Update")
|
|
|
|
layout.prop(gpd, "use_adaptive_uv", text="Adaptive UVs")
|
|
|
|
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
|
2019-02-25 21:59:35 +01:00
|
|
|
bl_label = "Viewport Display"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
|
|
|
gpl = gpd.layers.active
|
2019-02-25 21:59:35 +01:00
|
|
|
|
2018-09-04 22:10:56 +02:00
|
|
|
layout.prop(gpd, "edit_line_color", text="Edit Line Color")
|
2018-07-31 10:22:19 +02:00
|
|
|
if gpl:
|
|
|
|
layout.prop(gpd, "show_stroke_direction", text="Show Stroke Directions")
|
|
|
|
|
|
|
|
|
2018-10-04 23:27:34 +02:00
|
|
|
class DATA_PT_gpencil_canvas(DataButtonsPanel, Panel):
|
|
|
|
bl_label = "Canvas"
|
|
|
|
bl_parent_id = 'DATA_PT_gpencil_display'
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
2018-10-05 10:39:02 +02:00
|
|
|
layout.use_property_decorate = False
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
gpd = context.gpencil
|
2018-10-05 10:23:13 +02:00
|
|
|
grid = gpd.grid
|
2018-10-04 23:27:34 +02:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
col = row.column()
|
2018-10-09 17:44:16 +02:00
|
|
|
col.prop(grid, "color", text="Color")
|
|
|
|
col.prop(grid, "scale", text="Scale")
|
2018-10-08 23:21:44 +02:00
|
|
|
col.prop(grid, "offset")
|
2018-10-04 23:27:34 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
col = row.column()
|
2018-10-05 10:23:13 +02:00
|
|
|
col.prop(grid, "lines", text="Subdivisions")
|
2018-10-04 23:27:34 +02:00
|
|
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class DATA_PT_custom_props_gpencil(DataButtonsPanel, PropertyPanel, Panel):
|
|
|
|
_context_path = "object.data"
|
|
|
|
_property_type = bpy.types.GreasePencil
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
2018-07-31 21:06:08 +10:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
classes = (
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
DATA_PT_context_gpencil,
|
|
|
|
DATA_PT_gpencil_layers,
|
|
|
|
DATA_PT_gpencil_onion_skinning,
|
|
|
|
DATA_PT_gpencil_onion_skinning_custom_colors,
|
|
|
|
DATA_PT_gpencil_onion_skinning_display,
|
|
|
|
DATA_PT_gpencil_layer_adjustments,
|
|
|
|
DATA_PT_gpencil_layer_relations,
|
2019-04-03 10:25:49 +02:00
|
|
|
DATA_PT_gpencil_layer_display,
|
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
2019-03-07 14:55:03 +00:00
|
|
|
DATA_PT_gpencil_vertex_groups,
|
2019-02-25 21:59:35 +01:00
|
|
|
DATA_PT_gpencil_strokes,
|
2018-07-31 10:22:19 +02:00
|
|
|
DATA_PT_gpencil_display,
|
2018-10-04 23:27:34 +02:00
|
|
|
DATA_PT_gpencil_canvas,
|
2018-07-31 10:22:19 +02:00
|
|
|
DATA_PT_custom_props_gpencil,
|
|
|
|
|
|
|
|
GPENCIL_UL_vgroups,
|
|
|
|
|
2019-03-12 10:59:57 +11:00
|
|
|
GPENCIL_MT_layer_context_menu,
|
2018-07-31 10:22:19 +02:00
|
|
|
GPENCIL_MT_gpencil_vertex_group,
|
|
|
|
)
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
from bpy.utils import register_class
|
|
|
|
for cls in classes:
|
|
|
|
register_class(cls)
|