diff options
Diffstat (limited to 'source/blender')
48 files changed, 499 insertions, 455 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 7233f9570f9..96c0371baf3 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -65,6 +65,8 @@ int BKE_imtype_supports_compress(const char imtype); int BKE_imtype_supports_quality(const char imtype); char BKE_imtype_valid_depths(const char imtype); +char BKE_imtype_from_arg(const char *arg); + struct anim *openanim(const char *name, int flags, int streamindex); void image_de_interlace(struct Image *ima, int odd); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5985049ea56..5dff3f5c3ac 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1303,9 +1303,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); - range_vni(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0); - range_vni(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0); - range_vni(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0); + range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0); + range_vn_i(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0); + range_vn_i(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0); } if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT)) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 13215635bc7..aeeee38d3b2 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1037,7 +1037,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 4: CD_MFACE */ {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL}, /* 5: CD_MTFACE */ - {sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL, + {sizeof(MTFace), "MTFace", 1, "UVMap", layerCopy_tface, NULL, layerInterp_tface, layerSwap_tface, layerDefault_tface}, /* 6: CD_MCOL */ /* 4 MCol structs per face */ @@ -1057,7 +1057,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 12: CD_PROP_STR */ {sizeof(MStringProperty), "MStringProperty",1,"String",layerCopy_propString,NULL,NULL,NULL}, /* 13: CD_ORIGSPACE */ - {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL, + {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVMap", layerCopy_origspace_face, NULL, layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face}, /* 14: CD_ORCO */ {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 714800e0e7b..b605b0722e9 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1307,7 +1307,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface) if (!tex) return; - /* get uv layer */ + /* get uv map */ CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->init_layername, uvname); tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname); if (!tface) return; @@ -2094,7 +2094,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) numOfFaces = dm->getNumFaces(dm); mface = dm->getTessFaceArray(dm); - /* get uv layer */ + /* get uv map */ CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->uvlayer_name, uvname); tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ef764f2394d..964e15f494d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -971,6 +971,47 @@ char BKE_imtype_valid_depths(const char imtype) } } + +/* string is from command line --render-format arg, keep in sync with + * creator.c help info */ +char BKE_imtype_from_arg(const char *imtype_arg) +{ + if (!strcmp(imtype_arg,"TGA")) return R_IMF_IMTYPE_TARGA; + else if (!strcmp(imtype_arg,"IRIS")) return R_IMF_IMTYPE_IRIS; +#ifdef WITH_DDS + else if (!strcmp(imtype_arg,"DDS")) return R_IMF_IMTYPE_DDS; +#endif + else if (!strcmp(imtype_arg,"JPEG")) return R_IMF_IMTYPE_JPEG90; + else if (!strcmp(imtype_arg,"IRIZ")) return R_IMF_IMTYPE_IRIZ; + else if (!strcmp(imtype_arg,"RAWTGA")) return R_IMF_IMTYPE_RAWTGA; + else if (!strcmp(imtype_arg,"AVIRAW")) return R_IMF_IMTYPE_AVIRAW; + else if (!strcmp(imtype_arg,"AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG; + else if (!strcmp(imtype_arg,"PNG")) return R_IMF_IMTYPE_PNG; + else if (!strcmp(imtype_arg,"AVICODEC")) return R_IMF_IMTYPE_AVICODEC; + else if (!strcmp(imtype_arg,"QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME; + else if (!strcmp(imtype_arg,"BMP")) return R_IMF_IMTYPE_BMP; +#ifdef WITH_HDR + else if (!strcmp(imtype_arg,"HDR")) return R_IMF_IMTYPE_RADHDR; +#endif +#ifdef WITH_TIFF + else if (!strcmp(imtype_arg,"TIFF")) return R_IMF_IMTYPE_TIFF; +#endif +#ifdef WITH_OPENEXR + else if (!strcmp(imtype_arg,"EXR")) return R_IMF_IMTYPE_OPENEXR; + else if (!strcmp(imtype_arg,"MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER; +#endif + else if (!strcmp(imtype_arg,"MPEG")) return R_IMF_IMTYPE_FFMPEG; + else if (!strcmp(imtype_arg,"FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER; +#ifdef WITH_CINEON + else if (!strcmp(imtype_arg,"CINEON")) return R_IMF_IMTYPE_CINEON; + else if (!strcmp(imtype_arg,"DPX")) return R_IMF_IMTYPE_DPX; +#endif +#ifdef WITH_OPENJPEG + else if (!strcmp(imtype_arg,"JP2")) return R_IMF_IMTYPE_JP2; +#endif + else return R_IMF_IMTYPE_INVALID; +} + int BKE_add_image_extension(char *string, const char imtype) { const char *extension= NULL; diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index cb15c6a597c..0fb79956282 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -197,17 +197,20 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]); /***************************** Array Functions *******************************/ /* attempted to follow fixed length vertex functions. names could be improved*/ -void range_vni(int *array, const int size, const int start); +double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size); +float normalize_vn_vn(float *array_tar, const float *array_src, const int size); +float normalize_vn(float *array_tar, const int size); +void range_vn_i(int *array_tar, const int size, const int start); void negate_vn(float *array_tar, const int size); void negate_vn_vn(float *array_tar, const float *array_src, const int size); -void mul_vn_fl(float *array, const int size, const float f); +void mul_vn_fl(float *array_tar, const int size, const float f); void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); void add_vn_vn(float *array_tar, const float *array_src, const int size); void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void sub_vn_vn(float *array_tar, const float *array_src, const int size); void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); -void fill_vni(int *array_tar, const int size, const int val); -void fill_vn(float *array_tar, const int size, const float val); +void fill_vn_i(int *array_tar, const int size, const int val); +void fill_vn_fl(float *array_tar, const int size, const float val); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index b4b9bf03803..0ea9934d3b6 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -392,7 +392,37 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) /***************************** Array Functions *******************************/ -void range_vni(int *array_tar, const int size, const int start) +double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size) +{ + double d= 0.0f; + const float *array_pt_a= array_src_a + (size-1); + const float *array_pt_b= array_src_b + (size-1); + int i= size; + while(i--) { d += *(array_pt_a--) * *(array_pt_b--); } + return d; +} + +float normalize_vn_vn(float *array_tar, const float *array_src, const int size) +{ + double d= dot_vn_vn(array_tar, array_src, size); + float d_sqrt; + if (d > 1.0e-35) { + d_sqrt= (float)sqrt(d); + mul_vn_vn_fl(array_tar, array_src, size, 1.0f/d_sqrt); + } + else { + fill_vn_fl(array_tar, size, 0.0f); + d_sqrt= 0.0f; + } + return d_sqrt; +} + +float normalize_vn(float *array_tar, const int size) +{ + return normalize_vn_vn(array_tar, array_tar, size); +} + +void range_vn_i(int *array_tar, const int size, const int start) { int *array_pt= array_tar + (size-1); int j= start + (size-1); @@ -464,14 +494,14 @@ void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_ while(i--) { *(tar--) = *(src_a--) - *(src_b--); } } -void fill_vni(int *array_tar, const int size, const int val) +void fill_vn_i(int *array_tar, const int size, const int val) { int *tar= array_tar + (size-1); int i= size; while(i--) { *(tar--) = val; } } -void fill_vn(float *array_tar, const int size, const float val) +void fill_vn_fl(float *array_tar, const int size, const float val) { float *tar= array_tar + (size-1); int i= size; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f49a6bec41f..4e6d05a2a48 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6561,8 +6561,8 @@ static void customdata_version_242(Mesh *me) if (layer->type == CD_MTFACE) { if (layer->name[0] == 0) { - if (mtfacen == 0) strcpy(layer->name, "UVTex"); - else sprintf(layer->name, "UVTex.%.3d", mtfacen); + if (mtfacen == 0) strcpy(layer->name, "UVMap"); + else sprintf(layer->name, "UVMap.%.3d", mtfacen); } mtfacen++; } diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 22a3b713161..8bc9755faae 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -196,7 +196,7 @@ void GeometryExporter::createPolylist(short material_index, COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD, makeUrl(makeTexcoordSourceId(geom_id, i)), 2, // offset always 2, this is only until we have optimized UV sets - i // set number equals UV layer index + i // set number equals UV map index ); til.push_back(input3); } diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp index ceb4b295f2f..40ca1bc3b0e 100644 --- a/source/blender/collada/InstanceWriter.cpp +++ b/source/blender/collada/InstanceWriter.cpp @@ -55,7 +55,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia ostr << translate_id(id_name(ma)) << a+1; COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid)); - // create <bind_vertex_input> for each uv layer + // create <bind_vertex_input> for each uv map Mesh *me = (Mesh*)ob->data; int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 4e2c29d1772..829ee5f290e 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -417,7 +417,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T me->totface = mesh->getFacesCount() + new_tris; me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface); - // allocate UV layers + // allocate UV Maps unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount(); for (i = 0; i < totuvset; i++) { @@ -433,7 +433,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T //this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i); } - // activate the first uv layer + // activate the first uv map if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0); UVDataWrapper uvs(mesh->getUVCoords()); diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index d329874e1ba..05f9248e0a6 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -569,7 +569,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* draw settings for stepped interpolation modifier */ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { - uiLayout *col, *subcol; + uiLayout *col, *sub; PointerRNA ptr; /* init the RNA-pointer */ @@ -584,17 +584,17 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho col= uiLayoutColumn(layout, 1); uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start")); - uiItemR(subcol, &ptr, "frame_start", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start")); + uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE); /* block 3: end range settings */ col= uiLayoutColumn(layout, 1); uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end")); - uiItemR(subcol, &ptr, "frame_end", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end")); + uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE); } /* --------------- */ @@ -602,7 +602,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); - uiLayout *box, *row, *subrow, *col; + uiLayout *box, *row, *sub, *col; uiBlock *block; uiBut *but; short width= 314; @@ -620,30 +620,30 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie block= uiLayoutGetBlock(row); // err... /* left-align -------------------------------------------- */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT); + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); uiBlockSetEmboss(block, UI_EMBOSSN); /* expand */ - uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* checkbox for 'active' status (for now) */ - uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* name */ if (fmi) - uiItemL(subrow, fmi->name, ICON_NONE); + uiItemL(sub, fmi->name, ICON_NONE); else - uiItemL(subrow, "<Unknown Modifier>", ICON_NONE); + uiItemL(sub, "<Unknown Modifier>", ICON_NONE); /* right-align ------------------------------------------- */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); /* 'mute' button */ - uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiBlockSetEmboss(block, UI_EMBOSSN); diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 192f5c10d07..57dd1ef5572 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -95,8 +95,8 @@ static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl) static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d) { uiLayout *box=NULL, *split=NULL; - uiLayout *col=NULL, *subcol=NULL; - uiLayout *row=NULL, *subrow=NULL; + uiLayout *col=NULL; + uiLayout *row=NULL, *sub=NULL; uiBlock *block; uiBut *but; PointerRNA ptr; @@ -120,17 +120,17 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con uiBlockSetEmboss(block, UI_EMBOSSN); /* left-align ............................... */ - subrow= uiLayoutRow(row, 0); + sub= uiLayoutRow(row, 0); /* active */ - block= uiLayoutGetBlock(subrow); + block= uiLayoutGetBlock(sub); icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; but= uiDefIconBut(block, BUT, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Set active layer"); uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); /* locked */ icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; - uiItemR(subrow, &ptr, "lock", 0, "", icon); + uiItemR(sub, &ptr, "lock", 0, "", icon); /* when layer is locked or hidden, only draw header */ if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) { @@ -138,7 +138,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con /* visibility button (only if hidden but not locked!) */ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) - uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); + uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); /* name */ @@ -146,14 +146,14 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con sprintf(name, "%s (Hidden)", gpl->info); else sprintf(name, "%s (Locked)", gpl->info); - uiItemL(subrow, name, ICON_NONE); + uiItemL(sub, name, ICON_NONE); /* delete button (only if hidden but not locked!) */ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { /* right-align ............................... */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); - block= uiLayoutGetBlock(subrow); // XXX... err... + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + block= uiLayoutGetBlock(sub); // XXX... err... but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer"); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); @@ -163,24 +163,24 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con else { /* draw rest of header -------------------------------- */ /* visibility button */ - uiItemR(subrow, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); + uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); /* frame locking */ // TODO: this needs its own icons... icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION; - uiItemR(subrow, &ptr, "lock_frame", 0, "", icon); + uiItemR(sub, &ptr, "lock_frame", 0, "", icon); uiBlockSetEmboss(block, UI_EMBOSS); /* name */ - uiItemR(subrow, &ptr, "info", 0, "", ICON_NONE); + uiItemR(sub, &ptr, "info", 0, "", ICON_NONE); /* delete 'button' */ uiBlockSetEmboss(block, UI_EMBOSSN); /* right-align ............................... */ - subrow= uiLayoutRow(row, 1); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); - block= uiLayoutGetBlock(subrow); // XXX... err... + sub= uiLayoutRow(row, 1); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + block= uiLayoutGetBlock(sub); // XXX... err... but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer"); uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl); @@ -196,32 +196,29 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con col= uiLayoutColumn(split, 0); /* color */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "color", 0, "", ICON_NONE); - uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + sub= uiLayoutColumn(col, 1); + uiItemR(sub, &ptr, "color", 0, "", ICON_NONE); + uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE); /* stroke thickness */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); /* debugging options */ if (G.f & G_DEBUG) { - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "show_points", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE); } /* right column ................... */ col= uiLayoutColumn(split, 0); /* onion-skinning */ - subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE); - uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep + sub= uiLayoutColumn(col, 1); + uiItemR(sub, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE); + uiItemR(sub, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep /* 3d-view specific drawing options */ if (is_v3d) { - subcol= uiLayoutColumn(col, 0); - uiItemR(subcol, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE); + uiItemR(col, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE); } } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index bf37396a17e..ced933e363b 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -513,8 +513,8 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) void MESH_OT_uv_texture_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add UV Texture"; - ot->description= "Add UV texture layer"; + ot->name= "Add UV Map"; + ot->description= "Add UV Map"; ot->idname= "MESH_OT_uv_texture_add"; @@ -601,8 +601,8 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) void MESH_OT_drop_named_image(wmOperatorType *ot) { /* identifiers */ - ot->name= "Assign Image to UV Texture"; - ot->description= "Assigns Image to active UV layer, or creates a UV layer"; + ot->name= "Assign Image to UV Map"; + ot->description= "Assigns Image to active UV Map, or creates a UV Map"; ot->idname= "MESH_OT_drop_named_image"; @@ -634,8 +634,8 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) void MESH_OT_uv_texture_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove UV Texture"; - ot->description= "Remove UV texture layer"; + ot->name= "Remove UV Map"; + ot->description= "Remove UV Map"; ot->idname= "MESH_OT_uv_texture_remove"; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 3bca2f46efe..c11778a1d15 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -263,7 +263,7 @@ typedef struct ProjPaintState { MVert *dm_mvert; MFace *dm_mface; MTFace *dm_mtface; - MTFace *dm_mtface_clone; /* other UV layer, use for cloning between layers */ + MTFace *dm_mtface_clone; /* other UV map, use for cloning between layers */ MTFace *dm_mtface_stencil; /* projection painting only */ @@ -1347,7 +1347,7 @@ static float project_paint_uvpixel_mask( /* Image Mask */ if (ps->do_layer_stencil) { - /* another UV layers image is masking this one's */ + /* another UV maps image is masking this one's */ ImBuf *ibuf_other; Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_stencil, face_index); const MTFace *tf_other = ps->dm_mtface_stencil + face_index; diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 51a24044deb..c1dfa97a508 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -136,7 +136,7 @@ static void graph_panel_view(const bContext *C, Panel *pa) SpaceIpo *sipo= CTX_wm_space_graph(C); Scene *scene= CTX_data_scene(C); PointerRNA spaceptr, sceneptr; - uiLayout *col, *subcol, *row; + uiLayout *col, *sub, *row; /* get RNA pointers for use when creating the UI elements */ RNA_id_pointer_create(&scene->id, &sceneptr); @@ -146,16 +146,16 @@ static void graph_panel_view(const bContext *C, Panel *pa) col= uiLayoutColumn(pa->layout, 0); uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE); - subcol= uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); - uiItemO(subcol, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump"); + sub= uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); + uiItemO(sub, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump"); - subcol= uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); - row= uiLayoutSplit(subcol, 0.7, 1); + sub= uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); + row= uiLayoutSplit(sub, 0.7, 1); uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", ICON_NONE); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_CFRA); - row= uiLayoutSplit(subcol, 0.7, 1); + row= uiLayoutSplit(sub, 0.7, 1); uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", ICON_NONE); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_VALUE); } @@ -168,7 +168,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa) FCurve *fcu; PointerRNA fcu_ptr; uiLayout *layout = pa->layout; - uiLayout *col, *row, *subrow; + uiLayout *col, *row, *sub; uiBlock *block; char name[256]; int icon = 0; @@ -201,9 +201,9 @@ static void graph_panel_properties(const bContext *C, Panel *pa) row= uiLayoutRow(col, 1); uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE); - subrow= uiLayoutRow(row, 1); - uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); - uiItemR(subrow, &fcu_ptr, "color", 0, "", ICON_NONE); + sub= uiLayoutRow(row, 1); + uiLayoutSetEnabled(sub, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); + uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE); MEM_freeN(ale); } @@ -562,7 +562,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; PointerRNA dtar_ptr; - uiLayout *col, *subcol; + uiLayout *col, *sub; /* initialise RNA pointer to the target */ RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); @@ -578,9 +578,9 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - subcol= uiLayoutColumn(layout, 1); - uiItemR(subcol, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE); - uiItemR(subcol, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE); + sub= uiLayoutColumn(layout, 1); + uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE); + uiItemR(sub, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE); } /* driver settings for active F-Curve (only for 'Drivers' mode) */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 720102a2b7c..6c68ba0ea71 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -791,14 +791,15 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr) /* some settings depend on this being a scene thats rendered */ const short is_render_out= (id && GS(id->name) == ID_SCE); - uiLayout *col, *row; + uiLayout *col, *row, *split, *sub; col= uiLayoutColumn(layout, 0); - uiItemR(col, imfptr, "file_format", 0, "", ICON_NONE); + split= uiLayoutSplit(col, 0.5f, 0); - row= uiLayoutRow(col, 0); - uiItemR(row, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE); + uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE); + sub= uiLayoutRow(split, 0); + uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE); /* only display depth setting if multiple depths can be used */ if((ELEM6(depth_ok, diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 2f69fc5f99f..e5255448ae9 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3222,7 +3222,7 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens) static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bSensor *sens= (bSensor *)ptr->data; box= uiLayoutBox(layout); @@ -3237,15 +3237,15 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo uiItemL(row, sens->name, ICON_NONE); } - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove"); @@ -3253,7 +3253,7 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) { - uiLayout *box, *split, *subrow, *row; + uiLayout *box, *split, *sub, *row; box= uiLayoutBox(layout); split = uiLayoutSplit(box, 0.45, 0); @@ -3262,17 +3262,16 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP); uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN); - subrow=uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, (RNA_boolean_get(ptr, "use_pulse_true_level") + sub=uiLayoutRow(row, 0); + uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") || RNA_boolean_get(ptr, "use_pulse_false_level"))); - uiItemR(subrow, ptr, "frequency", 0, "Freq", ICON_NONE); + uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE); row= uiLayoutRow(split, 1); uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - row= uiLayoutRow(split, 1); - uiItemR(row, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE); + uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE); } /* sensors in alphabetical order */ @@ -3577,7 +3576,7 @@ static void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C) /* Controller code */ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, int width, int yco) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bController *cont= (bController *)ptr->data; char state[3]; @@ -3601,9 +3600,9 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_controller_remove"); } @@ -3615,7 +3614,7 @@ static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr) static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) { - uiLayout *split, *subsplit; + uiLayout *split, *sub; split = uiLayoutSplit(layout, 0.3, 1); uiItemR(split, ptr, "mode", 0, "", ICON_NONE); @@ -3623,9 +3622,9 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) uiItemR(split, ptr, "text", 0, "", ICON_NONE); } else { - subsplit = uiLayoutSplit(split, 0.8, 0); - uiItemR(subsplit, ptr, "module", 0, "", ICON_NONE); - uiItemR(subsplit, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub = uiLayoutSplit(split, 0.8, 0); + uiItemR(sub, ptr, "module", 0, "", ICON_NONE); + uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); } } @@ -3670,7 +3669,7 @@ static void draw_brick_controller(uiLayout *layout, PointerRNA *ptr) /* Actuator code */ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) { - uiLayout *box, *row, *subrow; + uiLayout *box, *row, *sub; bActuator *act= (bActuator *)ptr->data; box= uiLayoutBox(layout); @@ -3685,15 +3684,15 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA * uiItemL(row, act->name, ICON_NONE); } - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); if(RNA_boolean_get(ptr, "show_expanded")==0) { - subrow= uiLayoutRow(row, 1); - uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(subrow, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down + sub= uiLayoutRow(row, 1); + uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down } uiItemO(row, "", ICON_X, "LOGIC_OT_actuator_remove"); } @@ -3702,20 +3701,20 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; PointerRNA settings_ptr; - uiLayout *row, *subrow, *col; + uiLayout *row, *sub; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE); - subrow= uiLayoutRow(row, 1); - uiItemR(subrow, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(subrow, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub= uiLayoutRow(row, 1); + uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - col = uiLayoutColumn(subrow, 0); - uiLayoutSetActive(col, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); - uiItemR(col, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + row = uiLayoutColumn(sub, 0); + uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); + uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); row= uiLayoutRow(layout, 0); uiItemR(row, ptr, "action", 0, "", ICON_NONE); @@ -3740,11 +3739,10 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE); uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE); - row= uiLayoutRow(layout, 0); uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(row, "stride_length", 0, NULL, ICON_NONE); + uiItemR(layout, "stride_length", 0, NULL, ICON_NONE); #endif } @@ -3829,7 +3827,7 @@ static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C) { - uiLayout *row, *col, *subcol, *split; + uiLayout *row, *col, *sub, *split; PointerRNA main_ptr; RNA_main_pointer_create(CTX_data_main(C), &main_ptr); @@ -3855,15 +3853,15 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); row = uiLayoutRow(layout, 0); - col = uiLayoutColumn(row, 0); + col = uiLayoutColumn(row, 1); uiItemL(col, "Range:", ICON_NONE); uiItemR(col, ptr, "range", 0, "", ICON_NONE); col = uiLayoutColumn(row, 1); uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 0); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_force_distance")==1); - uiItemR(subcol, ptr, "distance", 0, "", ICON_NONE); + sub = uiLayoutColumn(col, 0); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1); + uiItemR(sub, ptr, "distance", 0, "", ICON_NONE); uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE); @@ -3931,7 +3929,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; - uiLayout *row, *split, *subsplit; + uiLayout *row, *split, *sub; uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); switch (RNA_enum_get(ptr, "mode")) @@ -3967,9 +3965,9 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) case ACT_EDOB_TRACK_TO: split = uiLayoutSplit(layout, 0.5, 0); uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE); - subsplit = uiLayoutSplit(split, 0.7, 0); - uiItemR(subsplit, ptr, "time", 0, NULL, ICON_NONE); - uiItemR(subsplit, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); + sub = uiLayoutSplit(split, 0.7, 0); + uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); break; case ACT_EDOB_DYNAMICS: if(ob->type != OB_MESH) { @@ -4041,7 +4039,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) { Object *ob; PointerRNA settings_ptr; - uiLayout *split, *row, *col, *subcol; + uiLayout *split, *row, *col, *sub; int physics_type; ob = (Object *)ptr->id.data; @@ -4100,24 +4098,24 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_x")==1); - uiItemR(subcol, ptr, "force_max_x", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_x", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x")==1); + uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_y")==1); - uiItemR(subcol, ptr, "force_max_y", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_y", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y")==1); + uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_z")==1); - uiItemR(subcol, ptr, "force_max_z", 0, NULL, ICON_NONE); - uiItemR(subcol, ptr, "force_min_z", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(col, 1); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z")==1); + uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE); + uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE); //XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast) //Layout designers willing to help on that, please compare with 2.49 ui @@ -4133,7 +4131,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) { - uiLayout *row, *subrow; + uiLayout *row, *sub; uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); @@ -4142,9 +4140,9 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE); - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "use_compound")==1); - uiItemR(subrow, ptr, "use_ghost", 0, NULL, ICON_NONE); + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound")==1); + uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE); } } @@ -4156,7 +4154,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) Object *ob_from= pa->ob; PointerRNA settings_ptr, obj_settings_ptr; - uiLayout *row, *subrow; + uiLayout *row, *sub; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); @@ -4181,9 +4179,9 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE); }else { - subrow= uiLayoutRow(row, 0); - uiLayoutSetActive(subrow, 0); - uiItemR(subrow, ptr, "object_property", 0, NULL, ICON_NONE); + sub= uiLayoutRow(row, 0); + uiLayoutSetActive(sub, 0); + uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE); } break; } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 7ba33e7e57e..79d11c956cd 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -294,7 +294,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; - uiLayout *column, *row, *subcol; + uiLayout *column, *row, *sub; uiBlock *block; short showEvalProps = 1; @@ -339,10 +339,10 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? - subcol= uiLayoutColumn(column, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); - uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); - uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + sub= uiLayoutColumn(column, 1); + uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); + uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); + uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); /* settings */ column= uiLayoutColumn(layout, 1); @@ -395,7 +395,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; - uiLayout *column, *subcolumn, *subrow; + uiLayout *col, *sub; uiBlock *block; /* check context and also validity of pointer */ @@ -405,23 +405,21 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); - column= uiLayoutColumn(layout, 1); - uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); - - subcolumn= uiLayoutColumn(column, 1); - uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "use_animated_influence")); - uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, ICON_NONE); - + col= uiLayoutColumn(layout, 1); + uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); - column= uiLayoutColumn(layout, 1); - subrow= uiLayoutRow(column, 0); - uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE); - uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE); - - subcolumn= uiLayoutColumn(column, 1); - subrow= uiLayoutRow(subcolumn, 0); - uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "use_animated_time")); - uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, ICON_NONE); + sub= uiLayoutColumn(col, 1); + uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence")); + uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE); + + col= uiLayoutColumn(layout, 1); + sub= uiLayoutRow(col, 0); + uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE); + uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE); + + sub= uiLayoutRow(col, 0); + uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time")); + uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE); } /* F-Modifiers for active NLA-Strip */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 3362d9d38d2..528a0e1c8fd 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1840,7 +1840,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f BMIter viter; int i, start; - fill_vn(dists, em->bm->totvert, FLT_MAX); + fill_vn_fl(dists, em->bm->totvert, FLT_MAX); BM_ElemIndex_Ensure(em->bm, BM_VERT); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c43ff88de7b..1452733f28e 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -174,7 +174,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im else { /* old shading system, assign image to selected faces */ - /* ensure we have a uv layer */ + /* ensure we have a uv map */ if(!CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY)) { BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY); BM_add_data_layer(em->bm, &em->bm->ldata, CD_MLOOPUV); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index cf6d119ecbd..1c74437c37e 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -928,7 +928,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op) /* ******************** Unwrap operator **************** */ -/* assumes UV layer is checked, doesn't run update funcs */ +/* assumes UV Map is checked, doesn't run update funcs */ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) { BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 194287d9abc..77ee74c0420 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -887,7 +887,7 @@ typedef struct WeightVGEditModifierData { struct Object *mask_tex_map_obj; /* Name of the map object. */ /* How to map the texture (using MOD_DISP_MAP_* constants). */ int mask_tex_mapping; - char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + char mask_tex_uvlayer_name[32]; /* Name of the UV map. */ /* Padding... */ int pad_i1; @@ -932,7 +932,7 @@ typedef struct WeightVGMixModifierData { struct Tex *mask_texture; /* The texture. */ struct Object *mask_tex_map_obj; /* Name of the map object. */ int mask_tex_mapping; /* How to map the texture! */ - char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + char mask_tex_uvlayer_name[32]; /* Name of the UV map. */ /* Padding... */ int pad_i1; @@ -979,7 +979,7 @@ typedef struct WeightVGProximityModifierData { struct Tex *mask_texture; /* The texture. */ struct Object *mask_tex_map_obj; /* Name of the map object. */ int mask_tex_mapping; /* How to map the texture! */ - char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ + char mask_tex_uvlayer_name[32]; /* Name of the UV Map. */ float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 720f2cc5b08..faacde9e44f 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -277,6 +277,8 @@ typedef struct ImageFormatData { #define R_IMF_IMTYPE_XVID 32 #define R_IMF_IMTYPE_THEORA 33 +#define R_IMF_IMTYPE_INVALID 255 + /* ImageFormatData.flag */ #define R_IMF_FLAG_ZBUF (1<<0) /* was R_OPENEXR_ZBUF */ #define R_IMF_FLAG_PREVIEW_JPG (1<<1) /* was R_PREVIEW_JPG */ diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index d0d47081298..d06ab63ca8a 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -412,7 +412,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer name"); + RNA_def_property_ui_text(prop, "UV Map", "UV map name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set"); prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 57770be57eb..ce8f903bfe2 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -443,7 +443,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates"); + RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE); @@ -1604,7 +1604,7 @@ static void rna_def_material_strand(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "strand_uvname"); - RNA_def_property_ui_text(prop, "UV Layer", "Name of UV layer to override"); + RNA_def_property_ui_text(prop, "UV Map", "Name of UV map to override"); RNA_def_property_update(prop, 0, "rna_Material_update"); } @@ -1841,13 +1841,13 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE); RNA_def_property_ui_text(prop, "Face Textures", - "Replace the object's base color with color from face assigned image textures"); + "Replace the object's base color with color from UV map image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA); RNA_def_property_ui_text(prop, "Face Textures Alpha", - "Replace the object's base alpha value with alpha from face assigned image textures"); + "Replace the object's base alpha value with alpha from UV map image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index ce3654e9585..7e22b55646c 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1647,7 +1647,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna) #endif srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL); - RNA_def_struct_ui_text(srna, "Mesh Texture Face Layer", "Layer of texture faces in a Mesh datablock"); + RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image textures in a Mesh datablock"); RNA_def_struct_sdna(srna, "CustomDataLayer"); RNA_def_struct_path_func(srna, "rna_MeshTextureFaceLayer_path"); RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS); @@ -1655,24 +1655,24 @@ static void rna_def_mtexpoly(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTextureFaceLayer_name_set"); - RNA_def_property_ui_text(prop, "Name", "Name of UV unwrapping layer"); + RNA_def_property_ui_text(prop, "Name", "Name of UV map"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set"); - RNA_def_property_ui_text(prop, "Active", "Set the layer as active for display and editing"); + RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); - RNA_def_property_ui_text(prop, "Active Render", "Set the layer as active for rendering"); + RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set"); - RNA_def_property_ui_text(prop, "Active Clone", "Set the layer as active for cloning"); + RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); @@ -1682,7 +1682,7 @@ static void rna_def_mtexpoly(BlenderRNA *brna) srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTexPoly"); - RNA_def_struct_ui_text(srna, "Mesh Texture Face", "UV mapping, texturing and game engine data for a face"); + RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image texture for a face"); RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path"); RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT); @@ -2147,12 +2147,12 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "UVTextures"); srna= RNA_def_struct(brna, "UVTextures", NULL); RNA_def_struct_sdna(srna, "Mesh"); - RNA_def_struct_ui_text(srna, "UV Textures", "Collection of uv textures"); + RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps"); func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh"); - RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name"); + RNA_def_string(func, "name", "UVMap", 0, "", "UV map name"); parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer"); RNA_def_function_return(func, parm); @@ -2167,12 +2167,12 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture"); + RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range"); - RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index"); + RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } @@ -2261,28 +2261,28 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, "rna_Mesh_uv_textures_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); - RNA_def_property_ui_text(prop, "UV Textures", "All UV texture layers"); + RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source"); rna_def_uv_textures(brna, prop); prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture layer to be used as cloning source"); + RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source"); prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); - RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture layer index"); + RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV texture index"); prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mask UV Texture", "UV texture layer to mask the painted area"); + RNA_def_property_ui_text(prop, "Mask UV Map", "UV map to mask the painted area"); prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range"); - RNA_def_property_ui_text(prop, "Mask UV Texture Index", "Mask UV texture layer index"); + RNA_def_property_ui_text(prop, "Mask UV Map Index", "Mask UV map index"); /* Vertex colors */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 013a4e57db6..4ef5411af0a 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -808,7 +808,7 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer name"); + RNA_def_property_ui_text(prop, "UV Map", "UV map name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfo_uvlayer_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1236,7 +1236,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer name"); + RNA_def_property_ui_text(prop, "UV Map", "UV map name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_uvlayer_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1607,7 +1607,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer name"); + RNA_def_property_ui_text(prop, "UV Map", "UV map name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2004,7 +2004,7 @@ static void rna_def_modifier_explode(BlenderRNA *brna) prop= RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); RNA_def_property_string_maxlength(prop, 32); - RNA_def_property_ui_text(prop, "Particle UV", "UV Layer to change with particle age"); + RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } @@ -2623,7 +2623,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna) prop= RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer name"); + RNA_def_property_ui_text(prop, "UV Map", "UV map name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_uvlayer_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 062fbad421a..af7b3303df1 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1187,7 +1187,7 @@ static void def_sh_geometry(StructRNA *srna) prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); - RNA_def_property_ui_text(prop, "UV Layer", ""); + RNA_def_property_ui_text(prop, "UV Map", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2a384329360..c94a3847a0d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1194,7 +1194,7 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) memcpy(values, bb->vec, sizeof(bb->vec)); } else { - fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f); + fill_vn_fl(values, sizeof(bb->vec)/sizeof(float), 0.0f); } } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 2e62a08408f..2b26a09a646 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1287,7 +1287,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); - RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates"); + RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE); @@ -2717,17 +2717,17 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]"); RNA_def_property_string_maxlength(prop, 32); - RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals"); + RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV map to control billboard normals"); prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]"); RNA_def_property_string_maxlength(prop, 32); - RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y)"); + RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV map to control billboard time index (X-Y)"); prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]"); RNA_def_property_string_maxlength(prop, 32); - RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting"); + RNA_def_property_ui_text(prop, "Billboard Split UV", "UV map to control billboard splitting"); /* vertex groups */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 40fcfa3e016..947e4d53d8b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -105,83 +105,87 @@ EnumPropertyItem snap_element_items[] = { {0, NULL, 0, NULL, NULL}}; -/* note on duplicate block, perhaps we should use some trick to avoid - * the duplicate, but with the inline defines it becomes very tricky - * this awaits someone who has very good preprocessor-fu. - * for now just make sure they stay in sync - campbell */ +/* workaround for duplice enums, + * have each enum line as a defne then conditionally set it or not + */ -EnumPropertyItem image_only_type_items[] = { +#define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"}, +#define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"}, +#define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"}, +#define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"}, +#define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"}, +#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"}, - /* --- duplicate block warning (see below) --- */ -#define IMAGE_TYPE_ITEMS_IMAGE_ONLY - {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"}, #ifdef WITH_DDS - {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"}, +# define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"}, +#else +# define R_IMF_ENUM_DDS #endif - {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"}, - {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"}, - {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"}, + #ifdef WITH_OPENJPEG - {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"}, +# define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"}, +#else +# define R_IMF_ENUM_JPEG2K #endif - {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"}, - {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"}, - {0, "", 0, " ", NULL}, + #ifdef WITH_CINEON - {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"}, - {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"}, +# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"}, +# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"}, +#else +# define R_IMF_ENUM_CINEON +# define R_IMF_ENUM_DPX #endif + #ifdef WITH_OPENEXR - {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"}, - {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"}, +# define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"}, +# define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"}, +#else +# define R_IMF_ENUM_EXR_MULTI +# define R_IMF_ENUM_EXR #endif + #ifdef WITH_HDR - {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"}, +# define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"}, +#else +# define R_IMF_ENUM_HDR #endif + #ifdef WITH_TIFF - {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"}, +# define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"}, +#else +# define R_IMF_ENUM_TIFF #endif - /* --- end duplicate block (see below) --- */ - {0, NULL, 0, NULL, NULL}}; +#define IMAGE_TYPE_ITEMS_IMAGE_ONLY \ + R_IMF_ENUM_BMP \ + R_IMF_ENUM_DDS \ + R_IMF_ENUM_IRIS \ + R_IMF_ENUM_PNG \ + R_IMF_ENUM_JPEG \ + R_IMF_ENUM_JPEG2K \ + R_IMF_ENUM_TAGA \ + R_IMF_ENUM_TAGA_RAW \ + {0, "", 0, " ", NULL}, \ + R_IMF_ENUM_CINEON \ + R_IMF_ENUM_DPX \ + R_IMF_ENUM_EXR_MULTI \ + R_IMF_ENUM_EXR \ + R_IMF_ENUM_HDR \ + R_IMF_ENUM_TIFF \ -EnumPropertyItem image_type_items[] = { - {0, "", 0, "Image", NULL}, +EnumPropertyItem image_only_type_items[] = { - /* --- duplicate block warning (see above) --- */ -#define IMAGE_TYPE_ITEMS_IMAGE_ONLY - {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"}, -#ifdef WITH_DDS - {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"}, -#endif - {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"}, - {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"}, - {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"}, -#ifdef WITH_OPENJPEG - {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"}, -#endif - {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"}, - {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"}, - {0, "", 0, " ", NULL}, -#ifdef WITH_CINEON - {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"}, - {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"}, -#endif -#ifdef WITH_OPENEXR - {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"}, - {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"}, -#endif -#ifdef WITH_HDR - {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"}, -#endif -#ifdef WITH_TIFF - {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"}, -#endif - /* --- end duplicate block (see above) --- */ + IMAGE_TYPE_ITEMS_IMAGE_ONLY + + {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem image_type_items[] = { + {0, "", 0, "Image", NULL}, + IMAGE_TYPE_ITEMS_IMAGE_ONLY {0, "", 0, "Movie", NULL}, #ifdef _WIN32 diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 7e113c85bf6..d0a50ba6bad 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -339,7 +339,7 @@ static void rna_def_image_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL); - RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons"); + RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons"); prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV); @@ -347,8 +347,8 @@ static void rna_def_image_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); - RNA_def_property_ui_text(prop, "Clone Layer", - "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + RNA_def_property_ui_text(prop, "Clone Map", + "Use another UV map as clone source, otherwise use 3D the cursor as the source"); /* integers */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index de43bdb8131..18f39fa6c2f 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -170,7 +170,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, if(num_projectors == 0) return dm; - /* make sure there are UV layers available */ + /* make sure there are UV Maps available */ if(!CustomData_has_layer(&dm->faceData, CD_MTFACE)) return dm; @@ -259,7 +259,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal); } - /* make sure we are not modifying the original UV layer */ + /* make sure we are not modifying the original UV map */ tface = CustomData_duplicate_referenced_layer_named(&dm->faceData, CD_MTFACE, uvname); diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index 2b28eae4085..cf6f400ee2a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -61,7 +61,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i int i; if(ngeo->uvname[0]) { - /* find uv layer by name */ + /* find uv map by name */ for(i = 0; i < shi->totuv; i++) { if(strcmp(shi->uv[i].name, ngeo->uvname)==0) { suv= &shi->uv[i]; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 3bde38d1445..eb7362ff8c7 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -619,11 +619,11 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) case PROP_ALL_VECTOR_SUBTYPES: if (len>=2 && len <= 4) { if (is_thick) { - ret= newVectorObject(NULL, len, Py_NEW, NULL); + ret= Vector_CreatePyObject(NULL, len, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec); } else { - PyObject *vec_cb= newVectorObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC); + PyObject *vec_cb= Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC); Py_DECREF(ret); /* the vector owns now */ ret= vec_cb; /* return the vector instead */ } @@ -632,22 +632,22 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) case PROP_MATRIX: if (len==16) { if (is_thick) { - ret= newMatrixObject(NULL, 4, 4, Py_NEW, NULL); + ret= Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr); } else { - PyObject *mat_cb= newMatrixObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE); + PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE); Py_DECREF(ret); /* the matrix owns now */ ret= mat_cb; /* return the matrix instead */ } } else if (len==9) { if (is_thick) { - ret= newMatrixObject(NULL, 3, 3, Py_NEW, NULL); + ret= Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr); } else { - PyObject *mat_cb= newMatrixObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE); + PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE); Py_DECREF(ret); /* the matrix owns now */ ret= mat_cb; /* return the matrix instead */ } @@ -661,23 +661,23 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) PropertyRNA *prop_eul_order= NULL; short order= pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ); - ret= newEulerObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA + ret= Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul); } else { /* order will be updated from callback on use */ - PyObject *eul_cb= newEulerObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA + PyObject *eul_cb= Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA Py_DECREF(ret); /* the euler owns now */ ret= eul_cb; /* return the euler instead */ } } else if (len==4) { if (is_thick) { - ret= newQuaternionObject(NULL, Py_NEW, NULL); + ret= Quaternion_CreatePyObject(NULL, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat); } else { - PyObject *quat_cb= newQuaternionObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT); + PyObject *quat_cb= Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT); Py_DECREF(ret); /* the quat owns now */ ret= quat_cb; /* return the quat instead */ } @@ -687,11 +687,11 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) case PROP_COLOR_GAMMA: if (len==3) { /* color */ if (is_thick) { - ret= newColorObject(NULL, Py_NEW, NULL); // TODO, get order from RNA + ret= Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col); } else { - PyObject *col_cb= newColorObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR); + PyObject *col_cb= Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR); Py_DECREF(ret); /* the color owns now */ ret= col_cb; /* return the color instead */ } @@ -4543,15 +4543,15 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat switch(RNA_property_subtype(prop)) { #ifdef USE_MATHUTILS case PROP_ALL_VECTOR_SUBTYPES: - ret= newVectorObject(data, len, Py_NEW, NULL); + ret= Vector_CreatePyObject(data, len, Py_NEW, NULL); break; case PROP_MATRIX: if (len==16) { - ret= newMatrixObject(data, 4, 4, Py_NEW, NULL); + ret= Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL); break; } else if (len==9) { - ret= newMatrixObject(data, 3, 3, Py_NEW, NULL); + ret= Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL); break; } /* pass through */ diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 79628cf5ae9..8409344a9fe 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -61,7 +61,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) "more then a single arg given"); return NULL; } - return newColorObject(col, Py_NEW, type); + return Color_CreatePyObject(col, Py_NEW, type); } //-----------------------------METHODS---------------------------- @@ -104,7 +104,7 @@ static PyObject *Color_copy(ColorObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return newColorObject(self->col, Py_NEW, Py_TYPE(self)); + return Color_CreatePyObject(self->col, Py_NEW, Py_TYPE(self)); } //----------------------------print object (internal)-------------- @@ -384,7 +384,7 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2) add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); - return newColorObject(col, Py_NEW, Py_TYPE(v1)); + return Color_CreatePyObject(col, Py_NEW, Py_TYPE(v1)); } /* addition in-place: obj += obj */ @@ -433,7 +433,7 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2) sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); - return newColorObject(col, Py_NEW, Py_TYPE(v1)); + return Color_CreatePyObject(col, Py_NEW, Py_TYPE(v1)); } /* subtraction in-place: obj -= obj */ @@ -465,7 +465,7 @@ static PyObject *color_mul_float(ColorObject *color, const float scalar) { float tcol[COLOR_SIZE]; mul_vn_vn_fl(tcol, color->col, COLOR_SIZE, scalar); - return newColorObject(tcol, Py_NEW, Py_TYPE(color)); + return Color_CreatePyObject(tcol, Py_NEW, Py_TYPE(color)); } @@ -612,7 +612,7 @@ static PyObject *Color_neg(ColorObject *self) return NULL; negate_vn_vn(tcol, self->col, COLOR_SIZE); - return newColorObject(tcol, Py_NEW, Py_TYPE(self)); + return Color_CreatePyObject(tcol, Py_NEW, Py_TYPE(self)); } @@ -821,13 +821,13 @@ PyTypeObject color_Type = { NULL, //tp_weaklist NULL //tp_del }; -//------------------------newColorObject (internal)------------- +//------------------------Color_CreatePyObject (internal)------------- //creates a new color object /*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER (i.e. it was allocated elsewhere by MEM_mallocN()) pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON (i.e. it must be created here with PyMEM_malloc())*/ -PyObject *newColorObject(float *col, int type, PyTypeObject *base_type) +PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type) { ColorObject *self; @@ -860,9 +860,9 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type) return (PyObject *)self; } -PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) +PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) { - ColorObject *self= (ColorObject *)newColorObject(NULL, Py_NEW, NULL); + ColorObject *self= (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL); if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index 6c84b5f596d..f218d653ec9 100644 --- a/source/blender/python/mathutils/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -48,7 +48,7 @@ be stored in py_data) or be a wrapper for data allocated through blender (stored in blend_data). This is an either/or struct not both*/ //prototypes -PyObject *newColorObject( float *col, int type, PyTypeObject *base_type); -PyObject *newColorObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); +PyObject *Color_CreatePyObject( float *col, int type, PyTypeObject *base_type); +PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); #endif /* MATHUTILS_COLOR_H */ diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index ce9ac5fbbb5..a1e18432b4b 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -71,7 +71,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; break; } - return newEulerObject(eul, order, Py_NEW, type); + return Euler_CreatePyObject(eul, order, Py_NEW, type); } /* internal use, assume read callback is done */ @@ -142,7 +142,7 @@ static PyObject *Euler_to_quaternion(EulerObject * self) eulO_to_quat(quat, self->eul, self->order); - return newQuaternionObject(quat, Py_NEW, NULL); + return Quaternion_CreatePyObject(quat, Py_NEW, NULL); } //return a matrix representation of the euler @@ -163,7 +163,7 @@ static PyObject *Euler_to_matrix(EulerObject * self) eulO_to_mat3((float (*)[3])mat, self->eul, self->order); - return newMatrixObject(mat, 3, 3 , Py_NEW, NULL); + return Matrix_CreatePyObject(mat, 3, 3 , Py_NEW, NULL); } PyDoc_STRVAR(Euler_zero_doc, @@ -293,7 +293,7 @@ static PyObject *Euler_copy(EulerObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return newEulerObject(self->eul, self->order, Py_NEW, Py_TYPE(self)); + return Euler_CreatePyObject(self->eul, self->order, Py_NEW, Py_TYPE(self)); } //----------------------------print object (internal)-------------- @@ -664,13 +664,13 @@ PyTypeObject euler_Type = { NULL, //tp_weaklist NULL //tp_del }; -//------------------------newEulerObject (internal)------------- +//------------------------Euler_CreatePyObject (internal)------------- //creates a new euler object /*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER (i.e. it was allocated elsewhere by MEM_mallocN()) pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON (i.e. it must be created here with PyMEM_malloc())*/ -PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_type) +PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type) { EulerObject *self; @@ -707,9 +707,9 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t return (PyObject *)self; } -PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype) +PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype) { - EulerObject *self= (EulerObject *)newEulerObject(NULL, order, Py_NEW, NULL); + EulerObject *self= (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL); if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index 46f5910f31f..5760d08e1f6 100644 --- a/source/blender/python/mathutils/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -50,8 +50,8 @@ be stored in py_data) or be a wrapper for data allocated through blender (stored in blend_data). This is an either/or struct not both*/ //prototypes -PyObject *newEulerObject( float *eul, short order, int type, PyTypeObject *base_type); -PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype); +PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type); +PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype); short euler_order_from_string(const char *str, const char *error_prefix); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 1472b6886f6..f5e1218aaa3 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -125,7 +125,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) switch(PyTuple_GET_SIZE(args)) { case 0: - return (PyObject *) newMatrixObject(NULL, 4, 4, Py_NEW, type); + return (PyObject *) Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type); case 1: { PyObject *arg= PyTuple_GET_ITEM(args, 0); @@ -140,7 +140,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (col_size >= 2 && col_size <= 4) { /* sane row & col size, new matrix and assign as slice */ - PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type); + PyObject *matrix= Matrix_CreatePyObject(NULL, row_size, col_size, Py_NEW, type); if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) { return matrix; } @@ -284,7 +284,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) matrix_3x3_as_4x4(mat); } //pass to matrix creation - return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); + return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } @@ -308,7 +308,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value) /* create a identity matrix and add translation */ unit_m4((float(*)[4]) mat); copy_v3_v3(mat + 12, tvec); /* 12, 13, 14 */ - return newMatrixObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls); + return Matrix_CreatePyObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls); } //----------------------------------mathutils.Matrix.Scale() ------------- //mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. @@ -395,7 +395,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) matrix_3x3_as_4x4(mat); } //pass to matrix creation - return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); + return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } //----------------------------------mathutils.Matrix.OrthoProjection() --- //mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. @@ -512,7 +512,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) matrix_3x3_as_4x4(mat); } //pass to matrix creation - return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); + return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } PyDoc_STRVAR(C_Matrix_Shear_doc, @@ -613,7 +613,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) matrix_3x3_as_4x4(mat); } //pass to matrix creation - return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); + return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } void matrix_as_3x3(float mat[3][3], MatrixObject *self) @@ -673,7 +673,7 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self) mat4_to_quat(quat, (float (*)[4])self->contigPtr); } - return newQuaternionObject(quat, Py_NEW, NULL); + return Quaternion_CreatePyObject(quat, Py_NEW, NULL); } /*---------------------------matrix.toEuler() --------------------*/ @@ -747,7 +747,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) else mat3_to_eulO(eul, order, mat); } - return newEulerObject(eul, order, Py_NEW, NULL); + return Euler_CreatePyObject(eul, order, Py_NEW, NULL); } PyDoc_STRVAR(Matrix_resize_4x4_doc, @@ -827,12 +827,12 @@ static PyObject *Matrix_to_4x4(MatrixObject *self) return NULL; if (self->col_size==4 && self->row_size==4) { - return (PyObject *)newMatrixObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self)); + return (PyObject *)Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self)); } else if (self->col_size==3 && self->row_size==3) { float mat[4][4]; copy_m4_m3(mat, (float (*)[3])self->contigPtr); - return (PyObject *)newMatrixObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self)); + return (PyObject *)Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self)); } /* TODO, 2x2 matrix */ @@ -865,7 +865,7 @@ static PyObject *Matrix_to_3x3(MatrixObject *self) matrix_as_3x3(mat, self); - return newMatrixObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self)); + return Matrix_CreatePyObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Matrix_to_translation_doc, @@ -888,7 +888,7 @@ static PyObject *Matrix_to_translation(MatrixObject *self) return NULL; } - return newVectorObject(self->matrix[3], 3, Py_NEW, NULL); + return Vector_CreatePyObject(self->matrix[3], 3, Py_NEW, NULL); } PyDoc_STRVAR(Matrix_to_scale_doc, @@ -923,7 +923,7 @@ static PyObject *Matrix_to_scale(MatrixObject *self) /* compatible mat4_to_loc_rot_size */ mat3_to_rot_size(rot, size, mat); - return newVectorObject(size, 3, Py_NEW, NULL); + return Vector_CreatePyObject(size, 3, Py_NEW, NULL); } /*---------------------------matrix.invert() ---------------------*/ @@ -1080,9 +1080,9 @@ static PyObject *Matrix_decompose(MatrixObject *self) mat3_to_quat(quat, rot); ret= PyTuple_New(3); - PyTuple_SET_ITEM(ret, 0, newVectorObject(loc, 3, Py_NEW, NULL)); - PyTuple_SET_ITEM(ret, 1, newQuaternionObject(quat, Py_NEW, NULL)); - PyTuple_SET_ITEM(ret, 2, newVectorObject(size, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(loc, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 1, Quaternion_CreatePyObject(quat, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 2, Vector_CreatePyObject(size, 3, Py_NEW, NULL)); return ret; } @@ -1133,7 +1133,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) return NULL; } - return (PyObject*)newMatrixObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); + return (PyObject*)Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); } /*---------------------------matrix.determinant() ----------------*/ @@ -1223,7 +1223,7 @@ PyDoc_STRVAR(Matrix_zero_doc, ); static PyObject *Matrix_zero(MatrixObject *self) { - fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f); + fill_vn_fl(self->contigPtr, self->row_size * self->col_size, 0.0f); if (BaseMath_WriteCallback(self) == -1) return NULL; @@ -1286,7 +1286,7 @@ static PyObject *Matrix_copy(MatrixObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); + return (PyObject*)Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); } /*----------------------------print object (internal)-------------*/ @@ -1383,7 +1383,7 @@ static PyObject *Matrix_item(MatrixObject *self, int i) "array index out of range"); return NULL; } - return newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i); + return Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i); } /*----------------------------object[]------------------------- sequence accessor (set) */ @@ -1428,7 +1428,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) tuple= PyTuple_New(end - begin); for (count= begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, - newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count)); + Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count)); } @@ -1514,7 +1514,7 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2) add_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size); - return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); + return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } /*------------------------obj - obj------------------------------ subtraction*/ @@ -1547,7 +1547,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) sub_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size); - return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); + return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } /*------------------------obj * obj------------------------------ mulplication*/ @@ -1555,7 +1555,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar) { float tmat[16]; mul_vn_vn_fl(tmat, mat->contigPtr, mat->row_size * mat->col_size, scalar); - return newMatrixObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat)); + return Matrix_CreatePyObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat)); } static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) @@ -1594,7 +1594,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) } } - return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); + return Matrix_CreatePyObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } else if (mat2) { /*FLOAT/INT * MATRIX */ @@ -1613,7 +1613,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) return NULL; } - return newVectorObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2)); + return Vector_CreatePyObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2)); } /*FLOAT/INT * MATRIX */ else if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) { @@ -1940,7 +1940,7 @@ PyTypeObject matrix_Type = { NULL /*tp_del*/ }; -/*------------------------newMatrixObject (internal)------------- +/*------------------------Matrix_CreatePyObject (internal)------------- creates a new matrix object self->matrix self->contiguous_ptr (reference to data.xxx) [0]------------->[0] @@ -1956,7 +1956,7 @@ self->matrix[1][1] = self->contigPtr[4] */ (i.e. it was allocated elsewhere by MEM_mallocN()) pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON (i.e. it must be created here with PyMEM_malloc())*/ -PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type) +PyObject *Matrix_CreatePyObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type) { MatrixObject *self; int x, row, col; @@ -2022,9 +2022,9 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign return (PyObject *) self; } -PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype) +PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype) { - MatrixObject *self= (MatrixObject *)newMatrixObject(NULL, rowSize, colSize, Py_NEW, NULL); + MatrixObject *self= (MatrixObject *)Matrix_CreatePyObject(NULL, rowSize, colSize, Py_NEW, NULL); if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h index 275f4270787..d1984d7299d 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.h +++ b/source/blender/python/mathutils/mathutils_Matrix.h @@ -51,8 +51,8 @@ be stored in py_data) or be a wrapper for data allocated through blender (stored in blend_data). This is an either/or struct not both*/ /*prototypes*/ -PyObject *newMatrixObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type); -PyObject *newMatrixObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype); +PyObject *Matrix_CreatePyObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type); +PyObject *Matrix_CreatePyObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype); extern int mathutils_matrix_vector_cb_index; extern struct Mathutils_Callback mathutils_matrix_vector_cb; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 8a6c4909e94..0b24db708e2 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -120,7 +120,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args) else quat_to_eulO(eul, order, tquat); } - return newEulerObject(eul, order, Py_NEW, NULL); + return Euler_CreatePyObject(eul, order, Py_NEW, NULL); } //----------------------------Quaternion.toMatrix()------------------ PyDoc_STRVAR(Quaternion_to_matrix_doc, @@ -139,7 +139,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self) return NULL; quat_to_mat3((float (*)[3])mat, self->quat); - return newMatrixObject(mat, 3, 3, Py_NEW, NULL); + return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL); } //----------------------------Quaternion.toMatrix()------------------ @@ -169,7 +169,7 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self) quat__axis_angle_sanitize(axis, &angle); ret= PyTuple_New(2); - PyTuple_SET_ITEM(ret, 0, newVectorObject(axis, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(axis, 3, Py_NEW, NULL)); PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(angle)); return ret; } @@ -197,7 +197,7 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value) return NULL; mul_qt_qtqt(quat, self->quat, tquat); - return newQuaternionObject(quat, Py_NEW, Py_TYPE(self)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self)); } //----------------------------Quaternion.dot(other)------------------ @@ -246,7 +246,7 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject rotation_between_quats_to_quat(quat, self->quat, tquat); - return newQuaternionObject(quat, Py_NEW, Py_TYPE(self)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Quaternion_slerp_doc, @@ -288,7 +288,7 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args) interp_qt_qtqt(quat, self->quat, tquat, fac); - return newQuaternionObject(quat, Py_NEW, Py_TYPE(self)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Quaternion_rotate_doc, @@ -464,7 +464,7 @@ static PyObject *Quaternion_copy(QuaternionObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return newQuaternionObject(self->quat, Py_NEW, Py_TYPE(self)); + return Quaternion_CreatePyObject(self->quat, Py_NEW, Py_TYPE(self)); } //----------------------------print object (internal)-------------- @@ -721,7 +721,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) return NULL; add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f); - return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1)); } //------------------------obj - obj------------------------------ //subtraction @@ -749,7 +749,7 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) quat[x] = quat1->quat[x] - quat2->quat[x]; } - return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1)); } static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar) @@ -757,7 +757,7 @@ static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar) float tquat[4]; copy_qt_qt(tquat, quat->quat); mul_qt_fl(tquat, scalar); - return newQuaternionObject(tquat, Py_NEW, Py_TYPE(quat)); + return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(quat)); } //------------------------obj * obj------------------------------ @@ -780,7 +780,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) if (quat1 && quat2) { /* QUAT*QUAT (cross product) */ mul_qt_qtqt(quat, quat1->quat, quat2->quat); - return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1)); + return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1)); } /* the only case this can happen (for a supported type is "FLOAT*QUAT") */ else if (quat2) { /* FLOAT*QUAT */ @@ -808,7 +808,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) copy_v3_v3(tvec, vec2->vec); mul_qt_v3(quat1->quat, tvec); - return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec2)); + return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec2)); } /* QUAT * FLOAT */ else if ((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) { @@ -836,7 +836,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self) return NULL; negate_v4_v4(tquat, self->quat); - return newQuaternionObject(tquat, Py_NEW, Py_TYPE(self)); + return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(self)); } @@ -982,7 +982,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos quat__axis_angle_sanitize(axis, NULL); - return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL); + return (PyObject *) Vector_CreatePyObject(axis, 3, Py_NEW, NULL); } static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure)) @@ -1045,7 +1045,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw break; /* PyArg_ParseTuple assures no more then 2 */ } - return newQuaternionObject(quat, Py_NEW, type); + return Quaternion_CreatePyObject(quat, Py_NEW, type); } static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self) @@ -1190,13 +1190,13 @@ PyTypeObject quaternion_Type = { NULL, //tp_weaklist NULL, //tp_del }; -//------------------------newQuaternionObject (internal)------------- +//------------------------Quaternion_CreatePyObject (internal)------------- //creates a new quaternion object /*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER (i.e. it was allocated elsewhere by MEM_mallocN()) pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON (i.e. it must be created here with PyMEM_malloc())*/ -PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) +PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type) { QuaternionObject *self; @@ -1229,9 +1229,9 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) return (PyObject *) self; } -PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) +PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) { - QuaternionObject *self= (QuaternionObject *)newQuaternionObject(NULL, Py_NEW, NULL); + QuaternionObject *self= (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL); if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h index 13060ed9ff9..a34720769fa 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.h +++ b/source/blender/python/mathutils/mathutils_Quaternion.h @@ -48,7 +48,7 @@ be stored in py_data) or be a wrapper for data allocated through blender (stored in blend_data). This is an either/or struct not both*/ //prototypes -PyObject *newQuaternionObject( float *quat, int type, PyTypeObject *base_type); -PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); +PyObject *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type); +PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype); #endif /* MATHUTILS_QUAT_H */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index f70bd42e2b6..1dff33887e3 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -70,7 +70,7 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED "more then a single arg given"); return NULL; } - return newVectorObject(vec, size, Py_NEW, type); + return Vector_CreatePyObject(vec, size, Py_NEW, type); } static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self) @@ -95,7 +95,7 @@ PyDoc_STRVAR(Vector_zero_doc, ); static PyObject *Vector_zero(VectorObject *self) { - fill_vn(self->vec, self->size, 0.0f); + fill_vn_fl(self->vec, self->size, 0.0f); if (BaseMath_WriteCallback(self) == -1) return NULL; @@ -116,19 +116,10 @@ PyDoc_STRVAR(Vector_normalize_doc, ); static PyObject *Vector_normalize(VectorObject *self) { - int i; - float norm = 0.0f; - if (BaseMath_ReadCallback(self) == -1) return NULL; - for (i = 0; i < self->size; i++) { - norm += self->vec[i] * self->vec[i]; - } - norm = (float) sqrt(norm); - for (i = 0; i < self->size; i++) { - self->vec[i] /= norm; - } + normalize_vn(self->vec, self->size); (void)BaseMath_WriteCallback(self); Py_RETURN_NONE; @@ -273,7 +264,7 @@ static PyObject *Vector_to_2d(VectorObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(self->vec, 2, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_to_3d_doc, ".. method:: to_3d()\n" @@ -291,7 +282,7 @@ static PyObject *Vector_to_3d(VectorObject *self) return NULL; memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3)); - return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_to_4d_doc, ".. method:: to_4d()\n" @@ -309,7 +300,7 @@ static PyObject *Vector_to_4d(VectorObject *self) return NULL; memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 4)); - return newVectorObject(tvec, 4, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(tvec, 4, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_to_tuple_doc, @@ -484,7 +475,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args) vec_to_quat(quat, vec, track, up); - return newQuaternionObject(quat, Py_NEW, NULL); + return Quaternion_CreatePyObject(quat, Py_NEW, NULL); } /* @@ -527,7 +518,7 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value) normalize_v3(mirror); reflect_v3_v3v3(reflect, vec, mirror); - return newVectorObject(reflect, self->size, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(reflect, self->size, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_cross_doc, @@ -553,7 +544,7 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value) if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1) return NULL; - ret= (VectorObject *)newVectorObject(NULL, 3, Py_NEW, Py_TYPE(self)); + ret= (VectorObject *)Vector_CreatePyObject(NULL, 3, Py_NEW, Py_TYPE(self)); cross_v3_v3v3(ret->vec, self->vec, tvec); return (PyObject *)ret; } @@ -571,8 +562,6 @@ PyDoc_STRVAR(Vector_dot_doc, static PyObject *Vector_dot(VectorObject *self, PyObject *value) { float tvec[MAX_DIMENSIONS]; - double dot = 0.0; - int x; if (BaseMath_ReadCallback(self) == -1) return NULL; @@ -580,11 +569,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value) if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) return NULL; - for (x = 0; x < self->size; x++) { - dot += (double)(self->vec[x] * tvec[x]); - } - - return PyFloat_FromDouble(dot); + return PyFloat_FromDouble(dot_vn_vn(self->vec, tvec, self->size)); } PyDoc_STRVAR(Vector_angle_doc, @@ -682,7 +667,7 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value) rotation_between_vecs_to_quat(quat, vec_a, vec_b); - return newQuaternionObject(quat, Py_NEW, NULL); + return Quaternion_CreatePyObject(quat, Py_NEW, NULL); } PyDoc_STRVAR(Vector_project_doc, @@ -722,7 +707,7 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value) for (x = 0; x < size; x++) { vec[x] = (float)dot * tvec[x]; } - return newVectorObject(vec, size, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_lerp_doc, @@ -759,7 +744,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args) for (x = 0; x < size; x++) { vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]); } - return newVectorObject(vec, size, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self)); } PyDoc_STRVAR(Vector_rotate_doc, @@ -808,7 +793,7 @@ static PyObject *Vector_copy(VectorObject *self) if (BaseMath_ReadCallback(self) == -1) return NULL; - return newVectorObject(self->vec, self->size, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(self->vec, self->size, Py_NEW, Py_TYPE(self)); } static PyObject *Vector_repr(VectorObject *self) @@ -975,7 +960,7 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2) add_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size); - return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); + return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); } /* addition in-place: obj += obj */ @@ -1038,7 +1023,7 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2) sub_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size); - return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); + return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); } /* subtraction in-place: obj -= obj */ @@ -1123,7 +1108,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar) { float tvec[MAX_DIMENSIONS]; mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar); - return newVectorObject(tvec, vec->size, Py_NEW, Py_TYPE(vec)); + return Vector_CreatePyObject(tvec, vec->size, Py_NEW, Py_TYPE(vec)); } static PyObject *Vector_mul(PyObject *v1, PyObject *v2) @@ -1145,9 +1130,6 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) /* make sure v1 is always the vector */ if (vec1 && vec2) { - int i; - double dot = 0.0f; - if (vec1->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " @@ -1156,10 +1138,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } /*dot product*/ - for (i = 0; i < vec1->size; i++) { - dot += (double)(vec1->vec[i] * vec2->vec[i]); - } - return PyFloat_FromDouble(dot); + return PyFloat_FromDouble(dot_vn_vn(vec1->vec, vec2->vec, vec1->size)); } else if (vec1) { if (MatrixObject_Check(v2)) { @@ -1172,7 +1151,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) return NULL; } - return newVectorObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1)); + return Vector_CreatePyObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1)); } else if (QuaternionObject_Check(v2)) { /* VEC * QUAT */ @@ -1198,7 +1177,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) copy_v3_v3(tvec, vec1->vec); mul_qt_v3(quat2->quat, tvec); - return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1)); + return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec1)); #endif /* ------ to be removed ------*/ } @@ -1332,7 +1311,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2) for (i = 0; i < vec1->size; i++) { vec[i] = vec1->vec[i] / scalar; } - return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); + return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); } /* divide in-place: obj /= obj */ @@ -1378,7 +1357,7 @@ static PyObject *Vector_neg(VectorObject *self) return NULL; negate_vn_vn(tvec, self->vec, self->size); - return newVectorObject(tvec, self->size, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(tvec, self->size, Py_NEW, Py_TYPE(self)); } /*------------------------vec_magnitude_nosqrt (internal) - for comparing only */ @@ -1644,7 +1623,6 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) static int Vector_setLength(VectorObject *self, PyObject *value) { double dot = 0.0f, param; - int i; if (BaseMath_ReadCallback(self) == -1) return -1; @@ -1661,13 +1639,11 @@ static int Vector_setLength(VectorObject *self, PyObject *value) return -1; } if (param == 0.0) { - fill_vn(self->vec, self->size, 0.0f); + fill_vn_fl(self->vec, self->size, 0.0f); return 0; } - for (i = 0; i < self->size; i++) { - dot += (double)(self->vec[i] * self->vec[i]); - } + dot= dot_vn_vn(self->vec, self->vec, self->size); if (!dot) /* cant sqrt zero */ return 0; @@ -1679,9 +1655,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value) dot= dot/param; - for (i = 0; i < self->size; i++) { - self->vec[i]= self->vec[i] / (float)dot; - } + mul_vn_fl(self->vec, self->size, 1.0/dot); (void)BaseMath_WriteCallback(self); /* checked already */ @@ -1691,16 +1665,10 @@ static int Vector_setLength(VectorObject *self, PyObject *value) /* vector.length_squared */ static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closure)) { - double dot = 0.0f; - int i; - if (BaseMath_ReadCallback(self) == -1) return NULL; - for (i = 0; i < self->size; i++) { - dot += (double)(self->vec[i] * self->vec[i]); - } - return PyFloat_FromDouble(dot); + return PyFloat_FromDouble(dot_vn_vn(self->vec, self->vec, self->size)); } /* Get a new Vector according to the provided swizzle. This function has little @@ -1734,7 +1702,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) axis_to++; } - return newVectorObject(vec, axis_to, Py_NEW, Py_TYPE(self)); + return Vector_CreatePyObject(vec, axis_to, Py_NEW, Py_TYPE(self)); } /* Set the items of this vector using a swizzle. @@ -2396,13 +2364,13 @@ PyTypeObject vector_Type = { NULL }; -/*------------------------newVectorObject (internal)------------- +/*------------------------Vector_CreatePyObject (internal)------------- creates a new vector object pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER (i.e. it was allocated elsewhere by MEM_mallocN()) pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON (i.e. it must be created here with PyMEM_malloc())*/ -PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObject *base_type) +PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type) { VectorObject *self; @@ -2432,7 +2400,7 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje memcpy(self->vec, vec, size * sizeof(float)); } else { /* new empty */ - fill_vn(self->vec, size, 0.0f); + fill_vn_fl(self->vec, size, 0.0f); if (size == 4) { /* do the homogenous thing */ self->vec[3] = 1.0f; } @@ -2446,10 +2414,10 @@ PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObje return (PyObject *) self; } -PyObject *newVectorObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype) +PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype) { float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */ - VectorObject *self= (VectorObject *)newVectorObject(dummy, size, Py_NEW, NULL); + VectorObject *self= (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL); if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h index 610805fcee0..c1550aabb25 100644 --- a/source/blender/python/mathutils/mathutils_Vector.h +++ b/source/blender/python/mathutils/mathutils_Vector.h @@ -45,7 +45,7 @@ typedef struct { } VectorObject; /*prototypes*/ -PyObject *newVectorObject(float *vec, const int size, const int type, PyTypeObject *base_type); -PyObject *newVectorObject_cb(PyObject *user, int size, int callback_type, int subtype); +PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type); +PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype); #endif /* MATHUTILS_VECTOR_H */ diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 2f79dfd9914..c5e0d2ab95d 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -158,7 +158,7 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* mul_v3_fl(dir, t); add_v3_v3v3(pvec, orig, dir); - return newVectorObject(pvec, 3, Py_NEW, NULL); + return Vector_CreatePyObject(pvec, 3, Py_NEW, NULL); } /* Line-Line intersection using algorithm from mathworld.wolfram.com */ @@ -242,8 +242,8 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject } else { tuple= PyTuple_New(2); - PyTuple_SET_ITEM(tuple, 0, newVectorObject(i1, vec1->size, Py_NEW, NULL)); - PyTuple_SET_ITEM(tuple, 1, newVectorObject(i2, vec1->size, Py_NEW, NULL)); + PyTuple_SET_ITEM(tuple, 0, Vector_CreatePyObject(i1, vec1->size, Py_NEW, NULL)); + PyTuple_SET_ITEM(tuple, 1, Vector_CreatePyObject(i2, vec1->size, Py_NEW, NULL)); return tuple; } } @@ -338,7 +338,7 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec); } - return newVectorObject(n, 3, Py_NEW, NULL); + return Vector_CreatePyObject(n, 3, Py_NEW, NULL); } //--------------------------------- AREA FUNCTIONS-------------------- @@ -433,7 +433,7 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj } if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { - return newVectorObject(vi, 2, Py_NEW, NULL); + return Vector_CreatePyObject(vi, 2, Py_NEW, NULL); } else { Py_RETURN_NONE; @@ -490,7 +490,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec } if (isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) { - return newVectorObject(isect, 3, Py_NEW, NULL); + return Vector_CreatePyObject(isect, 3, Py_NEW, NULL); } else { Py_RETURN_NONE; @@ -552,8 +552,8 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje normalize_v3(isect_no); ret= PyTuple_New(2); - PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_co, 3, Py_NEW, NULL)); - PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_no, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_co, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_no, 3, Py_NEW, NULL)); return ret; } @@ -626,10 +626,10 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje use_b= FALSE; } - if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); } + if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); } - if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); } + if (use_b) { PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_b, 3, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); } return ret; @@ -699,10 +699,10 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO use_b= FALSE; } - if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); } + if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); } - if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); } + if (use_b) { PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_b, 2, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); } return ret; @@ -758,7 +758,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec lambda= closest_to_line_v3(pt_out, pt_in, l1, l2); ret= PyTuple_New(2); - PyTuple_SET_ITEM(ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(pt_out, 3, Py_NEW, NULL)); PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(lambda)); return ret; } @@ -939,7 +939,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec, vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec); - return newVectorObject(vec, 3, Py_NEW, NULL); + return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); } #ifndef MATH_STANDALONE @@ -1015,7 +1015,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* list= PyList_New(resolu); fp= coord_array; for (i=0; i<resolu; i++, fp= fp+dims) { - PyList_SET_ITEM(list, i, newVectorObject(fp, dims, Py_NEW, NULL)); + PyList_SET_ITEM(list, i, Vector_CreatePyObject(fp, dims, Py_NEW, NULL)); } MEM_freeN(coord_array); return list; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 1d7d1c7c936..ff381ab6d13 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -3684,7 +3684,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const int i, layers = CustomData_number_of_layers(&orcoDm->faceData, CD_MTFACE); int layer_index = CustomData_get_layer_index(&orcoDm->faceData, CD_MTFACE); - /* for every uv layer set coords and name */ + /* for every uv map set coords and name */ for (i=0; i<layers; i++) { if(layer_index >= 0) { float *uv1, *uv2, *uv3; @@ -3708,7 +3708,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const shi.uv[i].uv[2]= 0.0f; /* texture.c assumes there are 3 coords */ } } - /* active uv layer */ + /* active uv map */ shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData,CD_MTFACE) - layer_index; shi.totuv = layers; } |