uiBlockSetEmboss(block, UI_EMBOSS);
/* mode */
- if(ob)
+ if(ob) {
+ /*sanity point checkpoint, put here to avoid seeding
+ this same code in 10 different other places.*/
+ if (!ob->mode)
+ ob->mode = OB_MODE_OBJECT;
+
v3d->modeselect = ob->mode;
- else
+ } else {
v3d->modeselect = OB_MODE_OBJECT;
-
+ }
+
- uiBlockBeginAlign(block);
+ row= uiLayoutRow(layout, 1);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,
0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode"));
- uiBlockEndAlign(block);
/* Draw type */
uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
#include "transform.h"
- void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg);
- int doEdgeSlide(TransInfo *t, float perc);
+#include <stdio.h>
+
+ static void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg);
+ static int doEdgeSlide(TransInfo *t, float perc);
/* ************************** SPACE DEPENDANT CODE **************************** */
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
- int doEdgeSlide(TransInfo *t, float perc)
+ static int doEdgeSlide(TransInfo *t, float perc)
{
SlideData *sld = t->customData;
- EditVert *ev, *nearest = sld->nearest;
- EditVert *centerVert, *upVert, *downVert;
- LinkNode *vertlist=sld->vertlist, *look;
- GHash *vertgh = sld->vhash;
- TransDataSlideVert *tempsv;
- float len;
- int prop=1, flip=0;
- /* UV correction vars */
- GHash **uvarray= sld->uvhash;
- const int uvlay_tot= sld->uvlay_tot;
- int uvlay_idx;
- TransDataSlideUv *suv;
- float uv_tmp[2];
- LinkNode *fuv_link;
-
- tempsv = BLI_ghash_lookup(vertgh,nearest);
-
- centerVert = editedge_getSharedVert(tempsv->up, tempsv->down);
- upVert = editedge_getOtherVert(tempsv->up, centerVert);
- downVert = editedge_getOtherVert(tempsv->down, centerVert);
-
- len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
- len = MAX2(len, 0);
-
- //Adjust Edgeloop
- if(prop) {
- look = vertlist;
- while(look) {
- EditVert *tempev;
- ev = look->link;
- tempsv = BLI_ghash_lookup(vertgh,ev);
-
- tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
- interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
-
- if (uvlay_tot) {
- for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
- suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
- if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
- fuv_link = suv->fuv_list;
- while (fuv_link) {
- copy_v2_v2(((float *)fuv_link->link), uv_tmp);
- fuv_link = fuv_link->next;
- }
- }
- }
- }
+ TransDataSlideVert *svlist = sld->sv, *sv;
+ float vec[3];
+ int i;
- look = look->next;
- }
- }
- else {
- //Non prop code
- look = vertlist;
- while(look) {
- float newlen, edgelen;
- ev = look->link;
- tempsv = BLI_ghash_lookup(vertgh,ev);
- edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co);
- newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f;
- if(newlen > 1.0f) {newlen = 1.0;}
- if(newlen < 0.0f) {newlen = 0.0;}
- if(flip == 0) {
- interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
- if (uvlay_tot) {
- /* dont do anything if no UVs */
- for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
- suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
- if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
- fuv_link = suv->fuv_list;
- while (fuv_link) {
- copy_v2_v2(((float *)fuv_link->link), uv_tmp);
- fuv_link = fuv_link->next;
- }
- }
- }
- }
- } else{
- interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
-
- if (uvlay_tot) {
- /* dont do anything if no UVs */
- for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
- suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
- if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
- fuv_link = suv->fuv_list;
- while (fuv_link) {
- copy_v2_v2(((float *)fuv_link->link), uv_tmp);
- fuv_link = fuv_link->next;
- }
- }
- }
- }
- }
- look = look->next;
- }
+ sld->perc = perc;
+ sv = svlist;
+ for (i=0; i<sld->totsv; i++, sv++) {
+ if (perc > 0.0f) {
+ copy_v3_v3(vec, sv->upvec);
+ mul_v3_fl(vec, perc);
+ add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
+ } else {
+ copy_v3_v3(vec, sv->downvec);
+ mul_v3_fl(vec, -perc);
+ add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
+ }
}
-
+
+ projectSVData(t, 0);
+
return 1;
}
/* EDIT MODE ACTIVE EDITMODE ELEMENT */
- if (t->obedit && t->obedit->type == OB_MESH) {
- BMEditSelection ese;
- BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh;
-
- if (EDBM_get_actSelection(em, &ese)) {
- EDBM_editselection_center(em, t->center, &ese);
- calculateCenter2D(t);
- break;
+ if (t->obedit) {
- if(t->obedit->type == OB_MESH) {
- EditSelection ese;
- EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data);
-
- if (EM_get_actSelection(em, &ese)) {
- EM_editselection_center(t->center, &ese);
++ if (t->obedit && t->obedit->type == OB_MESH) {
++ BMEditSelection ese;
++ BMEditMesh *em = ((Mesh*)t->obedit->data)->edit_btmesh;
++
++ if (EDBM_get_actSelection(em, &ese)) {
++ EDBM_editselection_center(em, t->center, &ese);
+ calculateCenter2D(t);
+ break;
+ }
+ }
+ else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
+ float center[3];
+ Curve *cu= (Curve *)t->obedit->data;
+
+ if (ED_curve_actSelection(cu, center)) {
+ copy_v3_v3(t->center, center);
+ calculateCenter2D(t);
+ break;
+ }
}
} /* END EDIT MODE ACTIVE ELEMENT */
--
++
calculateCenterMedian(t);
if((t->flag & (T_EDIT|T_POSE))==0)
{
return cdl;
}
+ static CustomDataLayer *rna_Mesh_int_property_new(struct Mesh *me, struct bContext *C, const char *name)
+ {
+ CustomDataLayer *cdl = NULL;
+ int index;
+
+ CustomData_add_layer_named(&me->fdata, CD_PROP_INT, CD_DEFAULT, NULL, me->totface, name);
+ index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_INT, name);
+
+ cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+
+ return cdl;
+ }
+
+ static CustomDataLayer *rna_Mesh_float_property_new(struct Mesh *me, struct bContext *C, const char *name)
+ {
+ CustomDataLayer *cdl = NULL;
+ int index;
+
+ CustomData_add_layer_named(&me->fdata, CD_PROP_FLT, CD_DEFAULT, NULL, me->totface, name);
+ index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_FLT, name);
+
+ cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+
+ return cdl;
+ }
+
+ static CustomDataLayer *rna_Mesh_string_property_new(struct Mesh *me, struct bContext *C, const char *name)
+ {
+ CustomDataLayer *cdl = NULL;
+ int index;
+
+ CustomData_add_layer_named(&me->fdata, CD_PROP_STR, CD_DEFAULT, NULL, me->totface, name);
+ index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_STR, name);
+
+ cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+
+ return cdl;
+ }
+
static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name)
{
- CustomData *fdata;
+ CustomData *pdata;
CustomDataLayer *cdl= NULL;
int index;
"rna_Mesh_float_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer");
RNA_def_property_ui_text(prop, "Float Property Layers", "");
+ rna_def_float_layers(brna, prop);
prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL,
"rna_Mesh_int_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshIntPropertyLayer");
RNA_def_property_ui_text(prop, "Int Property Layers", "");
+ rna_def_int_layers(brna, prop);
prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL,
"rna_Mesh_string_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshStringPropertyLayer");