[Bf-blender-cvs] [ca4144a11af] soc-2018-npr: Provide a switch to turn on/off intersection line calculation to save time when intersection is not needed.

Nick Wu noreply at git.blender.org
Thu Jul 5 09:25:27 CEST 2018


Commit: ca4144a11afa547fad9897c460fb115ff4fbef1c
Author: Nick Wu
Date:   Thu Jul 5 15:25:07 2018 +0800
Branches: soc-2018-npr
https://developer.blender.org/rBca4144a11afa547fad9897c460fb115ff4fbef1c

Provide a switch to turn on/off intersection line calculation to save time when intersection is not needed.

===================================================================

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/draw/engines/lanpr/lanpr_all.h
M	source/blender/draw/engines/lanpr/lanpr_ops.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 88ca9e117f4..f34c0897457 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -533,6 +533,9 @@ class SCENE_PT_lanpr(SceneButtonsPanel, Panel):
 
             rows = 4
             if lanpr.master_mode == "SOFTWARE":
+                layout.label(text="Enable On Demand:")
+                layout.prop(lanpr,"calculate_intersections", toggle = True, text = "Enable Intersection Lines")
+                layout.label(text="RUN:")
                 layout.operator("scene.lanpr_calculate", icon='RENDER_STILL')
                 layout.label(text="Layer Composition:")
                 layout.template_list("LANPR_linesets", "", lanpr, "layers", lanpr.layers, "active_layer_index", rows=rows)
@@ -604,13 +607,18 @@ class SCENE_PT_lanpr_line_types(SceneButtonsPanel, Panel):
         row.prop(active_layer, "material_color", text="")
         row.prop(active_layer, "thickness_material", text="")
         row = col.row(align = True)
-        row.enabled = active_layer.enable_intersection
-        row.prop(active_layer, "intersection_color", text="")
-        row.prop(active_layer, "thickness_intersection", text="")
+        if lanpr.calculate_intersections:
+            row.enabled = active_layer.enable_intersection
+            row.prop(active_layer, "intersection_color", text="")
+            row.prop(active_layer, "thickness_intersection", text="")
+        else:
+            row.label(text= "Intersection Calculation Disabled")
 
         if lanpr.master_mode == "DPIX" and active_layer.enable_intersection:
-            row = col.row()
-            row.operator("scene.lanpr_calculate", text= "Recalculate Intersections")
+            row = col.row(align = True)
+            row.prop(lanpr,"calculate_intersections", toggle = True, text = "Enable")
+            if lanpr.calculate_intersections:
+                row.operator("scene.lanpr_calculate", text= "Recalculate")
 
         if lanpr.master_mode == "SOFTWARE":
             row = layout.row(align=True)
diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h b/source/blender/draw/engines/lanpr/lanpr_all.h
index 8e8f22088b2..dcb9197a168 100644
--- a/source/blender/draw/engines/lanpr/lanpr_all.h
+++ b/source/blender/draw/engines/lanpr/lanpr_all.h
@@ -379,6 +379,9 @@ typedef struct LANPR_RenderBuffer {
 	struct Scene *Scene;
 	struct Object *Camera;
 
+	int    calculate_intersections;
+	int    size;
+
 	//tnsRenderTriangles are in mesh object.
 }LANPR_RenderBuffer;
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index a9b58fa5136..567deb8f964 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -304,7 +304,7 @@ void lanpr_AssociateTriangleWithBoundingArea(LANPR_RenderBuffer *rb, LANPR_Bound
 		if (RootBoundingArea->TriangleCount > 200 && Recursive) {
 			lanpr_SplitBoundingArea(rb, RootBoundingArea);
 		}
-		if (Recursive) lanpr_TriangleCalculateIntersectionsInTile(rb, rt, RootBoundingArea);
+		if (Recursive && rb->calculate_intersections) lanpr_TriangleCalculateIntersectionsInTile(rb, rt, RootBoundingArea);
 	}
 	else {
 		LANPR_BoundingArea *ba = RootBoundingArea->Child;
@@ -2917,6 +2917,7 @@ static int lanpr_compute_feature_lines_exec(struct bContext *C, struct wmOperato
 	rb->Scene = scene;
 	rb->W = scene->r.xsch;
 	rb->H = scene->r.ysch;
+	rb->calculate_intersections = lanpr->calculate_intersections;
 
 	rb->TriangleSize = lanpr_GetRenderTriangleSize(rb);
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index d7744a20d29..971cc930245 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1489,6 +1489,9 @@ typedef struct SceneLANPR{
 	ListBase                   line_layers;  /* now here!!! */
 	struct LANPR_LineLayer    *active_layer;
 
+	int                        calculate_intersections;
+	int                        _size;
+
 } SceneLANPR;
 
 /* *************************************************************** */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 82b2507a293..7b2396a180b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6401,6 +6401,10 @@ static void rna_def_scene_lanpr(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
+	prop = RNA_def_property(srna, "calculate_intersections", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_default(prop, 1);
+	RNA_def_property_ui_text(prop, "Calculate Intersections", "Calculate Intersections or not");
+
 
 	/* these shall go into LANPR_LineLayer */



More information about the Bf-blender-cvs mailing list