Revision: 38701
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38701
Author: psy-fi
Date: 2011-07-25 17:03:05 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
-smart stitch: Never say never, another bug fix todo with preview of island
snapping. If an uv was shared by a stitchable and non stitchable edge, it got
wrong preview result.
-export weights as images in uv space: GUI stuff, implementation pending(hooked
into projected export for now) This has been requested in youtube commments
with a well defined use case: export weights, retopologize and reimport. In
order for this to work, I have to define a good margin in uv space so that on
import(next todo) weights are not missed on outer uv edges.
Modified Paths:
--------------
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
Modified:
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
---
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
2011-07-25 16:37:10 UTC (rev 38700)
+++
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
2011-07-25 17:03:05 UTC (rev 38701)
@@ -1126,7 +1126,8 @@
col.operator("object.vertex_group_invert", text="Invert")
col.operator("object.vertex_group_clean", text="Clean")
col.operator("object.vertex_group_levels", text="Levels")
- col.operator("paint.weight_layers_image_from_view", text="Save Weight
Images")
+ col.operator("paint.weight_layers_images_from_view", text="Save Weight
Projected Images")
+ col.operator("paint.weight_layers_to_uv_images", text="Save Weight UV
Images")
#lazy stuff, but maybe not so, export size should be unified. Maybe add
better description to rna?
row = col.row(align=True)
row.prop(ipaint, "screen_grab_size", text="")
Modified:
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
2011-07-25 16:37:10 UTC (rev 38700)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
2011-07-25 17:03:05 UTC (rev 38701)
@@ -5599,7 +5599,7 @@
/* This function is actually a selection of the code path implemented by
texture_paint_image_from_view_exec.
* We really don't need all checks + we need to draw only the selected object
*/
-static int weight_layers_image_from_view_exec(bContext *C, wmOperator *op)
+static int weight_layers_images_from_view_exec(bContext *C, wmOperator *op)
{
// char filename[FILE_MAX];
Scene *scene= CTX_data_scene(C);
@@ -5620,15 +5620,15 @@
}
-void PAINT_OT_weight_layers_image_from_view(wmOperatorType *ot)
+void PAINT_OT_weight_layers_images_from_view(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Weight layers image from View";
- ot->idname= "PAINT_OT_weight_layers_image_from_view";
+ ot->idname= "PAINT_OT_weight_layers_images_from_view";
ot->description= "Make multiple png images from vertex group of the
active object as seen from the current view";
/* api callbacks */
- ot->exec= weight_layers_image_from_view_exec;
+ ot->exec= weight_layers_images_from_view_exec;
ot->poll= ED_operator_region_view3d_active;
/* flags */
@@ -5637,3 +5637,45 @@
/* Copied from above, may come in handy */
// RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File
Path", "Name of the file");
}
+
+
+/* This function is actually a selection of the code path implemented by
texture_paint_image_from_view_exec.
+ * We really don't need all checks + we need to draw only the selected object
*/
+static int weight_layers_to_uv_images_exec(bContext *C, wmOperator *op)
+{
+// char filename[FILE_MAX];
+ Scene *scene= CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ ARegion *ar = CTX_wm_region(C);
+ Object *ob = CTX_data_active_object(C);
+
+ ToolSettings *settings= scene->toolsettings;
+ int w= settings->imapaint.screen_grab_size[0];
+ int h= settings->imapaint.screen_grab_size[1];
+
+ if(view3d_weight_offscreen_draw(scene, v3d, ar, ob, w, h))
+ return OPERATOR_FINISHED;
+ else return OPERATOR_CANCELLED;
+
+// RNA_string_get(op->ptr, "filepath", filename);
+
+
+}
+
+void PAINT_OT_weight_layers_to_uv_images(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Weight layers uv images";
+ ot->idname= "PAINT_OT_weight_layers_to_uv_images";
+ ot->description= "Make multiple png images from vertex group of the
active object in uv space";
+
+ /* api callbacks */
+ ot->exec= weight_layers_to_uv_images_exec;
+ ot->poll= ED_operator_region_view3d_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER;
+
+ /* Copied from above, may come in handy */
+// RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File
Path", "Name of the file");
+}
Modified:
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
2011-07-25 16:37:10 UTC (rev 38700)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
2011-07-25 17:03:05 UTC (rev 38701)
@@ -137,7 +137,8 @@
void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_project_image(struct wmOperatorType *ot);
void PAINT_OT_image_from_view(struct wmOperatorType *ot);
-void PAINT_OT_weight_layers_image_from_view(struct wmOperatorType *ot);
+void PAINT_OT_weight_layers_images_from_view(struct wmOperatorType *ot);
+void PAINT_OT_weight_layers_to_uv_images(struct wmOperatorType *ot);
/* paint_utils.c */
void projectf(struct bglMats *mats, const float v[3], float p[2]);
Modified:
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
2011-07-25 16:37:10 UTC (rev 38700)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
2011-07-25 17:03:05 UTC (rev 38701)
@@ -392,7 +392,8 @@
WM_operatortype_append(PAINT_OT_weight_from_bones);
WM_operatortype_append(PAINT_OT_weight_sample);
WM_operatortype_append(PAINT_OT_weight_sample_group);
- WM_operatortype_append(PAINT_OT_weight_layers_image_from_view);
+ WM_operatortype_append(PAINT_OT_weight_layers_images_from_view);
+ WM_operatortype_append(PAINT_OT_weight_layers_to_uv_images);
/* vertex */
WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
2011-07-25 16:37:10 UTC (rev 38700)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
2011-07-25 17:03:05 UTC (rev 38701)
@@ -1890,15 +1890,12 @@
/* we will have to calculate the
rotation of the edges here */
if(state->snapIslands && element->flag
& STITCH_EDGE_STITCHABLE){
stitch_island_calculate_rotation(element, i, state, uv_average,
island_stitch_data);
- }else{
- /* clear here or it may not be
cleared if it's not on a previewable island. Previewable islands get cleared in
- *
stitch_calculate_island_snapping */
- element->flag = 0;
}
}
+
}
/* Clearing flags is VERY important since preview
allocation depends on them. Failure to do so could result in crashes */
- if(!state->snapIslands){
+ if(!state->snapIslands || (state->snapIslands &&
!(element->flag & STITCH_STITCHABLE))){
element->flag = 0;
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs