[Bf-blender-cvs] [a943a2edaa0] soc-2019-npr: LANPR: move "usage" settings into struct ObjectLANPR.
YimingWu
noreply at git.blender.org
Wed Jun 26 09:21:38 CEST 2019
Commit: a943a2edaa0ecb7c0096a8840e8e244f4d035325
Author: YimingWu
Date: Wed Jun 26 15:20:35 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBa943a2edaa0ecb7c0096a8840e8e244f4d035325
LANPR: move "usage" settings into struct ObjectLANPR.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M release/scripts/startup/bl_ui/properties_object.py
M source/blender/draw/engines/lanpr/lanpr_ops.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_object_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_object.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index ac661430d74..b01ea5f7bb9 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1670,10 +1670,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def FEATURE_LINE(self, layout, ob, md):
layout.operator("scene.lanpr_update_gp_strokes", icon='RENDER_STILL', text='Manual Update')
- layout.label(text='Usage:')
- row = layout.row()
- row.prop(md,'usage',expand=True)
- if md.usage == 'INCLUDE':
+ if ob.lanpr.usage == 'INCLUDE':
layout.label(text='Enable Types:')
row = layout.row(align=True)
row.prop(md,'enable_contour',toggle=True)
@@ -1698,6 +1695,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row = layout.row()
row.prop(md,'layer')
row.prop(md,'material')
+ else:
+ layout.label(text="This object is not included in LANPR")
class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
bl_label = "Modifiers"
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 0e45f4c97ae..d5e7d072da5 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -402,6 +402,20 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
col = flow.column()
col.prop(ob, "hide_select", text="Selectable", toggle=False, invert_checkbox=True)
+class OBJECT_PT_lanpr(ObjectButtonsPanel, Panel):
+ bl_label = "LANPR"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object) and (context.scene.lanpr.enabled)
+
+ def draw(self, context):
+ layout=self.layout
+ lanpr = context.object.lanpr
+ layout.label(text='Usage:')
+ row = layout.row()
+ row.prop(lanpr,'usage',expand=True)
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
@@ -423,6 +437,7 @@ classes = (
OBJECT_PT_display,
OBJECT_PT_display_bounds,
OBJECT_PT_visibility,
+ OBJECT_PT_lanpr,
OBJECT_PT_custom_props,
)
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index c130916e17d..b856d15ca3d 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -2276,6 +2276,16 @@ void lanpr_make_render_geometry_buffers_object(Object *o,
BM_mesh_free(bm);
}
}
+int lanpr_object_usage(Object *o)
+{
+ ModifierData *md;
+ for (md = o->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_FeatureLine) {
+ FeatureLineModifierData *flmd = (FeatureLineModifierData *)md;
+ }
+ }
+ return 0;
+}
void lanpr_make_render_geometry_buffers(Depsgraph *depsgraph,
Scene *s,
Object *c /*camera*/,
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index abb019a969a..a22ba7a9951 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1972,7 +1972,7 @@ enum {
typedef struct FeatureLineModifierData {
ModifierData modifier;
- int usage;
+ char _pad[4];
int types; // eFeatureLine_TypeFlag
struct Object *target;
@@ -1986,12 +1986,6 @@ typedef struct FeatureLineModifierData {
} FeatureLineModifierData;
-enum eFeatureLine_Usage {
- MOD_FEATURE_LINE_INCLUDE = 0,
- MOD_FEATURE_LINE_OCCLUSION_ONLY = (1 << 0),
- MOD_FEATURE_LINE_EXCLUDE = (1 << 1),
-};
-
enum eFeatureLine_TypeFlag {
MOD_FEATURE_LINE_NONE = (1 << 0),
MOD_FEATURE_LINE_CONTOUR = (1 << 1),
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 13b7a0a7600..27407ea47dc 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -180,6 +180,17 @@ typedef struct Object_Runtime {
void *_pad2; /* Padding is here for win32s unconventional stuct alignment rules. */
} Object_Runtime;
+typedef struct ObjectLANPR {
+ int usage;
+ char _pad[4];
+} ObjectLANPR;
+
+enum ObjectFeatureLine_Usage {
+ OBJECT_FEATURE_LINE_INCLUDE = 0,
+ OBJECT_FEATURE_LINE_OCCLUSION_ONLY = (1 << 0),
+ OBJECT_FEATURE_LINE_EXCLUDE = (1 << 1),
+};
+
typedef struct Object {
ID id;
/** Animation data (must be immediately after id for utilities to use it). */
@@ -390,6 +401,8 @@ typedef struct Object {
struct PreviewImage *preview;
+ ObjectLANPR lanpr;
+
/** Runtime evaluation data (keep last). */
Object_Runtime runtime;
} Object;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index b7d02b10124..7b9200a6475 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5996,28 +5996,12 @@ static void rna_def_modifier_featureline(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem prop_feature_line_usage_items[] = {
- {MOD_FEATURE_LINE_INCLUDE, "INCLUDE", 0, "Include", "Include this object into calculation"},
- {MOD_FEATURE_LINE_OCCLUSION_ONLY,
- "OCCLUSION_ONLY",
- 0,
- "Occlusion Only",
- "Don't produce lines, only used as occlusion object"},
- {MOD_FEATURE_LINE_EXCLUDE, "EXCLUDE", 0, "Exclude", "Don't calculate this object"},
- {0, NULL, 0, NULL, NULL},
- };
-
srna = RNA_def_struct(brna, "FeatureLineModifier", "Modifier");
RNA_def_struct_ui_text(
srna, "Feature Line Modifier", "To extract feature lines from a mesh using LANPR");
RNA_def_struct_sdna(srna, "FeatureLineModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_WIREFRAME);
- prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_feature_line_usage_items);
- RNA_def_property_ui_text(prop, "Usage", "How to use this object");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
prop = RNA_def_property(srna, "enable_contour", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "types", MOD_FEATURE_LINE_CONTOUR);
RNA_def_property_ui_text(prop, "Contour", "Contour lines");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 578097733f2..f232b6a2530 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2307,6 +2307,35 @@ static void rna_def_object_display(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
}
+static void rna_def_object_lanpr(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem prop_feature_line_usage_items[] = {
+ {OBJECT_FEATURE_LINE_INCLUDE,
+ "INCLUDE",
+ 0,
+ "Include",
+ "Include this object into calculation"},
+ {OBJECT_FEATURE_LINE_OCCLUSION_ONLY,
+ "OCCLUSION_ONLY",
+ 0,
+ "Occlusion Only",
+ "Don't produce lines, only used as occlusion object"},
+ {OBJECT_FEATURE_LINE_EXCLUDE, "EXCLUDE", 0, "Exclude", "Don't calculate this object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ObjectLANPR", NULL);
+ RNA_def_struct_ui_text(srna, "Object LANPR", "Object lanpr settings");
+ RNA_def_struct_sdna(srna, "ObjectLANPR");
+
+ prop = RNA_def_property(srna, "usage", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_feature_line_usage_items);
+ RNA_def_property_ui_text(prop, "Usage", "How to use this object");
+}
+
static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3043,6 +3072,11 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3d viewport");
+ /* LANPR */
+ prop = RNA_def_property(srna, "lanpr", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ObjectLANPR");
+ RNA_def_property_ui_text(prop, "LANPR", "LANPR settings for the object");
+
RNA_api_object(srna);
}
@@ -3055,6 +3089,7 @@ void RNA_def_object(BlenderRNA *brna)
rna_def_face_map(brna);
rna_def_material_slot(brna);
rna_def_object_display(brna);
+ rna_def_object_lanpr(brna);
RNA_define_animate_sdna(true);
}
More information about the Bf-blender-cvs
mailing list