Commit: c7a00c12a74642840026e17549fff84f3f32ead8
Author: Bastien Montagne
Date:   Mon Dec 1 13:46:19 2014 +0100
Branches: mesh-transfer-data
https://developer.blender.org/rBc7a00c12a74642840026e17549fff84f3f32ead8

Minor tweaks, add islands precision controll to modifier (disabled by default).

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

M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/editors/object/object_data_transfer.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_datatransfer.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index a224f9a..e13d007 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1294,6 +1294,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             row.prop(md, "layers_uv_select_src", text="")
             row.label(icon='RIGHTARROW')
             row.prop(md, "layers_uv_select_dst", text="")
+            col.prop(md, "islands_precision")
 
         layout.separator()
 
@@ -1330,7 +1331,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "mix_factor")
 
         col = split.column()
-        col.operator("object.datalayout_transfer", text="Generate Data Layers")
+        row = col.row()
+        row.active = bool(md.object)
+        row.operator("object.datalayout_transfer", text="Generate Data Layers")
         row = col.row(align=True)
         row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
         sub = row.row(align=True)
diff --git a/source/blender/editors/object/object_data_transfer.c 
b/source/blender/editors/object/object_data_transfer.c
index f7f4018..8dfd31c 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -507,7 +507,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot)
                             "'Width' of rays (especially useful when 
raycasting against vertices or edges)",
                             0.0f, 10.0f);
        RNA_def_property_subtype(prop, PROP_DISTANCE);
-       prop = RNA_def_float(ot->srna, "islands_precision", 0.1f, 0.0f, 1.0f, 
"Islands Precision",
+       prop = RNA_def_float(ot->srna, "islands_precision", 0.1f, 0.0f, 10.0f, 
"Islands Precision",
                             "Factor controlling precision of islands handling 
(the higher, the better the results)",
                             0.0f, 1.0f);
        RNA_def_property_subtype(prop, PROP_FACTOR);
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 3d4b2ac..b1e9fd2 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1383,6 +1383,9 @@ typedef struct DataTransferModifierData {
 
        float map_max_distance;
        float map_ray_radius;
+       float islands_precision;
+
+       int pad_i1;
 
        int layers_select_src[4];  /* DT_MULTILAYER_INDEX_MAX; See 
DT_FROMLAYERS_ enum in ED_object.h */
        int layers_select_dst[4];  /* DT_MULTILAYER_INDEX_MAX; See DT_TOLAYERS_ 
enum in ED_object.h */
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 915825f..e4d735f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4202,6 +4202,12 @@ static void rna_def_modifier_datatransfer(BlenderRNA 
*brna)
        RNA_def_property_subtype(prop, PROP_DISTANCE);
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+       prop = RNA_def_float(srna, "islands_precision", 0.0f, 0.0f, 1.0f, 
"Islands Handling Refinement",
+                            "Factor controlling precision of islands handling "
+                            "(typically, 0.1 should be enough, higher values 
can make things really slow)", 0.0f, 1.0f);
+       RNA_def_property_subtype(prop, PROP_DISTANCE);
+       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
        /* How to handle multi-layers types of data. */
        prop = RNA_def_enum(srna, "layers_vgroup_select_src", 
DT_layers_select_src_items, DT_LAYERS_ALL_SRC,
                            "Source Layers Selection", "Which layers to 
transfer, in case of multi-layers types");
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c 
b/source/blender/modifiers/intern/MOD_datatransfer.c
index dcb979f..06f9d27 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -151,6 +151,8 @@ static bool isDisabled(ModifierData *md, int 
UNUSED(useRenderParams))
        return (dtmd->ob_source == NULL);
 }
 
+#define HIGH_POLY_WARNING 10000
+
 static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh 
*derivedData,
                                   ModifierApplyFlag UNUSED(flag))
 {
@@ -181,6 +183,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object 
*ob, DerivedMesh *der
        if (BKE_reports_contain(&reports, RPT_ERROR)) {
                modifier_setError(md, "%s", BKE_reports_string(&reports, 
RPT_ERROR));
        }
+       else if (dm->getNumVerts(dm) > HIGH_POLY_WARNING || ((Mesh 
*)(dtmd->ob_source->data))->totvert > HIGH_POLY_WARNING) {
+               modifier_setError(md, "You are using a rather high poly as 
source or destination, computation might be slow");
+       }
 
        return dm;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to