Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-21 15:19:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-21 15:19:16 +0400
commitf9467d28b99a620631ed1c2d249532b2dba46f67 (patch)
treed6b16f77679766ee8fe69094c88f9234fe6dad2a
parentfd44038ed754f58ddfe48228bfb5fa41ea367e65 (diff)
remove sticky coordinates from blender, this was missing from the UI since 2.49.
TODO - drop support from the renderer still.
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/intern/mesh.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c16
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c184
-rw-r--r--source/blender/editors/mesh/mesh_intern.h4
-rw-r--r--source/blender/editors/mesh/mesh_ops.c5
-rw-r--r--source/blender/makesdna/DNA_material_types.h4
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c26
-rw-r--r--source/blender/render/intern/source/convertblender.c59
12 files changed, 22 insertions, 286 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 47e18d4917c..db1139c9c7b 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 20
+#define BLENDER_SUBVERSION 21
/* 262 was the last editmesh release but its has compatibility code for bmesh data,
* so set the minversion to 2.61 */
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index c0705d677a9..206d80a6ff0 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -367,7 +367,6 @@ void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd)
me->mvert = CustomData_get_layer(&me->vdata, CD_MVERT);
me->dvert = CustomData_get_layer(&me->vdata, CD_MDEFORMVERT);
- me->msticky = CustomData_get_layer(&me->vdata, CD_MSTICKY);
me->medge = CustomData_get_layer(&me->edata, CD_MEDGE);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index aa80a6bcff5..3c1668de8de 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3821,7 +3821,6 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
mesh->tface = newdataadr(fd, mesh->tface);
mesh->mtface = newdataadr(fd, mesh->mtface);
mesh->mcol = newdataadr(fd, mesh->mcol);
- mesh->msticky = newdataadr(fd, mesh->msticky);
mesh->dvert = newdataadr(fd, mesh->dvert);
mesh->mloopcol = newdataadr(fd, mesh->mloopcol);
mesh->mloopuv = newdataadr(fd, mesh->mloopuv);
@@ -7986,6 +7985,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ /* remove texco */
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 21)) {
+ Material *ma;
+ for (ma = main->mat.first; ma; ma = ma->id.next) {
+ int a;
+ for (a = 0; a < MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
+ if (ma->mtex[a]->texco == TEXCO_STICKY) {
+ ma->mtex[a]->texco = TEXCO_UV;
+ }
+ }
+ }
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 5f7252b65bf..d8333e7c8f4 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -387,8 +387,6 @@ static void customdata_version_242(Mesh *me)
if (!me->vdata.totlayer) {
CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
- if (me->msticky)
- CustomData_add_layer(&me->vdata, CD_MSTICKY, CD_ASSIGN, me->msticky, me->totvert);
if (me->dvert)
CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_ASSIGN, me->dvert, me->totvert);
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 1417641e803..c6bff317584 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -747,118 +747,6 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/*********************** sticky operators ************************/
-
-static Object *mesh_customdata_get_camera_for_sticky(wmOperator *op, Scene *scene, View3D *v3d)
-{
- /* report an error if we can't find the camera */
-
- Object *camera = NULL;
- if (scene->obedit) {
- BKE_report(op->reports, RPT_ERROR, "Unable to make sticky in Edit Mode");
- }
- else {
- if (v3d) camera = V3D_CAMERA_LOCAL(v3d);
- if (camera == NULL) camera = scene->camera;
-
- if (camera == NULL) {
- BKE_report(op->reports, RPT_ERROR, "Need camera to make sticky");
- }
- }
-
- return camera;
-}
-
-static int mesh_customdata_add_sticky_selected_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- View3D *v3d = CTX_wm_view3d(C);
- Object *camera = mesh_customdata_get_camera_for_sticky(op, scene, v3d);
- LinkNode *objects = NULL;
- LinkNode *ob_iter;
-
- if (camera == NULL) {
- return OPERATOR_CANCELLED;
- }
-
- CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects)
- {
- if (ob->type == OB_MESH) {
- BLI_linklist_prepend(&objects, ob);
- }
- }
- CTX_DATA_END;
-
- if (objects == NULL) {
- return OPERATOR_CANCELLED;
- }
-
- RE_make_sticky(scene, camera, objects);
-
- for (ob_iter = objects; ob_iter; ob_iter = ob_iter->next) {
- Object *ob = ob_iter->link;
- DAG_id_tag_update(ob->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
- }
-
- BLI_linklist_free(objects, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_customdata_create_sticky_selected(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Calculate Sticky for Selection";
- ot->description = "Calculate sticky UV texture layer from the camera on selected objects";
- ot->idname = "MESH_OT_customdata_create_sticky_selected";
-
- /* api callbacks */
- ot->poll = layers_poll;
- ot->exec = mesh_customdata_add_sticky_selected_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int mesh_customdata_add_sticky_exec(bContext *C, wmOperator *op)
-{
- Object *obedit = ED_object_context(C);
- Scene *scene = CTX_data_scene(C);
- View3D *v3d = CTX_wm_view3d(C);
- Object *camera = mesh_customdata_get_camera_for_sticky(op, scene, v3d);
- LinkNode objects = {NULL};
-
- if (camera == NULL) {
- return OPERATOR_CANCELLED; /* error is set */
- }
-
- objects.link = obedit;
- objects.next = NULL;
-
- RE_make_sticky(scene, camera, &objects);
-
- DAG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_customdata_create_sticky(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Calculate Sticky";
- ot->description = "Calculate sticky UV texture layer from the camera";
- ot->idname = "MESH_OT_customdata_create_sticky";
-
- /* api callbacks */
- ot->poll = layers_poll;
- ot->exec = mesh_customdata_add_sticky_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/* *** CustomData clear functions, we need an operator for each *** */
static int mesh_customdata_clear_exec__internal(bContext *C,
@@ -925,78 +813,6 @@ void MESH_OT_customdata_clear_mask(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* Clear Sticky */
-static int mesh_customdata_clear_sticky_poll(bContext *C)
-{
- Object *ob = ED_object_context(C);
-
- if (ob && ob->type == OB_MESH) {
- Mesh *me = ob->data;
- if (me->id.lib == NULL) {
- CustomData *data = GET_CD_DATA(me, vdata);
- if (CustomData_has_layer(data, CD_MSTICKY)) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-static int mesh_customdata_clear_sticky_exec(bContext *C, wmOperator *UNUSED(op))
-{
- return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_MSTICKY);
-}
-
-void MESH_OT_customdata_clear_sticky(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear Sticky Data";
- ot->idname = "MESH_OT_customdata_clear_sticky";
- ot->description = "Clear vertex sticky UV texture layer";
-
- /* api callbacks */
- ot->exec = mesh_customdata_clear_sticky_exec;
- ot->poll = mesh_customdata_clear_sticky_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-/* Clear Skin */
-static int mesh_customdata_clear_skin_poll(bContext *C)
-{
- Object *ob = ED_object_context(C);
-
- if (ob && ob->type == OB_MESH) {
- Mesh *me = ob->data;
- if (me->id.lib == NULL) {
- CustomData *data = GET_CD_DATA(me, vdata);
- if (CustomData_has_layer(data, CD_MVERT_SKIN)) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-static int mesh_customdata_clear_skin_exec(bContext *C, wmOperator *UNUSED(op))
-{
- return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_MVERT_SKIN);
-}
-
-void MESH_OT_customdata_clear_skin(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear Skin Data";
- ot->idname = "MESH_OT_customdata_clear_skin";
- ot->description = "Clear vertex skin layer";
-
- /* api callbacks */
- ot->exec = mesh_customdata_clear_skin_exec;
- ot->poll = mesh_customdata_clear_skin_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/************************** Add Geometry Layers *************************/
void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 82da2aedd47..786910dc938 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -187,12 +187,8 @@ void MESH_OT_uv_texture_add(struct wmOperatorType *ot);
void MESH_OT_uv_texture_remove(struct wmOperatorType *ot);
void MESH_OT_vertex_color_add(struct wmOperatorType *ot);
void MESH_OT_vertex_color_remove(struct wmOperatorType *ot);
-void MESH_OT_customdata_create_sticky_selected(struct wmOperatorType *ot);
-void MESH_OT_customdata_create_sticky(struct wmOperatorType *ot);
-void MESH_OT_customdata_clear_sticky(struct wmOperatorType *ot);
/* no create_mask yet */
void MESH_OT_customdata_clear_mask(struct wmOperatorType *ot);
-void MESH_OT_customdata_clear_skin(struct wmOperatorType *ot);
void MESH_OT_drop_named_image(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 840f0498e7e..3c92df3dc8e 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -134,7 +134,6 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_vertices_smooth);
WM_operatortype_append(MESH_OT_noise);
WM_operatortype_append(MESH_OT_flip_normals);
- //WM_operatortype_append(MESH_OT_knife_cut);
WM_operatortype_append(MESH_OT_rip);
WM_operatortype_append(MESH_OT_blend_from_shape);
WM_operatortype_append(MESH_OT_shape_propagate_to_all);
@@ -143,11 +142,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_uv_texture_remove);
WM_operatortype_append(MESH_OT_vertex_color_add);
WM_operatortype_append(MESH_OT_vertex_color_remove);
- WM_operatortype_append(MESH_OT_customdata_create_sticky_selected);
- WM_operatortype_append(MESH_OT_customdata_create_sticky);
- WM_operatortype_append(MESH_OT_customdata_clear_sticky);
WM_operatortype_append(MESH_OT_customdata_clear_mask);
- WM_operatortype_append(MESH_OT_customdata_clear_skin);
WM_operatortype_append(MESH_OT_drop_named_image);
WM_operatortype_append(MESH_OT_edgering_select);
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 940c5c5f30b..af300e3d615 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -140,6 +140,8 @@ typedef struct Material {
float param[4]; /* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */
float rms;
float darkness;
+
+ /* runtime - OR'd from 'mtex' */
short texco, mapto;
/* ramp colors */
@@ -337,7 +339,7 @@ typedef struct Material {
#define TEXCO_OBJECT 32
#define TEXCO_LAVECTOR 64
#define TEXCO_VIEW 128
-#define TEXCO_STICKY 256
+#define TEXCO_STICKY 256 // DEPRECATED
#define TEXCO_OSA 512
#define TEXCO_WINDOW 1024
#define NEED_UV 2048
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index e584cfd76ac..c7f90eea176 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -89,8 +89,7 @@ typedef struct Mesh {
/* array of colors for the tessellated faces, must be number of tessellated
* faces * 4 in length */
- struct MCol *mcol;
- struct MSticky *msticky;
+ struct MCol *mcol;
struct Mesh *texcomesh;
/* When the object is available, the preferred access method is: BMEdit_FromObject(ob) */
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 4523858d639..bae64ec76f7 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -45,7 +45,7 @@ static EnumPropertyItem prop_texture_coordinates_items[] = {
{TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
{TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
"Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
- {TEXCO_STICKY, "STICKY", 0, "Sticky", "Use mesh's sticky coordinates for the texture coordinates"},
+// {TEXCO_STICKY, "STICKY", 0, "Sticky", "Use mesh's sticky coordinates for the texture coordinates"},
{TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
{TEXCO_NORM, "NORMAL", 0, "Normal", "Use normal vector as texture coordinates"},
{TEXCO_REFL, "REFLECTION", 0, "Reflection", "Use reflection vector as texture coordinates"},
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 8d4681b4f12..74c4dab4392 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1204,11 +1204,6 @@ static char *rna_MeshColor_path(PointerRNA *ptr)
return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
}
-static char *rna_MeshSticky_path(PointerRNA *ptr)
-{
- return BLI_sprintfN("sticky[%d]", (int)((MSticky *)ptr->data - rna_mesh(ptr)->msticky));
-}
-
static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
{
return BLI_sprintfN("int_layers[\"%s\"]", ((CustomDataLayer *)ptr->data)->name);
@@ -1957,21 +1952,6 @@ static void rna_def_mtexpoly(BlenderRNA *brna)
#endif
}
-static void rna_def_msticky(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshSticky", NULL);
- RNA_def_struct_sdna(srna, "MSticky");
- RNA_def_struct_ui_text(srna, "Mesh Vertex Sticky Texture Coordinate", "Sticky texture coordinate");
- RNA_def_struct_path_func(srna, "rna_MeshSticky_path");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_ui_text(prop, "Location", "Sticky texture coordinate location");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-}
-
static void rna_def_mcol(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2696,11 +2676,6 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
rna_def_mesh_polygons(brna, prop);
- prop = RNA_def_property(srna, "sticky", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "msticky", "totvert");
- RNA_def_property_struct_type(prop, "MeshSticky");
- RNA_def_property_ui_text(prop, "Sticky", "Sticky texture coordinates");
-
/* TODO, should this be allowed to be its self? */
prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
@@ -3036,7 +3011,6 @@ void RNA_def_mesh(BlenderRNA *brna)
rna_def_mloopuv(brna);
rna_def_mtface(brna);
rna_def_mtexpoly(brna);
- rna_def_msticky(brna);
rna_def_mcol(brna);
rna_def_mloopcol(brna);
rna_def_mproperties(brna);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index d04cca8552c..da1c40ba714 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3335,7 +3335,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
if (do_autosmooth && me->totvert==totvert && me->totface==dm->getNumTessFaces(dm))
use_original_normals= TRUE;
- ms = (totvert==me->totvert)?me->msticky:NULL;
+ ms = NULL; /* STICKY_TODO */
ma= give_render_material(re, ob, 1);
@@ -5815,60 +5815,3 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
if (re->r.mode & R_SHADOW)
make_occ_tree(re);
}
-
-/* ------------------------------------------------------------------------- */
-/* Sticky texture coords */
-/* ------------------------------------------------------------------------- */
-
-static void re_make_sticky_object(Render *re, Object *ob)
-{
- MVert *mvert;
- Mesh *me;
- MSticky *ms;
- float mat[4][4];
- float ho[4];
- int a;
-
- me = ob->data;
- mvert = me->mvert;
-
- if (me->msticky) {
- CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
- }
-
- me->msticky = CustomData_add_layer(&me->vdata, CD_MSTICKY, CD_CALLOC, NULL, me->totvert);
-
- mult_m4_m4m4(mat, re->viewmat, ob->obmat);
-
- ms = me->msticky;
- for (a=0; a < me->totvert; a++, ms++, mvert++) {
- copy_v3_v3(ho, mvert->co);
- mul_m4_v3(mat, ho);
- projectverto(ho, re->winmat, ho);
- ms->co[0] = ho[0] / ho[3];
- ms->co[1] = ho[1] / ho[3];
- }
-}
-
-void RE_make_sticky(Scene *scene, Object *camera, LinkNode *objects)
-{
- Render *re;
- float mat[4][4];
- LinkNode *ob_iter;
-
- re = RE_NewRender("_make sticky_");
- RE_InitState(re, NULL, &scene->r, NULL, scene->r.xsch, scene->r.ysch, NULL);
-
- /* use renderdata and camera to set viewplane */
- RE_SetCamera(re, camera);
-
- /* and set view matrix */
- normalize_m4(camera->obmat);
- invert_m4_m4(mat, camera->obmat);
- RE_SetView(re, mat);
-
- for (ob_iter = objects; ob_iter; ob_iter = ob_iter->next) {
- re_make_sticky_object(re, ob_iter->link);
- }
-}
-