[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31770] branches/soc-2010-nicolasbishop: = = Ptex ==
Nicholas Bishop
nicholasbishop at gmail.com
Sun Sep 5 21:10:11 CEST 2010
Revision: 31770
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31770
Author: nicholasbishop
Date: 2010-09-05 21:10:11 +0200 (Sun, 05 Sep 2010)
Log Message:
-----------
== Ptex ==
* Fixed blurring brush to work with ptex
* Added a convert operator to convert ptex data between 8-bit, 16-bit, and float
Still has some issues; blurring 8-bit data darkens it, and there are small seams between tiles
Modified Paths:
--------------
branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_mesh.py
branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py
branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_ptex.h
branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/ptex.c
branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ptex.c
Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_mesh.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_mesh.py 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_mesh.py 2010-09-05 19:10:11 UTC (rev 31770)
@@ -268,6 +268,7 @@
col = row.column(align=True)
col.operator("ptex.layer_remove", icon='ZOOMOUT', text="")
+ layout.operator_menu_enum("ptex.layer_convert", "type")
layout.operator_menu_enum("ptex.layer_add", "type")
row = layout.row()
row.operator("ptex.open")
Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_modifier.py 2010-09-05 19:10:11 UTC (rev 31770)
@@ -396,7 +396,7 @@
col.prop(md, "levels", text="Preview")
col.prop(md, "edit_levels", text="Edit")
col.prop(md, "render_levels", text="Render")
- col.prop(md, "optimal_display")
+ col.prop(md, "show_only_control_edges")
col = split.column()
@@ -405,7 +405,6 @@
col.operator("object.multires_higher_levels_delete", text="Delete Higher")
col.operator("object.multires_reshape", text="Reshape")
col.operator("object.multires_base_apply", text="Apply Base")
- col.prop(md, "show_only_control_edges")
layout.separator()
Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-09-05 19:10:11 UTC (rev 31770)
@@ -1079,13 +1079,13 @@
col = split.column()
col.label(text="Mirror:")
- col.prop(sculpt, "use_symmetry_x", text="X")
- col.prop(sculpt, "use_symmetry_y", text="Y")
- col.prop(sculpt, "use_symmetry_z", text="Z")
+ col.prop(paint, "use_symmetry_x", text="X")
+ col.prop(paint, "use_symmetry_y", text="Y")
+ col.prop(paint, "use_symmetry_z", text="Z")
col = split.column()
- col.prop(sculpt, "radial_symmetry", text="Radial")
+ col.prop(paint, "radial_symmetry", text="Radial")
col = layout.column()
Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_ptex.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_ptex.h 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_ptex.h 2010-09-05 19:10:11 UTC (rev 31770)
@@ -33,6 +33,9 @@
struct MPtexSubface;
struct PtexTextureHandle;
+void ptex_elem_to_floats(int type, int channels, void *data, float *out);
+void ptex_elem_from_floats(int type, int channels, void *data, float *in);
+
struct DerivedMesh *quad_dm_create_from_derived(struct DerivedMesh *dm);
void ptex_subface_scale(struct MPtex *pt, struct MPtexSubface *subface, int ures, int vres);
void ptex_layer_from_file(struct Mesh *me, struct PtexTextureHandle *ptex_texture);
Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/ptex.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/ptex.c 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/ptex.c 2010-09-05 19:10:11 UTC (rev 31770)
@@ -60,44 +60,66 @@
return ccgdm;
}
-static void ptex_elem_to_floats_mul_add(MPtex *pt, void *data, float *out, float fac)
+void ptex_elem_to_floats(int type, int channels, void *data, float *out)
{
int i;
- switch(pt->type) {
+ switch(type) {
case PTEX_DT_UINT8:
- for(i = 0; i < pt->channels; ++i)
- out[i] += (((unsigned char*)data)[i] / 255.0) * fac;
+ for(i = 0; i < channels; ++i)
+ out[i] = ((unsigned char*)data)[i] / 255.0;
break;
case PTEX_DT_UINT16:
- for(i = 0; i < pt->channels; ++i)
- out[i] += (((unsigned char*)data)[i] / 65535.0) * fac;
+ for(i = 0; i < channels; ++i)
+ out[i] = ((unsigned char*)data)[i] / 65535.0;
break;
case PTEX_DT_FLOAT:
- for(i = 0; i < pt->channels; ++i)
- out[i] += ((float*)data)[i] * fac;
+ for(i = 0; i < channels; ++i)
+ out[i] = ((float*)data)[i];
break;
default:
break;
}
}
-static void ptex_elem_from_floats(MPtex *pt, void *data, float *in)
+void ptex_elem_from_floats(int type, int channels, void *data, float *in)
{
int i;
+ switch(type) {
+ case PTEX_DT_UINT8:
+ for(i = 0; i < channels; ++i)
+ ((unsigned char*)data)[i] = in[i] * 255;
+ break;
+ case PTEX_DT_UINT16:
+ for(i = 0; i < channels; ++i)
+ ((unsigned short*)data)[i] = in[i] * 65535;
+ break;
+ case PTEX_DT_FLOAT:
+ for(i = 0; i < channels; ++i)
+ ((float*)data)[i] = in[i];
+ break;
+ default:
+ break;
+ }
+}
+
+static void ptex_elem_to_floats_mul_add(MPtex *pt, void *data, float *out, float fac)
+{
+ int i;
+
switch(pt->type) {
case PTEX_DT_UINT8:
for(i = 0; i < pt->channels; ++i)
- ((unsigned char*)data)[i] = in[i] * 255;
+ out[i] += (((unsigned char*)data)[i] / 255.0) * fac;
break;
case PTEX_DT_UINT16:
for(i = 0; i < pt->channels; ++i)
- ((unsigned short*)data)[i] = in[i] * 65535;
+ out[i] += (((unsigned char*)data)[i] / 65535.0) * fac;
break;
case PTEX_DT_FLOAT:
for(i = 0; i < pt->channels; ++i)
- ((float*)data)[i] = in[i];
+ out[i] += ((float*)data)[i] * fac;
break;
default:
break;
@@ -129,7 +151,7 @@
ptex_elem_to_floats_mul_add(pt, input_start + layersize * (yi*rowlen+xt), tmp, s*v);
ptex_elem_to_floats_mul_add(pt, input_start + layersize * (yt*rowlen+xt), tmp, s*t);
ptex_elem_to_floats_mul_add(pt, input_start + layersize * (yt*rowlen+xi), tmp, u*t);
- ptex_elem_from_floats(pt, out, tmp);
+ ptex_elem_from_floats(pt->type, pt->channels, out, tmp);
}
/* interpolate subface to new resolution */
Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 2010-09-05 19:10:11 UTC (rev 31770)
@@ -2307,6 +2307,7 @@
adjf = ccgSubSurf_getEdgeFace(e, i);
if(adjf != f) {
+ /* within the adjacent face, find the side [0-3] */
numEdges = ccgSubSurf_getFaceNumVerts(adjf);
for(j = 0; j < numEdges; j++)
if(ccgSubSurf_getFaceEdge(ss, adjf, j) == e)
@@ -2319,6 +2320,7 @@
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
+ /* offset to choose the subface (there are two subfaces per edge) */
return gridOffset[fIndex] + (j + offset)%numEdges;
}
@@ -2370,12 +2372,12 @@
adj->index[0] = gIndex - S + nextS;
adj->rotation[0] = 3;
- adj->index[1] = ccgdm_adjacent_grid(ss, gridOffset, f, prevS, 0);
- adj->rotation[1] = 1;
- adj->index[2] = ccgdm_adjacent_grid(ss, gridOffset, f, S, 1);
- adj->rotation[2] = 3;
+ adj->index[1] = ccgdm_adjacent_grid(ss, gridOffset, f, S, 1);
+ adj->rotation[1] = 2;
+ adj->index[2] = ccgdm_adjacent_grid(ss, gridOffset, f, prevS, 0);
+ adj->rotation[2] = 1;
adj->index[3] = gIndex - S + prevS;
- adj->rotation[3] = 1;
+ adj->rotation[3] = 0;
}
}
Modified: branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h 2010-09-05 19:10:11 UTC (rev 31770)
@@ -134,8 +134,6 @@
PBVH_UpdateVertBuffers |
PBVH_UpdateColorBuffers |
PBVH_UpdateRedraw,
-
- PBVH_NeedsColorStitch = 128
} PBVHNodeFlags;
void BLI_pbvh_node_mark_update(PBVHNode *node);
Modified: branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c 2010-09-05 19:10:11 UTC (rev 31770)
@@ -1291,7 +1291,7 @@
pbvh_iter_begin(&iter, bvh, NULL, NULL);
while((node=pbvh_iter_next(&iter))) {
- if(node->flag & (PBVH_UpdateNormals|PBVH_NeedsColorStitch)) {
+ if(node->flag & (PBVH_UpdateNormals)) {
for(i = 0; i < node->totprim; ++i) {
face= bvh->gridfaces[node->prim_indices[i]];
if(!BLI_ghash_lookup(map, face))
@@ -1300,8 +1300,6 @@
if(clear)
node->flag &= ~PBVH_UpdateNormals;
-
- node->flag &= ~PBVH_NeedsColorStitch;
}
}
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-09-05 19:10:11 UTC (rev 31770)
@@ -255,6 +255,7 @@
void PTEX_OT_layer_add(struct wmOperatorType *ot);
void PTEX_OT_layer_remove(struct wmOperatorType *ot);
void PTEX_OT_layer_save(struct wmOperatorType *ot);
+void PTEX_OT_layer_convert(struct wmOperatorType *ot);
void PTEX_OT_open(struct wmOperatorType *ot);
void PTEX_OT_face_resolution_set(struct wmOperatorType *ot);
void PTEX_OT_subface_select(struct wmOperatorType *ot);
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c 2010-09-05 16:04:12 UTC (rev 31769)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c 2010-09-05 19:10:11 UTC (rev 31770)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list