Page MenuHome

preserveNormals.patch

File Metadata

Author
Alexander Trum (atrum)
Created
Nov 13 2013, 4:38 PM

preserveNormals.patch

diff -ru ./blender/release/scripts/startup/bl_ui/space_userpref.py ./blender_patched/release/scripts/startup/bl_ui/space_userpref.py
--- ./blender/release/scripts/startup/bl_ui/space_userpref.py 2012-07-19 18:12:12.000000000 +0200
+++ ./blender_patched/release/scripts/startup/bl_ui/space_userpref.py 2013-01-31 16:21:30.699379097 +0100
@@ -839,6 +839,7 @@
col.label(text="Scripts:")
col.prop(system, "use_scripts_auto_execute")
col.prop(system, "use_tabs_as_spaces")
+ col.prop(system, "user_preserve_normals")
from bl_ui.space_userpref_keymap import InputKeyMapPanel
diff -ru ./blender/source/blender/bmesh/intern/bmesh_mesh.c ./blender_patched/source/blender/bmesh/intern/bmesh_mesh.c
--- ./blender/source/blender/bmesh/intern/bmesh_mesh.c 2012-07-19 18:12:29.000000000 +0200
+++ ./blender_patched/source/blender/bmesh/intern/bmesh_mesh.c 2013-01-31 16:21:30.699379097 +0100
@@ -202,6 +202,11 @@
int index;
float (*edgevec)[3];
+ if (U.flag & USER_PRESERVE_NORMALS) {
+ printf("skipping normal update in BM_mesh_normals_update as requested\n"); fflush(NULL);
+ return;
+ }
+
/* calculate all face normals */
BM_ITER_MESH (f, &faces, bm, BM_FACES_OF_MESH) {
if (skip_hidden && BM_elem_flag_test(f, BM_ELEM_HIDDEN))
diff -ru ./blender/source/blender/editors/mesh/mesh_data.c ./blender_patched/source/blender/editors/mesh/mesh_data.c
--- ./blender/source/blender/editors/mesh/mesh_data.c 2012-07-19 18:12:37.000000000 +0200
+++ ./blender_patched/source/blender/editors/mesh/mesh_data.c 2013-01-31 16:21:30.699379097 +0100
@@ -799,6 +799,7 @@
BKE_mesh_tessface_clear(mesh);
}
+ if(!(U.flag & USER_PRESERVE_NORMALS)) {
/* note on this if/else - looks like these layers are not needed
* so rather then add poly-index layer and calculate normals for it
* calculate normals only for the mvert's. - campbell */
@@ -821,6 +822,9 @@
(void)polyindex;
(void)face_nors;
#endif
+ } else {
+ printf("no normal update\n");
+ }
DAG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mesh);
diff -ru ./blender/source/blender/makesdna/DNA_userdef_types.h ./blender_patched/source/blender/makesdna/DNA_userdef_types.h
--- ./blender/source/blender/makesdna/DNA_userdef_types.h 2012-07-19 18:12:28.000000000 +0200
+++ ./blender_patched/source/blender/makesdna/DNA_userdef_types.h 2013-01-31 16:21:30.699379097 +0100
@@ -468,6 +468,7 @@
#define USER_NONEGFRAMES (1 << 24)
#define USER_TXT_TABSTOSPACES_DISABLE (1 << 25)
#define USER_TOOLTIPS_PYTHON (1 << 26)
+#define USER_PRESERVE_NORMALS (1 << 27)
/* helper macro for checking frame clamping */
#define FRAMENUMBER_MIN_CLAMP(cfra) \
diff -ru ./blender/source/blender/makesrna/intern/rna_userdef.c ./blender_patched/source/blender/makesrna/intern/rna_userdef.c
--- ./blender/source/blender/makesrna/intern/rna_userdef.c 2012-07-19 18:12:31.000000000 +0200
+++ ./blender_patched/source/blender/makesrna/intern/rna_userdef.c 2013-01-31 16:21:30.699379097 +0100
@@ -3000,6 +3000,10 @@
RNA_def_property_ui_text(prop, "Tabs as Spaces",
"Automatically convert all new tabs into spaces for new and loaded text files");
+ prop= RNA_def_property(srna, "user_preserve_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_PRESERVE_NORMALS);
+ RNA_def_property_ui_text(prop, "Preserve Imported Normals", "Do not recalculate normals when rendering or editing");
+
prop = RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
RNA_def_property_range(prop, 0, 500);

Event Timeline