[Bf-blender-cvs] [bd26db98bcd] soc-2019-npr: LANPR: UI refactor: line layer ui list use name.
YimingWu
noreply at git.blender.org
Fri Jul 26 10:17:20 CEST 2019
Commit: bd26db98bcdb31768b72d4c5cf834f31be50f5d9
Author: YimingWu
Date: Fri Jul 26 16:16:56 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBbd26db98bcdb31768b72d4c5cf834f31be50f5d9
LANPR: UI refactor: line layer ui list use name.
===================================================================
M release/scripts/startup/bl_ui/properties_render.py
M source/blender/editors/lanpr/lanpr_ops.c
M source/blender/makesdna/DNA_lanpr_types.h
M source/blender/makesrna/intern/rna_lanpr.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index f5a3c204d79..dcd0b503e93 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -691,33 +691,7 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel):
class LANPR_UL_linesets(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
- lineset = item
- if self.layout_type in {'DEFAULT', 'COMPACT'}:
- split = layout.split(factor=0.25)
- t=''
- if not lineset.use_multiple_levels:
- t='%d'%lineset.qi_begin
- else:
- t='%d - %d'%(lineset.qi_begin,lineset.qi_end)
- split.label(text=t)
- row = split.row(align=True)
- s2 = row.split(factor=0.5,align=True)
- if lineset.use_same_style:
- row.prop(lineset, "color", text="")
- row.prop(lineset, "thickness", text="", icon_value=icon)
- else:
- r = s2.row(align=True)
- r.prop(lineset, "contour_color", text="")
- r.prop(lineset, "crease_color", text="")
- r.prop(lineset, "edge_mark_color", text="")
- r.prop(lineset, "material_color", text="")
- r.prop(lineset, "intersection_color", text="")
- r = s2.row(align=True)
- r.prop(lineset, "thickness", text="", icon_value=icon)
-
- elif self.layout_type == 'GRID':
- layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.prop(item,"name", text="", emboss=False)
class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 'BLENDER_EEVEE'}
diff --git a/source/blender/editors/lanpr/lanpr_ops.c b/source/blender/editors/lanpr/lanpr_ops.c
index dcf9c32e6af..2d71772ddb5 100644
--- a/source/blender/editors/lanpr/lanpr_ops.c
+++ b/source/blender/editors/lanpr/lanpr_ops.c
@@ -53,6 +53,7 @@
#include "BLI_math.h"
#include "BLI_callbacks.h"
+#include "BLI_string_utils.h"
#include "bmesh.h"
#include "bmesh_class.h"
@@ -107,6 +108,11 @@ static int lanpr_get_line_bounding_areas(LANPR_RenderBuffer *rb,
/* Layer operations */
+static void lanpr_line_layer_unique_name(ListBase* list, LANPR_LineLayer* ll, const char *defname)
+{
+ BLI_uniquename(list,ll,defname,'.',offsetof(LANPR_LineLayer, name),sizeof(ll->name));
+}
+
int ED_lanpr_max_occlusion_in_line_layers(SceneLANPR *lanpr)
{
LANPR_LineLayer *lli;
@@ -126,6 +132,8 @@ LANPR_LineLayer *ED_lanpr_new_line_layer(SceneLANPR *lanpr)
{
LANPR_LineLayer *ll = MEM_callocN(sizeof(LANPR_LineLayer), "Line Layer");
+ lanpr_line_layer_unique_name(&lanpr->line_layers,ll,"Layer");
+
int max_occ = ED_lanpr_max_occlusion_in_line_layers(lanpr);
ll->qi_begin = ll->qi_end = max_occ + 1;
diff --git a/source/blender/makesdna/DNA_lanpr_types.h b/source/blender/makesdna/DNA_lanpr_types.h
index 423d69855a9..4fffbf67a62 100644
--- a/source/blender/makesdna/DNA_lanpr_types.h
+++ b/source/blender/makesdna/DNA_lanpr_types.h
@@ -92,11 +92,13 @@ typedef struct LANPR_LineLayer {
struct LANPR_LineLayer *next, *prev;
int type;
-
+
int use_multiple_levels;
int qi_begin;
int qi_end; /* these are for QI Range thing... just occlusion levels */
+ char name[64]; /* to be displayed on the list */
+
LANPR_LineType contour;
LANPR_LineType crease;
LANPR_LineType edge_mark;
diff --git a/source/blender/makesrna/intern/rna_lanpr.c b/source/blender/makesrna/intern/rna_lanpr.c
index f77e4516a4c..83fdeca0ea0 100644
--- a/source/blender/makesrna/intern/rna_lanpr.c
+++ b/source/blender/makesrna/intern/rna_lanpr.c
@@ -124,6 +124,9 @@ void RNA_def_lanpr(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "LANPR_LineLayer");
RNA_def_struct_ui_text(srna, "Line Layer", "LANPR_LineLayer");
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Name of this layer");
+
prop = RNA_def_property(srna, "normal_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_lanpr_normal_mode);
RNA_def_property_enum_default(prop, LANPR_NORMAL_DONT_CARE);
More information about the Bf-blender-cvs
mailing list