Cleanup: use 'r_' prefix for output arguments
Also pass some args as 'const'.
This commit is contained in:
parent
c3764fe1e8
commit
2bc791437e
|
@ -322,12 +322,12 @@ struct ImageTile *BKE_image_get_tile_from_iuser(struct Image *ima, struct ImageU
|
|||
|
||||
int BKE_image_get_tile_from_pos(struct Image *ima,
|
||||
const float uv[2],
|
||||
float new_uv[2],
|
||||
float ofs[2]);
|
||||
float r_uv[2],
|
||||
float r_ofs[2]);
|
||||
|
||||
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height);
|
||||
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]);
|
||||
void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
|
||||
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *r_width, int *r_height);
|
||||
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float r_size[2]);
|
||||
void BKE_image_get_aspect(struct Image *image, float *r_aspx, float *r_aspy);
|
||||
|
||||
/* image_gen.c */
|
||||
void BKE_image_buf_fill_color(
|
||||
|
|
|
@ -578,16 +578,16 @@ ImageTile *BKE_image_get_tile_from_iuser(Image *ima, ImageUser *iuser)
|
|||
|
||||
int BKE_image_get_tile_from_pos(struct Image *ima,
|
||||
const float uv[2],
|
||||
float new_uv[2],
|
||||
float ofs[2])
|
||||
float r_uv[2],
|
||||
float r_ofs[2])
|
||||
{
|
||||
float local_ofs[2];
|
||||
if (ofs == NULL) {
|
||||
ofs = local_ofs;
|
||||
if (r_ofs == NULL) {
|
||||
r_ofs = local_ofs;
|
||||
}
|
||||
|
||||
copy_v2_v2(new_uv, uv);
|
||||
zero_v2(ofs);
|
||||
copy_v2_v2(r_uv, uv);
|
||||
zero_v2(r_ofs);
|
||||
|
||||
if ((ima->source != IMA_SRC_TILED) || uv[0] < 0.0f || uv[1] < 0.0f || uv[0] >= 10.0f) {
|
||||
return 0;
|
||||
|
@ -600,9 +600,9 @@ int BKE_image_get_tile_from_pos(struct Image *ima,
|
|||
if (BKE_image_get_tile(ima, tile_number) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ofs[0] = ix;
|
||||
ofs[1] = iy;
|
||||
sub_v2_v2(new_uv, ofs);
|
||||
r_ofs[0] = ix;
|
||||
r_ofs[1] = iy;
|
||||
sub_v2_v2(r_uv, r_ofs);
|
||||
|
||||
return tile_number;
|
||||
}
|
||||
|
@ -5341,7 +5341,7 @@ bool BKE_image_has_alpha(struct Image *image)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
|
||||
void BKE_image_get_size(Image *image, ImageUser *iuser, int *r_width, int *r_height)
|
||||
{
|
||||
ImBuf *ibuf = NULL;
|
||||
void *lock;
|
||||
|
@ -5351,22 +5351,22 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
|
|||
}
|
||||
|
||||
if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
|
||||
*width = ibuf->x;
|
||||
*height = ibuf->y;
|
||||
*r_width = ibuf->x;
|
||||
*r_height = ibuf->y;
|
||||
}
|
||||
else if (image != NULL && image->type == IMA_TYPE_R_RESULT && iuser != NULL &&
|
||||
iuser->scene != NULL) {
|
||||
Scene *scene = iuser->scene;
|
||||
*width = (scene->r.xsch * scene->r.size) / 100;
|
||||
*height = (scene->r.ysch * scene->r.size) / 100;
|
||||
*r_width = (scene->r.xsch * scene->r.size) / 100;
|
||||
*r_height = (scene->r.ysch * scene->r.size) / 100;
|
||||
if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
|
||||
*width *= BLI_rctf_size_x(&scene->r.border);
|
||||
*height *= BLI_rctf_size_y(&scene->r.border);
|
||||
*r_width *= BLI_rctf_size_x(&scene->r.border);
|
||||
*r_height *= BLI_rctf_size_y(&scene->r.border);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*width = IMG_SIZE_FALLBACK;
|
||||
*height = IMG_SIZE_FALLBACK;
|
||||
*r_width = IMG_SIZE_FALLBACK;
|
||||
*r_height = IMG_SIZE_FALLBACK;
|
||||
}
|
||||
|
||||
if (image != NULL) {
|
||||
|
@ -5374,25 +5374,25 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2])
|
||||
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
|
||||
{
|
||||
int width, height;
|
||||
BKE_image_get_size(image, iuser, &width, &height);
|
||||
|
||||
size[0] = (float)width;
|
||||
size[1] = (float)height;
|
||||
r_size[0] = (float)width;
|
||||
r_size[1] = (float)height;
|
||||
}
|
||||
|
||||
void BKE_image_get_aspect(Image *image, float *aspx, float *aspy)
|
||||
void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
|
||||
{
|
||||
*aspx = 1.0;
|
||||
*r_aspx = 1.0;
|
||||
|
||||
/* x is always 1 */
|
||||
if (image) {
|
||||
*aspy = image->aspy / image->aspx;
|
||||
*r_aspy = image->aspy / image->aspx;
|
||||
}
|
||||
else {
|
||||
*aspy = 1.0f;
|
||||
*r_aspy = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ static void uint8_rgba_to_float_gray(const unsigned char *rgba,
|
|||
static float *track_get_search_floatbuf(ImBuf *ibuf,
|
||||
MovieTrackingTrack *track,
|
||||
MovieTrackingMarker *marker,
|
||||
int *width_r,
|
||||
int *height_r)
|
||||
int *r_width,
|
||||
int *r_height)
|
||||
{
|
||||
ImBuf *searchibuf;
|
||||
float *gray_pixels;
|
||||
|
@ -85,8 +85,8 @@ static float *track_get_search_floatbuf(ImBuf *ibuf,
|
|||
searchibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, false, true);
|
||||
|
||||
if (!searchibuf) {
|
||||
*width_r = 0;
|
||||
*height_r = 0;
|
||||
*r_width = 0;
|
||||
*r_height = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ static float *track_get_search_floatbuf(ImBuf *ibuf,
|
|||
|
||||
IMB_freeImBuf(searchibuf);
|
||||
|
||||
*width_r = width;
|
||||
*height_r = height;
|
||||
*r_width = width;
|
||||
*r_height = height;
|
||||
|
||||
return gray_pixels;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ static ImBuf *tracking_context_get_keyframed_ibuf(MovieClip *clip,
|
|||
MovieTrackingTrack *track,
|
||||
int curfra,
|
||||
bool backwards,
|
||||
MovieTrackingMarker **marker_keyed_r)
|
||||
MovieTrackingMarker **r_marker_keyed)
|
||||
{
|
||||
MovieTrackingMarker *marker_keyed;
|
||||
int keyed_framenr;
|
||||
|
@ -150,7 +150,7 @@ static ImBuf *tracking_context_get_keyframed_ibuf(MovieClip *clip,
|
|||
|
||||
keyed_framenr = marker_keyed->framenr;
|
||||
|
||||
*marker_keyed_r = marker_keyed;
|
||||
*r_marker_keyed = marker_keyed;
|
||||
|
||||
return tracking_context_get_frame_ibuf(clip, user, clip_flag, keyed_framenr);
|
||||
}
|
||||
|
|
|
@ -73,10 +73,10 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites,
|
|||
struct ListBase *edges,
|
||||
int width,
|
||||
int height,
|
||||
VoronoiTriangulationPoint **triangulated_points_r,
|
||||
int *triangulated_points_total_r,
|
||||
int (**triangles_r)[3],
|
||||
int *triangles_total_r);
|
||||
VoronoiTriangulationPoint **r_triangulated_points,
|
||||
int *r_triangulated_points_total,
|
||||
int (**r_triangles)[3],
|
||||
int *r_triangles_total);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -792,10 +792,10 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites,
|
|||
ListBase *edges,
|
||||
int width,
|
||||
int height,
|
||||
VoronoiTriangulationPoint **triangulated_points_r,
|
||||
int *triangulated_points_total_r,
|
||||
int (**triangles_r)[3],
|
||||
int *triangles_total_r)
|
||||
VoronoiTriangulationPoint **r_triangulated_points,
|
||||
int *r_triangulated_points_total,
|
||||
int (**r_triangles)[3],
|
||||
int *r_triangles_total)
|
||||
{
|
||||
VoronoiTriangulationPoint *triangulated_points = NULL;
|
||||
int(*triangles)[3] = NULL;
|
||||
|
@ -853,11 +853,11 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites,
|
|||
mul_v3_fl(triangulation_point->color, 1.0f / triangulation_point->power);
|
||||
}
|
||||
|
||||
*triangulated_points_r = triangulated_points;
|
||||
*triangulated_points_total_r = triangulated_points_total;
|
||||
*r_triangulated_points = triangulated_points;
|
||||
*r_triangulated_points_total = triangulated_points_total;
|
||||
|
||||
*triangles_r = triangles;
|
||||
*triangles_total_r = triangles_total;
|
||||
*r_triangles = triangles;
|
||||
*r_triangles_total = triangles_total;
|
||||
|
||||
BLI_freelistN(&boundary_edges);
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
|
|||
return 1.0f;
|
||||
}
|
||||
|
||||
static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prevfra)
|
||||
static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_prevfra)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -594,17 +594,17 @@ static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prev
|
|||
/* any success? */
|
||||
if (doneprev || donenext) {
|
||||
if (doneprev) {
|
||||
*prevfra = cfraprev;
|
||||
*r_prevfra = cfraprev;
|
||||
}
|
||||
else {
|
||||
*prevfra = CFRA - (cfranext - CFRA);
|
||||
*r_prevfra = CFRA - (cfranext - CFRA);
|
||||
}
|
||||
|
||||
if (donenext) {
|
||||
*nextfra = cfranext;
|
||||
*r_nextfra = cfranext;
|
||||
}
|
||||
else {
|
||||
*nextfra = CFRA + (CFRA - cfraprev);
|
||||
*r_nextfra = CFRA + (CFRA - cfraprev);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -197,7 +197,7 @@ int ED_markers_find_nearest_marker_time(ListBase *markers, float x)
|
|||
return (nearest) ? (nearest->frame) : round_fl_to_int(x);
|
||||
}
|
||||
|
||||
void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *last)
|
||||
void ED_markers_get_minmax(ListBase *markers, short sel, float *r_first, float *r_last)
|
||||
{
|
||||
TimeMarker *marker;
|
||||
float min, max;
|
||||
|
@ -205,8 +205,8 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
|
|||
/* sanity check */
|
||||
// printf("markers = %p - %p, %p\n", markers, markers->first, markers->last);
|
||||
if (ELEM(NULL, markers, markers->first, markers->last)) {
|
||||
*first = 0.0f;
|
||||
*last = 0.0f;
|
||||
*r_first = 0.0f;
|
||||
*r_last = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -224,8 +224,8 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
|
|||
}
|
||||
|
||||
/* set the min/max values */
|
||||
*first = min;
|
||||
*last = max;
|
||||
*r_first = min;
|
||||
*r_last = max;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,14 +65,14 @@ int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf);
|
|||
void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock);
|
||||
bool ED_space_image_has_buffer(struct SpaceImage *sima);
|
||||
|
||||
void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
|
||||
void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
|
||||
void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
|
||||
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height);
|
||||
void ED_space_image_get_size_fl(struct SpaceImage *sima, float r_size[2]);
|
||||
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
|
||||
void ED_space_image_get_zoom(struct SpaceImage *sima,
|
||||
struct ARegion *region,
|
||||
float *zoomx,
|
||||
float *zoomy);
|
||||
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
|
||||
float *r_zoomx,
|
||||
float *r_zoomy);
|
||||
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
|
||||
|
||||
void ED_space_image_scopes_update(const struct bContext *C,
|
||||
struct SpaceImage *sima,
|
||||
|
@ -83,14 +83,17 @@ void ED_space_image_paint_update(struct Main *bmain,
|
|||
struct wmWindowManager *wm,
|
||||
struct Scene *scene);
|
||||
|
||||
void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy);
|
||||
void ED_image_get_uv_aspect(struct Image *ima,
|
||||
struct ImageUser *iuser,
|
||||
float *r_aspx,
|
||||
float *r_aspy);
|
||||
void ED_image_mouse_pos(struct SpaceImage *sima,
|
||||
struct ARegion *region,
|
||||
const int mval[2],
|
||||
float co[2]);
|
||||
void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
|
||||
void ED_image_point_pos(
|
||||
struct SpaceImage *sima, struct ARegion *region, float x, float y, float *xr, float *yr);
|
||||
struct SpaceImage *sima, struct ARegion *region, float x, float y, float *r_x, float *r_y);
|
||||
void ED_image_point_pos__reverse(struct SpaceImage *sima,
|
||||
struct ARegion *region,
|
||||
const float co[2],
|
||||
|
|
|
@ -188,7 +188,7 @@ bool ED_uvedit_nearest_uv_multi(const struct Scene *scene,
|
|||
float r_uv[2]);
|
||||
|
||||
void ED_uvedit_get_aspect(
|
||||
const struct Scene *scene, struct Object *ob, struct BMesh *em, float *aspx, float *aspy);
|
||||
const struct Scene *scene, struct Object *ob, struct BMesh *em, float *r_aspx, float *r_aspy);
|
||||
|
||||
/* uvedit_unwrap_ops.c */
|
||||
void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
|
||||
|
|
|
@ -674,8 +674,10 @@ bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d,
|
|||
const float dist_co[3],
|
||||
const float dist_min);
|
||||
|
||||
float ED_scene_grid_scale(const struct Scene *scene, const char **grid_unit);
|
||||
float ED_view3d_grid_scale(const struct Scene *scene, struct View3D *v3d, const char **grid_unit);
|
||||
float ED_scene_grid_scale(const struct Scene *scene, const char **r_grid_unit);
|
||||
float ED_view3d_grid_scale(const struct Scene *scene,
|
||||
struct View3D *v3d,
|
||||
const char **r_grid_unit);
|
||||
void ED_view3d_grid_steps(const struct Scene *scene,
|
||||
struct View3D *v3d,
|
||||
struct RegionView3D *rv3d,
|
||||
|
@ -683,7 +685,7 @@ void ED_view3d_grid_steps(const struct Scene *scene,
|
|||
float ED_view3d_grid_view_scale(struct Scene *scene,
|
||||
struct View3D *v3d,
|
||||
struct RegionView3D *rv3d,
|
||||
const char **grid_unit);
|
||||
const char **r_grid_unit);
|
||||
|
||||
void ED_scene_draw_fps(const struct Scene *scene, int xoffset, int *yoffset);
|
||||
|
||||
|
|
|
@ -2362,7 +2362,7 @@ void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop);
|
|||
bool UI_drop_color_poll(struct bContext *C,
|
||||
struct wmDrag *drag,
|
||||
const struct wmEvent *event,
|
||||
const char **tooltip);
|
||||
const char **r_tooltip);
|
||||
|
||||
bool UI_context_copy_to_selected_list(struct bContext *C,
|
||||
struct PointerRNA *ptr,
|
||||
|
|
|
@ -1251,7 +1251,7 @@ static bool ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
|
|||
|
||||
void UI_editsource_active_but_test(uiBut *but)
|
||||
{
|
||||
extern void PyC_FileAndNum_Safe(const char **filename, int *lineno);
|
||||
extern void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno);
|
||||
|
||||
struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__);
|
||||
|
||||
|
@ -1703,7 +1703,7 @@ static void UI_OT_button_string_clear(wmOperatorType *ot)
|
|||
bool UI_drop_color_poll(struct bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
/* should only return true for regions that include buttons, for now
|
||||
* return true always */
|
||||
|
|
|
@ -55,11 +55,11 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
|
|||
float tangent[2],
|
||||
const bool use_deform,
|
||||
const bool use_project,
|
||||
MaskLayer **mask_layer_r,
|
||||
MaskSpline **spline_r,
|
||||
MaskSplinePoint **point_r,
|
||||
float *u_r,
|
||||
float *score_r)
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_spline,
|
||||
MaskSplinePoint **r_point,
|
||||
float *r_u,
|
||||
float *r_score)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
@ -156,44 +156,44 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
|
|||
}
|
||||
|
||||
if (point && dist_best_sq < threshold) {
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = point_mask_layer;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = point_mask_layer;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = point_spline;
|
||||
if (r_spline) {
|
||||
*r_spline = point_spline;
|
||||
}
|
||||
|
||||
if (point_r) {
|
||||
*point_r = point;
|
||||
if (r_point) {
|
||||
*r_point = point;
|
||||
}
|
||||
|
||||
if (u_r) {
|
||||
if (r_u) {
|
||||
/* TODO(sergey): Projection fails in some weirdo cases.. */
|
||||
if (use_project) {
|
||||
u = BKE_mask_spline_project_co(point_spline, point, u, normal_co, MASK_PROJ_ANY);
|
||||
}
|
||||
|
||||
*u_r = u;
|
||||
*r_u = u;
|
||||
}
|
||||
|
||||
if (score_r) {
|
||||
*score_r = dist_best_sq;
|
||||
if (r_score) {
|
||||
*r_score = dist_best_sq;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = NULL;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = NULL;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = NULL;
|
||||
if (r_spline) {
|
||||
*r_spline = NULL;
|
||||
}
|
||||
|
||||
if (point_r) {
|
||||
*point_r = NULL;
|
||||
if (r_point) {
|
||||
*r_point = NULL;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -39,11 +39,11 @@ bool ED_mask_find_nearest_diff_point(const struct bContext *C,
|
|||
float tangent[2],
|
||||
const bool use_deform,
|
||||
const bool use_project,
|
||||
struct MaskLayer **mask_layer_r,
|
||||
struct MaskSpline **spline_r,
|
||||
struct MaskSplinePoint **point_r,
|
||||
float *u_r,
|
||||
float *score_r);
|
||||
struct MaskLayer **r_mask_layer,
|
||||
struct MaskSpline **r_spline,
|
||||
struct MaskSplinePoint **r_point,
|
||||
float *r_u,
|
||||
float *r_score);
|
||||
|
||||
void MASK_OT_add_vertex(struct wmOperatorType *ot);
|
||||
void MASK_OT_add_feather_vertex(struct wmOperatorType *ot);
|
||||
|
@ -76,20 +76,20 @@ bool ED_mask_feather_find_nearest(const struct bContext *C,
|
|||
struct Mask *mask,
|
||||
const float normal_co[2],
|
||||
const float threshold,
|
||||
struct MaskLayer **mask_layer_r,
|
||||
struct MaskSpline **spline_r,
|
||||
struct MaskSplinePoint **point_r,
|
||||
struct MaskSplinePointUW **uw_r,
|
||||
float *score);
|
||||
struct MaskLayer **r_mask_layer,
|
||||
struct MaskSpline **r_spline,
|
||||
struct MaskSplinePoint **r_point,
|
||||
struct MaskSplinePointUW **r_uw,
|
||||
float *r_score);
|
||||
|
||||
struct MaskSplinePoint *ED_mask_point_find_nearest(const struct bContext *C,
|
||||
struct Mask *mask,
|
||||
const float normal_co[2],
|
||||
const float threshold,
|
||||
struct MaskLayer **mask_layer_r,
|
||||
struct MaskSpline **spline_r,
|
||||
eMaskWhichHandle *which_handle_r,
|
||||
float *score);
|
||||
struct MaskLayer **r_mask_layer,
|
||||
struct MaskSpline **r_spline,
|
||||
eMaskWhichHandle *r_which_handle,
|
||||
float *r_score);
|
||||
|
||||
void MASK_OT_layer_move(struct wmOperatorType *ot);
|
||||
|
||||
|
|
|
@ -69,10 +69,10 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
|
|||
Mask *mask_orig,
|
||||
const float normal_co[2],
|
||||
const float threshold,
|
||||
MaskLayer **mask_layer_r,
|
||||
MaskSpline **spline_r,
|
||||
eMaskWhichHandle *which_handle_r,
|
||||
float *score)
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_spline,
|
||||
eMaskWhichHandle *r_which_handle,
|
||||
float *r_score)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
@ -185,35 +185,35 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
|
|||
}
|
||||
|
||||
if (len_sq < threshold_sq) {
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = point_mask_layer;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = point_mask_layer;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = point_spline;
|
||||
if (r_spline) {
|
||||
*r_spline = point_spline;
|
||||
}
|
||||
|
||||
if (which_handle_r) {
|
||||
*which_handle_r = which_handle;
|
||||
if (r_which_handle) {
|
||||
*r_which_handle = which_handle;
|
||||
}
|
||||
|
||||
if (score) {
|
||||
*score = sqrtf(len_sq);
|
||||
if (r_score) {
|
||||
*r_score = sqrtf(len_sq);
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = NULL;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = NULL;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = NULL;
|
||||
if (r_spline) {
|
||||
*r_spline = NULL;
|
||||
}
|
||||
|
||||
if (which_handle_r) {
|
||||
*which_handle_r = MASK_WHICH_HANDLE_NONE;
|
||||
if (r_which_handle) {
|
||||
*r_which_handle = MASK_WHICH_HANDLE_NONE;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -223,11 +223,11 @@ bool ED_mask_feather_find_nearest(const bContext *C,
|
|||
Mask *mask_orig,
|
||||
const float normal_co[2],
|
||||
const float threshold,
|
||||
MaskLayer **mask_layer_r,
|
||||
MaskSpline **spline_r,
|
||||
MaskSplinePoint **point_r,
|
||||
MaskSplinePointUW **uw_r,
|
||||
float *score)
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_spline,
|
||||
MaskSplinePoint **r_point,
|
||||
MaskSplinePointUW **r_uw,
|
||||
float *r_score)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
@ -306,39 +306,39 @@ bool ED_mask_feather_find_nearest(const bContext *C,
|
|||
}
|
||||
|
||||
if (len < threshold_sq) {
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = point_mask_layer;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = point_mask_layer;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = point_spline;
|
||||
if (r_spline) {
|
||||
*r_spline = point_spline;
|
||||
}
|
||||
|
||||
if (point_r) {
|
||||
*point_r = point;
|
||||
if (r_point) {
|
||||
*r_point = point;
|
||||
}
|
||||
|
||||
if (uw_r) {
|
||||
*uw_r = uw;
|
||||
if (r_uw) {
|
||||
*r_uw = uw;
|
||||
}
|
||||
|
||||
if (score) {
|
||||
*score = sqrtf(len);
|
||||
if (r_score) {
|
||||
*r_score = sqrtf(len);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mask_layer_r) {
|
||||
*mask_layer_r = NULL;
|
||||
if (r_mask_layer) {
|
||||
*r_mask_layer = NULL;
|
||||
}
|
||||
|
||||
if (spline_r) {
|
||||
*spline_r = NULL;
|
||||
if (r_spline) {
|
||||
*r_spline = NULL;
|
||||
}
|
||||
|
||||
if (point_r) {
|
||||
*point_r = NULL;
|
||||
if (r_point) {
|
||||
*r_point = NULL;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -549,8 +549,8 @@ static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float c
|
|||
static bool spline_under_mouse_get(const bContext *C,
|
||||
Mask *mask,
|
||||
const float co[2],
|
||||
MaskLayer **mask_layer_r,
|
||||
MaskSpline **mask_spline_r)
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_mask_spline)
|
||||
{
|
||||
const float threshold = 19.0f;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
@ -561,8 +561,8 @@ static bool spline_under_mouse_get(const bContext *C,
|
|||
MaskLayer *closest_layer = NULL;
|
||||
MaskSpline *closest_spline = NULL;
|
||||
bool undistort = false;
|
||||
*mask_layer_r = NULL;
|
||||
*mask_spline_r = NULL;
|
||||
*r_mask_layer = NULL;
|
||||
*r_mask_spline = NULL;
|
||||
ED_mask_get_size(sa, &width, &height);
|
||||
pixel_co[0] = co[0] * width;
|
||||
pixel_co[1] = co[1] * height;
|
||||
|
@ -634,8 +634,8 @@ static bool spline_under_mouse_get(const bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
*mask_layer_r = closest_layer;
|
||||
*mask_spline_r = closest_spline;
|
||||
*r_mask_layer = closest_layer;
|
||||
*r_mask_spline = closest_spline;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -5525,7 +5525,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
|
|||
static bool blend_file_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
if (drag->icon == ICON_FILE_BLEND) {
|
||||
|
|
|
@ -178,7 +178,7 @@ void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
|
|||
|
||||
/* tracking_ops.c */
|
||||
struct MovieTrackingTrack *tracking_marker_check_slide(
|
||||
struct bContext *C, const struct wmEvent *event, int *area_r, int *action_r, int *corner_r);
|
||||
struct bContext *C, const struct wmEvent *event, int *r_area, int *r_action, int *r_corner);
|
||||
|
||||
void CLIP_OT_add_marker(struct wmOperatorType *ot);
|
||||
void CLIP_OT_add_marker_at_click(struct wmOperatorType *ot);
|
||||
|
|
|
@ -1315,8 +1315,8 @@ typedef struct ProxyThread {
|
|||
|
||||
static unsigned char *proxy_thread_next_frame(ProxyQueue *queue,
|
||||
MovieClip *clip,
|
||||
size_t *size_r,
|
||||
int *cfra_r)
|
||||
size_t *r_size,
|
||||
int *r_cfra)
|
||||
{
|
||||
unsigned char *mem = NULL;
|
||||
|
||||
|
@ -1353,8 +1353,8 @@ static unsigned char *proxy_thread_next_frame(ProxyQueue *queue,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
*size_r = size;
|
||||
*cfra_r = queue->cfra;
|
||||
*r_size = size;
|
||||
*r_cfra = queue->cfra;
|
||||
|
||||
queue->cfra++;
|
||||
close(file);
|
||||
|
|
|
@ -605,7 +605,7 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
|
|||
static bool clip_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
/* rule might not work? */
|
||||
|
|
|
@ -544,7 +544,7 @@ static bool slide_check_corners(float (*corners)[2])
|
|||
}
|
||||
|
||||
MovieTrackingTrack *tracking_marker_check_slide(
|
||||
bContext *C, const wmEvent *event, int *area_r, int *action_r, int *corner_r)
|
||||
bContext *C, const wmEvent *event, int *r_area, int *r_action, int *r_corner)
|
||||
{
|
||||
const float distance_clip_squared = 12.0f * 12.0f;
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
|
@ -657,14 +657,14 @@ MovieTrackingTrack *tracking_marker_check_slide(
|
|||
}
|
||||
|
||||
if (global_min_distance_squared < distance_clip_squared / sc->zoom) {
|
||||
if (area_r) {
|
||||
*area_r = min_area;
|
||||
if (r_area) {
|
||||
*r_area = min_area;
|
||||
}
|
||||
if (action_r) {
|
||||
*action_r = min_action;
|
||||
if (r_action) {
|
||||
*r_action = min_action;
|
||||
}
|
||||
if (corner_r) {
|
||||
*corner_r = min_corner;
|
||||
if (r_corner) {
|
||||
*r_corner = min_corner;
|
||||
}
|
||||
return min_track;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ static float mouse_to_plane_slide_zone_distance_squared(const float co[2],
|
|||
|
||||
static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(bContext *C,
|
||||
const wmEvent *event,
|
||||
int *corner_r)
|
||||
int *r_corner)
|
||||
{
|
||||
const float distance_clip_squared = 12.0f * 12.0f;
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
|
@ -162,8 +162,8 @@ static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(bContext *C,
|
|||
}
|
||||
|
||||
if (min_distance_squared < distance_clip_squared / sc->zoom) {
|
||||
if (corner_r != NULL) {
|
||||
*corner_r = min_corner;
|
||||
if (r_corner != NULL) {
|
||||
*r_corner = min_corner;
|
||||
}
|
||||
return min_plane_track;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static int track_count_markers(SpaceClip *sc, MovieClip *clip, int framenr)
|
|||
return tot;
|
||||
}
|
||||
|
||||
static void track_init_markers(SpaceClip *sc, MovieClip *clip, int framenr, int *frames_limit_r)
|
||||
static void track_init_markers(SpaceClip *sc, MovieClip *clip, int framenr, int *r_frames_limit)
|
||||
{
|
||||
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
|
||||
int frames_limit = 0;
|
||||
|
@ -109,7 +109,7 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip, int framenr, int
|
|||
}
|
||||
}
|
||||
}
|
||||
*frames_limit_r = frames_limit;
|
||||
*r_frames_limit = frames_limit;
|
||||
}
|
||||
|
||||
static bool track_markers_check_direction(int backwards, int curfra, int efra)
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "clip_intern.h" /* own include */
|
||||
#include "tracking_ops_intern.h" /* own include */
|
||||
|
||||
static float dist_to_crns(float co[2], float pos[2], float crns[4][2]);
|
||||
static float dist_to_crns(const float co[2], const float pos[2], const float crns[4][2]);
|
||||
|
||||
/********************** mouse select operator *********************/
|
||||
|
||||
|
@ -70,8 +70,12 @@ static int mouse_on_side(
|
|||
return (co[0] >= x1 - epsx && co[0] <= x2 + epsx) && (co[1] >= y1 - epsy && co[1] <= y2 + epsy);
|
||||
}
|
||||
|
||||
static int mouse_on_rect(
|
||||
const float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
|
||||
static int mouse_on_rect(const float co[2],
|
||||
const float pos[2],
|
||||
const float min[2],
|
||||
const float max[2],
|
||||
float epsx,
|
||||
float epsy)
|
||||
{
|
||||
return mouse_on_side(
|
||||
co, pos[0] + min[0], pos[1] + min[1], pos[0] + max[0], pos[1] + min[1], epsx, epsy) ||
|
||||
|
@ -83,14 +87,15 @@ static int mouse_on_rect(
|
|||
co, pos[0] + max[0], pos[1] + min[1], pos[0] + max[0], pos[1] + max[1], epsx, epsy);
|
||||
}
|
||||
|
||||
static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx, float epsy)
|
||||
static int mouse_on_crns(
|
||||
const float co[2], const float pos[2], const float crns[4][2], float epsx, float epsy)
|
||||
{
|
||||
float dist = dist_to_crns(co, pos, crns);
|
||||
|
||||
return dist < max_ff(epsx, epsy);
|
||||
}
|
||||
|
||||
static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track)
|
||||
static int track_mouse_area(const bContext *C, const float co[2], MovieTrackingTrack *track)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
int framenr = ED_space_clip_get_clip_frame_number(sc);
|
||||
|
@ -142,7 +147,10 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *
|
|||
return TRACK_AREA_NONE;
|
||||
}
|
||||
|
||||
static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2])
|
||||
static float dist_to_rect(const float co[2],
|
||||
const float pos[2],
|
||||
const float min[2],
|
||||
const float max[2])
|
||||
{
|
||||
float d1, d2, d3, d4;
|
||||
float p[2] = {co[0] - pos[0], co[1] - pos[1]};
|
||||
|
@ -158,7 +166,7 @@ static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2])
|
|||
}
|
||||
|
||||
/* Distance to quad defined by it's corners, corners are relative to pos */
|
||||
static float dist_to_crns(float co[2], float pos[2], float crns[4][2])
|
||||
static float dist_to_crns(const float co[2], const float pos[2], const float crns[4][2])
|
||||
{
|
||||
float d1, d2, d3, d4;
|
||||
float p[2] = {co[0] - pos[0], co[1] - pos[1]};
|
||||
|
@ -174,7 +182,7 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2])
|
|||
}
|
||||
|
||||
/* Same as above, but all the coordinates are absolute */
|
||||
static float dist_to_crns_abs(float co[2], float corners[4][2])
|
||||
static float dist_to_crns_abs(const float co[2], const float corners[4][2])
|
||||
{
|
||||
float d1, d2, d3, d4;
|
||||
const float *v1 = corners[0], *v2 = corners[1];
|
||||
|
@ -190,8 +198,8 @@ static float dist_to_crns_abs(float co[2], float corners[4][2])
|
|||
|
||||
static MovieTrackingTrack *find_nearest_track(SpaceClip *sc,
|
||||
ListBase *tracksbase,
|
||||
float co[2],
|
||||
float *distance_r)
|
||||
const float co[2],
|
||||
float *r_distance)
|
||||
{
|
||||
MovieTrackingTrack *track = NULL, *cur;
|
||||
float mindist = 0.0f;
|
||||
|
@ -231,15 +239,15 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc,
|
|||
cur = cur->next;
|
||||
}
|
||||
|
||||
*distance_r = mindist;
|
||||
*r_distance = mindist;
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
static MovieTrackingPlaneTrack *find_nearest_plane_track(SpaceClip *sc,
|
||||
ListBase *plane_tracks_base,
|
||||
float co[2],
|
||||
float *distance_r)
|
||||
const float co[2],
|
||||
float *r_distance)
|
||||
{
|
||||
MovieTrackingPlaneTrack *plane_track = NULL, *current_plane_track;
|
||||
float min_distance = 0.0f;
|
||||
|
@ -259,7 +267,7 @@ static MovieTrackingPlaneTrack *find_nearest_plane_track(SpaceClip *sc,
|
|||
}
|
||||
}
|
||||
|
||||
*distance_r = min_distance;
|
||||
*r_distance = min_distance;
|
||||
|
||||
return plane_track;
|
||||
}
|
||||
|
@ -281,7 +289,7 @@ void ed_tracking_deselect_all_plane_tracks(ListBase *plane_tracks_base)
|
|||
}
|
||||
}
|
||||
|
||||
static int mouse_select(bContext *C, float co[2], const bool extend, const bool deselect_all)
|
||||
static int mouse_select(bContext *C, const float co[2], const bool extend, const bool deselect_all)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
MovieClip *clip = ED_space_clip_get_clip(sc);
|
||||
|
|
|
@ -2436,9 +2436,9 @@ void filelist_entry_parent_select_set(FileList *filelist,
|
|||
}
|
||||
|
||||
/* WARNING! dir must be FILE_MAX_LIBEXTRA long! */
|
||||
bool filelist_islibrary(struct FileList *filelist, char *dir, char **group)
|
||||
bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group)
|
||||
{
|
||||
return BLO_library_path_explode(filelist->filelist.root, dir, group, NULL);
|
||||
return BLO_library_path_explode(filelist->filelist.root, dir, r_group, NULL);
|
||||
}
|
||||
|
||||
static int groupname_to_code(const char *group)
|
||||
|
|
|
@ -125,7 +125,7 @@ void filelist_entry_parent_select_set(struct FileList *filelist,
|
|||
void filelist_setrecursion(struct FileList *filelist, const int recursion_level);
|
||||
|
||||
struct BlendHandle *filelist_lib(struct FileList *filelist);
|
||||
bool filelist_islibrary(struct FileList *filelist, char *dir, char **group);
|
||||
bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group);
|
||||
void filelist_freelib(struct FileList *filelist);
|
||||
|
||||
void filelist_readjob_start(struct FileList *filelist, const struct bContext *C);
|
||||
|
|
|
@ -663,7 +663,7 @@ static void file_ui_region_listener(wmWindow *UNUSED(win),
|
|||
static bool filepath_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
|
|
@ -212,7 +212,7 @@ bool ED_space_image_has_buffer(SpaceImage *sima)
|
|||
return has_buffer;
|
||||
}
|
||||
|
||||
void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
|
||||
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
|
||||
{
|
||||
Scene *scene = sima->iuser.scene;
|
||||
ImBuf *ibuf;
|
||||
|
@ -222,94 +222,94 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
|
|||
ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
|
||||
|
||||
if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
|
||||
*width = ibuf->x;
|
||||
*height = ibuf->y;
|
||||
*r_width = ibuf->x;
|
||||
*r_height = ibuf->y;
|
||||
}
|
||||
else if (sima->image && sima->image->type == IMA_TYPE_R_RESULT && scene) {
|
||||
/* not very important, just nice */
|
||||
*width = (scene->r.xsch * scene->r.size) / 100;
|
||||
*height = (scene->r.ysch * scene->r.size) / 100;
|
||||
*r_width = (scene->r.xsch * scene->r.size) / 100;
|
||||
*r_height = (scene->r.ysch * scene->r.size) / 100;
|
||||
|
||||
if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
|
||||
*width *= BLI_rctf_size_x(&scene->r.border);
|
||||
*height *= BLI_rctf_size_y(&scene->r.border);
|
||||
*r_width *= BLI_rctf_size_x(&scene->r.border);
|
||||
*r_height *= BLI_rctf_size_y(&scene->r.border);
|
||||
}
|
||||
}
|
||||
/* I know a bit weak... but preview uses not actual image size */
|
||||
// XXX else if (image_preview_active(sima, width, height));
|
||||
// XXX else if (image_preview_active(sima, r_width, r_height));
|
||||
else {
|
||||
*width = IMG_SIZE_FALLBACK;
|
||||
*height = IMG_SIZE_FALLBACK;
|
||||
*r_width = IMG_SIZE_FALLBACK;
|
||||
*r_height = IMG_SIZE_FALLBACK;
|
||||
}
|
||||
|
||||
ED_space_image_release_buffer(sima, ibuf, lock);
|
||||
}
|
||||
|
||||
void ED_space_image_get_size_fl(SpaceImage *sima, float size[2])
|
||||
void ED_space_image_get_size_fl(SpaceImage *sima, float r_size[2])
|
||||
{
|
||||
int size_i[2];
|
||||
ED_space_image_get_size(sima, &size_i[0], &size_i[1]);
|
||||
size[0] = size_i[0];
|
||||
size[1] = size_i[1];
|
||||
r_size[0] = size_i[0];
|
||||
r_size[1] = size_i[1];
|
||||
}
|
||||
|
||||
void ED_space_image_get_aspect(SpaceImage *sima, float *aspx, float *aspy)
|
||||
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
|
||||
{
|
||||
Image *ima = sima->image;
|
||||
if ((ima == NULL) || (ima->aspx == 0.0f || ima->aspy == 0.0f)) {
|
||||
*aspx = *aspy = 1.0;
|
||||
*r_aspx = *r_aspy = 1.0;
|
||||
}
|
||||
else {
|
||||
BKE_image_get_aspect(ima, aspx, aspy);
|
||||
BKE_image_get_aspect(ima, r_aspx, r_aspy);
|
||||
}
|
||||
}
|
||||
|
||||
void ED_space_image_get_zoom(SpaceImage *sima, ARegion *region, float *zoomx, float *zoomy)
|
||||
void ED_space_image_get_zoom(SpaceImage *sima, ARegion *region, float *r_zoomx, float *r_zoomy)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
ED_space_image_get_size(sima, &width, &height);
|
||||
|
||||
*zoomx = (float)(BLI_rcti_size_x(®ion->winrct) + 1) /
|
||||
(float)(BLI_rctf_size_x(®ion->v2d.cur) * width);
|
||||
*zoomy = (float)(BLI_rcti_size_y(®ion->winrct) + 1) /
|
||||
(float)(BLI_rctf_size_y(®ion->v2d.cur) * height);
|
||||
*r_zoomx = (float)(BLI_rcti_size_x(®ion->winrct) + 1) /
|
||||
(float)(BLI_rctf_size_x(®ion->v2d.cur) * width);
|
||||
*r_zoomy = (float)(BLI_rcti_size_y(®ion->winrct) + 1) /
|
||||
(float)(BLI_rctf_size_y(®ion->v2d.cur) * height);
|
||||
}
|
||||
|
||||
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
|
||||
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
ED_space_image_get_aspect(sima, aspx, aspy);
|
||||
ED_space_image_get_aspect(sima, r_aspx, r_aspy);
|
||||
ED_space_image_get_size(sima, &w, &h);
|
||||
|
||||
*aspx *= (float)w;
|
||||
*aspy *= (float)h;
|
||||
*r_aspx *= (float)w;
|
||||
*r_aspy *= (float)h;
|
||||
|
||||
if (*aspx < *aspy) {
|
||||
*aspy = *aspy / *aspx;
|
||||
*aspx = 1.0f;
|
||||
if (*r_aspx < *r_aspy) {
|
||||
*r_aspy = *r_aspy / *r_aspx;
|
||||
*r_aspx = 1.0f;
|
||||
}
|
||||
else {
|
||||
*aspx = *aspx / *aspy;
|
||||
*aspy = 1.0f;
|
||||
*r_aspx = *r_aspx / *r_aspy;
|
||||
*r_aspy = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *aspx, float *aspy)
|
||||
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *r_aspx, float *r_aspy)
|
||||
{
|
||||
if (ima) {
|
||||
int w, h;
|
||||
|
||||
BKE_image_get_aspect(ima, aspx, aspy);
|
||||
BKE_image_get_aspect(ima, r_aspx, r_aspy);
|
||||
BKE_image_get_size(ima, iuser, &w, &h);
|
||||
|
||||
*aspx *= (float)w;
|
||||
*aspy *= (float)h;
|
||||
*r_aspx *= (float)w;
|
||||
*r_aspy *= (float)h;
|
||||
}
|
||||
else {
|
||||
*aspx = 1.0f;
|
||||
*aspy = 1.0f;
|
||||
*r_aspx = 1.0f;
|
||||
*r_aspy = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,8 @@ void ED_image_view_center_to_point(SpaceImage *sima, float x, float y)
|
|||
sima->yof = (y - 0.5f) * height * aspy;
|
||||
}
|
||||
|
||||
void ED_image_point_pos(SpaceImage *sima, ARegion *region, float x, float y, float *xr, float *yr)
|
||||
void ED_image_point_pos(
|
||||
SpaceImage *sima, ARegion *region, float x, float y, float *r_x, float *r_y)
|
||||
{
|
||||
int sx, sy, width, height;
|
||||
float zoomx, zoomy;
|
||||
|
@ -350,8 +351,8 @@ void ED_image_point_pos(SpaceImage *sima, ARegion *region, float x, float y, flo
|
|||
|
||||
UI_view2d_view_to_region(®ion->v2d, 0.0f, 0.0f, &sx, &sy);
|
||||
|
||||
*xr = ((x - sx) / zoomx) / width;
|
||||
*yr = ((y - sy) / zoomy) / height;
|
||||
*r_x = ((x - sx) / zoomx) / width;
|
||||
*r_y = ((y - sy) / zoomy) / height;
|
||||
}
|
||||
|
||||
void ED_image_point_pos__reverse(SpaceImage *sima,
|
||||
|
|
|
@ -265,7 +265,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
|
|||
static bool image_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (ED_region_overlap_isect_any_xy(area, &event->x)) {
|
||||
|
|
|
@ -102,28 +102,29 @@ static void textview_draw_sel(const char *str,
|
|||
}
|
||||
|
||||
/**
|
||||
* \warning Allocated memory for 'offsets' must be freed by caller.
|
||||
* \warning Allocated memory for 'r_offsets' must be freed by caller.
|
||||
* \return The length in bytes.
|
||||
*/
|
||||
static int textview_wrap_offsets(const char *str, int len, int width, int *lines, int **offsets)
|
||||
static int textview_wrap_offsets(
|
||||
const char *str, int len, int width, int *r_lines, int **r_offsets)
|
||||
{
|
||||
int i, end; /* Offset as unicode code-point. */
|
||||
int j; /* Offset as bytes. */
|
||||
|
||||
*lines = 1;
|
||||
*r_lines = 1;
|
||||
|
||||
*offsets = MEM_callocN(
|
||||
sizeof(**offsets) *
|
||||
*r_offsets = MEM_callocN(
|
||||
sizeof(**r_offsets) *
|
||||
(len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1),
|
||||
__func__);
|
||||
(*offsets)[0] = 0;
|
||||
(*r_offsets)[0] = 0;
|
||||
|
||||
for (i = 0, end = width, j = 0; j < len && str[j]; j += BLI_str_utf8_size_safe(str + j)) {
|
||||
int columns = BLI_str_utf8_char_width_safe(str + j);
|
||||
|
||||
if (i + columns > end) {
|
||||
(*offsets)[*lines] = j;
|
||||
(*lines)++;
|
||||
(*r_offsets)[*r_lines] = j;
|
||||
(*r_lines)++;
|
||||
|
||||
end = i + width;
|
||||
}
|
||||
|
|
|
@ -819,7 +819,7 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
static void edit_node_properties_get(
|
||||
wmOperator *op, bNodeTree *ntree, bNode **rnode, bNodeSocket **rsock, int *rin_out)
|
||||
wmOperator *op, bNodeTree *ntree, bNode **r_node, bNodeSocket **r_sock, int *r_in_out)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *sock = NULL;
|
||||
|
@ -842,14 +842,14 @@ static void edit_node_properties_get(
|
|||
break;
|
||||
}
|
||||
|
||||
if (rnode) {
|
||||
*rnode = node;
|
||||
if (r_node) {
|
||||
*r_node = node;
|
||||
}
|
||||
if (rsock) {
|
||||
*rsock = sock;
|
||||
if (r_sock) {
|
||||
*r_sock = sock;
|
||||
}
|
||||
if (rin_out) {
|
||||
*rin_out = in_out;
|
||||
if (r_in_out) {
|
||||
*r_in_out = in_out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -635,7 +635,7 @@ static void node_main_region_draw(const bContext *C, ARegion *region)
|
|||
static bool node_ima_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
/* rule might not work? */
|
||||
|
@ -649,7 +649,7 @@ static bool node_ima_drop_poll(bContext *UNUSED(C),
|
|||
static bool node_mask_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return WM_drag_ID(drag, ID_MSK) != NULL;
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ static bool allow_parenting_without_modifier_key(SpaceOutliner *soops)
|
|||
static bool parent_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||
|
||||
|
@ -430,7 +430,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
|
|||
static bool parent_clear_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||
|
||||
|
@ -516,7 +516,7 @@ void OUTLINER_OT_parent_clear(wmOperatorType *ot)
|
|||
static bool scene_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
/* Ensure item under cursor is valid drop target */
|
||||
Object *ob = (Object *)WM_drag_ID(drag, ID_OB);
|
||||
|
@ -585,7 +585,7 @@ void OUTLINER_OT_scene_drop(wmOperatorType *ot)
|
|||
static bool material_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
/* Ensure item under cursor is valid drop target */
|
||||
Material *ma = (Material *)WM_drag_ID(drag, ID_MA);
|
||||
|
@ -721,7 +721,7 @@ static bool collection_drop_init(bContext *C,
|
|||
static bool collection_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **tooltip)
|
||||
const char **r_tooltip)
|
||||
{
|
||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
@ -734,7 +734,7 @@ static bool collection_drop_poll(bContext *C,
|
|||
if (!data.from || event->ctrl) {
|
||||
tselem->flag |= TSE_DRAG_INTO;
|
||||
changed = true;
|
||||
*tooltip = TIP_("Link inside Collection");
|
||||
*r_tooltip = TIP_("Link inside Collection");
|
||||
}
|
||||
else {
|
||||
switch (data.insert_type) {
|
||||
|
@ -742,26 +742,26 @@ static bool collection_drop_poll(bContext *C,
|
|||
tselem->flag |= TSE_DRAG_BEFORE;
|
||||
changed = true;
|
||||
if (te->prev && outliner_is_collection_tree_element(te->prev)) {
|
||||
*tooltip = TIP_("Move between collections");
|
||||
*r_tooltip = TIP_("Move between collections");
|
||||
}
|
||||
else {
|
||||
*tooltip = TIP_("Move before collection");
|
||||
*r_tooltip = TIP_("Move before collection");
|
||||
}
|
||||
break;
|
||||
case TE_INSERT_AFTER:
|
||||
tselem->flag |= TSE_DRAG_AFTER;
|
||||
changed = true;
|
||||
if (te->next && outliner_is_collection_tree_element(te->next)) {
|
||||
*tooltip = TIP_("Move between collections");
|
||||
*r_tooltip = TIP_("Move between collections");
|
||||
}
|
||||
else {
|
||||
*tooltip = TIP_("Move after collection");
|
||||
*r_tooltip = TIP_("Move after collection");
|
||||
}
|
||||
break;
|
||||
case TE_INSERT_INTO:
|
||||
tselem->flag |= TSE_DRAG_INTO;
|
||||
changed = true;
|
||||
*tooltip = TIP_("Move inside collection (Ctrl to link, Shift to parent)");
|
||||
*r_tooltip = TIP_("Move inside collection (Ctrl to link, Shift to parent)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1368,68 +1368,68 @@ static void seq_prefetch_wm_notify(const bContext *C, Scene *scene)
|
|||
}
|
||||
|
||||
static void *sequencer_OCIO_transform_ibuf(
|
||||
const bContext *C, ImBuf *ibuf, bool *glsl_used, int *format, int *type)
|
||||
const bContext *C, ImBuf *ibuf, bool *r_glsl_used, int *r_format, int *r_type)
|
||||
{
|
||||
void *display_buffer;
|
||||
void *cache_handle = NULL;
|
||||
bool force_fallback = false;
|
||||
*glsl_used = false;
|
||||
*r_glsl_used = false;
|
||||
force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
|
||||
force_fallback |= (ibuf->dither != 0.0f);
|
||||
|
||||
if (force_fallback) {
|
||||
/* Fallback to CPU based color space conversion */
|
||||
*glsl_used = false;
|
||||
*format = GL_RGBA;
|
||||
*type = GL_UNSIGNED_BYTE;
|
||||
*r_glsl_used = false;
|
||||
*r_format = GL_RGBA;
|
||||
*r_type = GL_UNSIGNED_BYTE;
|
||||
display_buffer = NULL;
|
||||
}
|
||||
else if (ibuf->rect_float) {
|
||||
display_buffer = ibuf->rect_float;
|
||||
|
||||
if (ibuf->channels == 4) {
|
||||
*format = GL_RGBA;
|
||||
*r_format = GL_RGBA;
|
||||
}
|
||||
else if (ibuf->channels == 3) {
|
||||
*format = GL_RGB;
|
||||
*r_format = GL_RGB;
|
||||
}
|
||||
else {
|
||||
BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
|
||||
*format = GL_RGBA;
|
||||
*r_format = GL_RGBA;
|
||||
display_buffer = NULL;
|
||||
}
|
||||
|
||||
*type = GL_FLOAT;
|
||||
*r_type = GL_FLOAT;
|
||||
|
||||
if (ibuf->float_colorspace) {
|
||||
*glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
||||
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
||||
C, ibuf->float_colorspace, ibuf->dither, true);
|
||||
}
|
||||
else {
|
||||
*glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
|
||||
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
|
||||
}
|
||||
}
|
||||
else if (ibuf->rect) {
|
||||
display_buffer = ibuf->rect;
|
||||
*format = GL_RGBA;
|
||||
*type = GL_UNSIGNED_BYTE;
|
||||
*r_format = GL_RGBA;
|
||||
*r_type = GL_UNSIGNED_BYTE;
|
||||
|
||||
*glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
||||
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
||||
C, ibuf->rect_colorspace, ibuf->dither, false);
|
||||
}
|
||||
else {
|
||||
*format = GL_RGBA;
|
||||
*type = GL_UNSIGNED_BYTE;
|
||||
*r_format = GL_RGBA;
|
||||
*r_type = GL_UNSIGNED_BYTE;
|
||||
display_buffer = NULL;
|
||||
}
|
||||
|
||||
/* there's a data to be displayed, but GLSL is not initialized
|
||||
* properly, in this case we fallback to CPU-based display transform
|
||||
*/
|
||||
if ((ibuf->rect || ibuf->rect_float) && !*glsl_used) {
|
||||
if ((ibuf->rect || ibuf->rect_float) && !*r_glsl_used) {
|
||||
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
|
||||
*format = GL_RGBA;
|
||||
*type = GL_UNSIGNED_BYTE;
|
||||
*r_format = GL_RGBA;
|
||||
*r_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
if (cache_handle) {
|
||||
IMB_display_buffer_release(cache_handle);
|
||||
|
|
|
@ -551,15 +551,15 @@ bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq)
|
|||
int seq_effect_find_selected(Scene *scene,
|
||||
Sequence *activeseq,
|
||||
int type,
|
||||
Sequence **selseq1,
|
||||
Sequence **selseq2,
|
||||
Sequence **selseq3,
|
||||
const char **error_str)
|
||||
Sequence **r_selseq1,
|
||||
Sequence **r_selseq2,
|
||||
Sequence **r_selseq3,
|
||||
const char **r_error_str)
|
||||
{
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
||||
Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
|
||||
|
||||
*error_str = NULL;
|
||||
*r_error_str = NULL;
|
||||
|
||||
if (!activeseq) {
|
||||
seq2 = BKE_sequencer_active_get(scene);
|
||||
|
@ -568,7 +568,7 @@ int seq_effect_find_selected(Scene *scene,
|
|||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if (seq->flag & SELECT) {
|
||||
if (seq->type == SEQ_TYPE_SOUND_RAM && BKE_sequence_effect_get_num_inputs(type) != 0) {
|
||||
*error_str = N_("Cannot apply effects to audio sequence strips");
|
||||
*r_error_str = N_("Cannot apply effects to audio sequence strips");
|
||||
return 0;
|
||||
}
|
||||
if ((seq != activeseq) && (seq != seq2)) {
|
||||
|
@ -582,7 +582,7 @@ int seq_effect_find_selected(Scene *scene,
|
|||
seq3 = seq;
|
||||
}
|
||||
else {
|
||||
*error_str = N_("Cannot apply effect to more than 3 sequence strips");
|
||||
*r_error_str = N_("Cannot apply effect to more than 3 sequence strips");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -599,11 +599,11 @@ int seq_effect_find_selected(Scene *scene,
|
|||
|
||||
switch (BKE_sequence_effect_get_num_inputs(type)) {
|
||||
case 0:
|
||||
*selseq1 = *selseq2 = *selseq3 = NULL;
|
||||
*r_selseq1 = *r_selseq2 = *r_selseq3 = NULL;
|
||||
return 1; /* success */
|
||||
case 1:
|
||||
if (seq2 == NULL) {
|
||||
*error_str = N_("At least one selected sequence strip is needed");
|
||||
*r_error_str = N_("At least one selected sequence strip is needed");
|
||||
return 0;
|
||||
}
|
||||
if (seq1 == NULL) {
|
||||
|
@ -615,7 +615,7 @@ int seq_effect_find_selected(Scene *scene,
|
|||
ATTR_FALLTHROUGH;
|
||||
case 2:
|
||||
if (seq1 == NULL || seq2 == NULL) {
|
||||
*error_str = N_("2 selected sequence strips are needed");
|
||||
*r_error_str = N_("2 selected sequence strips are needed");
|
||||
return 0;
|
||||
}
|
||||
if (seq3 == NULL) {
|
||||
|
@ -625,13 +625,13 @@ int seq_effect_find_selected(Scene *scene,
|
|||
}
|
||||
|
||||
if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
|
||||
*error_str = N_("TODO: in what cases does this happen?");
|
||||
*r_error_str = N_("TODO: in what cases does this happen?");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*selseq1 = seq1;
|
||||
*selseq2 = seq2;
|
||||
*selseq3 = seq3;
|
||||
*r_selseq1 = seq1;
|
||||
*r_selseq2 = seq2;
|
||||
*r_selseq3 = seq3;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -83,10 +83,10 @@ void recurs_sel_seq(struct Sequence *seqm);
|
|||
int seq_effect_find_selected(struct Scene *scene,
|
||||
struct Sequence *activeseq,
|
||||
int type,
|
||||
struct Sequence **selseq1,
|
||||
struct Sequence **selseq2,
|
||||
struct Sequence **selseq3,
|
||||
const char **error_str);
|
||||
struct Sequence **r_selseq1,
|
||||
struct Sequence **r_selseq2,
|
||||
struct Sequence **r_selseq3,
|
||||
const char **r_error_str);
|
||||
|
||||
/* operator helpers */
|
||||
bool sequencer_edit_poll(struct bContext *C);
|
||||
|
|
|
@ -363,7 +363,7 @@ static void sequencer_listener(wmWindow *UNUSED(win),
|
|||
static bool image_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
@ -383,7 +383,7 @@ static bool image_drop_poll(bContext *C,
|
|||
static bool movie_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
@ -402,7 +402,7 @@ static bool movie_drop_poll(bContext *C,
|
|||
static bool sound_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
|
|
@ -328,7 +328,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *region)
|
|||
static bool text_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (drag->type == WM_DRAG_PATH) {
|
||||
/* rule might not work? */
|
||||
|
@ -348,7 +348,7 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop)
|
|||
static bool text_drop_paste_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return (drag->type == WM_DRAG_ID);
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ static bool view3d_drop_id_in_main_region_poll(bContext *C,
|
|||
static bool view3d_ob_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB);
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static bool view3d_ob_drop_poll(bContext *C,
|
|||
static bool view3d_collection_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GR);
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ static bool view3d_collection_drop_poll(bContext *C,
|
|||
static bool view3d_mat_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_MA);
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ static bool view3d_mat_drop_poll(bContext *C,
|
|||
static bool view3d_ima_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
if (ED_region_overlap_isect_any_xy(CTX_wm_area(C), &event->x)) {
|
||||
return false;
|
||||
|
@ -524,9 +524,9 @@ static bool view3d_ima_bg_is_camera_view(bContext *C)
|
|||
static bool view3d_ima_bg_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **tooltip)
|
||||
const char **r_tooltip)
|
||||
{
|
||||
if (!view3d_ima_drop_poll(C, drag, event, tooltip)) {
|
||||
if (!view3d_ima_drop_poll(C, drag, event, r_tooltip)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -540,9 +540,9 @@ static bool view3d_ima_bg_drop_poll(bContext *C,
|
|||
static bool view3d_ima_empty_drop_poll(bContext *C,
|
||||
wmDrag *drag,
|
||||
const wmEvent *event,
|
||||
const char **tooltip)
|
||||
const char **r_tooltip)
|
||||
{
|
||||
if (!view3d_ima_drop_poll(C, drag, event, tooltip)) {
|
||||
if (!view3d_ima_drop_poll(C, drag, event, r_tooltip)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -562,7 +562,7 @@ static bool view3d_ima_empty_drop_poll(bContext *C,
|
|||
static bool view3d_volume_drop_poll(bContext *UNUSED(C),
|
||||
wmDrag *drag,
|
||||
const wmEvent *UNUSED(event),
|
||||
const char **UNUSED(tooltip))
|
||||
const char **UNUSED(r_tooltip))
|
||||
{
|
||||
return (drag->type == WM_DRAG_PATH) && (drag->icon == ICON_FILE_VOLUME);
|
||||
}
|
||||
|
|
|
@ -881,7 +881,7 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *region, View3D *v3d, bo
|
|||
/* ******************** other elements ***************** */
|
||||
|
||||
/** could move this elsewhere, but tied into #ED_view3d_grid_scale */
|
||||
float ED_scene_grid_scale(const Scene *scene, const char **grid_unit)
|
||||
float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
|
||||
{
|
||||
/* apply units */
|
||||
if (scene->unit.system) {
|
||||
|
@ -892,8 +892,8 @@ float ED_scene_grid_scale(const Scene *scene, const char **grid_unit)
|
|||
|
||||
if (usys) {
|
||||
int i = bUnit_GetBaseUnit(usys);
|
||||
if (grid_unit) {
|
||||
*grid_unit = bUnit_GetNameDisplay(usys, i);
|
||||
if (r_grid_unit) {
|
||||
*r_grid_unit = bUnit_GetNameDisplay(usys, i);
|
||||
}
|
||||
return (float)bUnit_GetScaler(usys, i) / scene->unit.scale_length;
|
||||
}
|
||||
|
@ -902,9 +902,9 @@ float ED_scene_grid_scale(const Scene *scene, const char **grid_unit)
|
|||
return 1.0f;
|
||||
}
|
||||
|
||||
float ED_view3d_grid_scale(const Scene *scene, View3D *v3d, const char **grid_unit)
|
||||
float ED_view3d_grid_scale(const Scene *scene, View3D *v3d, const char **r_grid_unit)
|
||||
{
|
||||
return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
|
||||
return v3d->grid * ED_scene_grid_scale(scene, r_grid_unit);
|
||||
}
|
||||
|
||||
#define STEPS_LEN 8
|
||||
|
@ -958,7 +958,7 @@ void ED_view3d_grid_steps(const Scene *scene,
|
|||
float ED_view3d_grid_view_scale(Scene *scene,
|
||||
View3D *v3d,
|
||||
RegionView3D *rv3d,
|
||||
const char **grid_unit)
|
||||
const char **r_grid_unit)
|
||||
{
|
||||
float grid_scale;
|
||||
if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) {
|
||||
|
@ -977,18 +977,18 @@ float ED_view3d_grid_view_scale(Scene *scene,
|
|||
}
|
||||
}
|
||||
|
||||
if (grid_unit) {
|
||||
if (r_grid_unit) {
|
||||
const void *usys;
|
||||
int len;
|
||||
bUnit_GetSystem(scene->unit.system, B_UNIT_LENGTH, &usys, &len);
|
||||
|
||||
if (usys) {
|
||||
*grid_unit = bUnit_GetNameDisplay(usys, len - i - 1);
|
||||
*r_grid_unit = bUnit_GetNameDisplay(usys, len - i - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
grid_scale = ED_view3d_grid_scale(scene, v3d, grid_unit);
|
||||
grid_scale = ED_view3d_grid_scale(scene, v3d, r_grid_unit);
|
||||
}
|
||||
|
||||
return grid_scale;
|
||||
|
|
|
@ -1557,7 +1557,7 @@ void VIEW3D_OT_localview_remove_from(wmOperatorType *ot)
|
|||
|
||||
static uint free_localcollection_bit(Main *bmain,
|
||||
unsigned short local_collections_uuid,
|
||||
bool *reset)
|
||||
bool *r_reset)
|
||||
{
|
||||
ScrArea *sa;
|
||||
bScreen *sc;
|
||||
|
@ -1587,7 +1587,7 @@ static uint free_localcollection_bit(Main *bmain,
|
|||
/* Otherwise get the first free available. */
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((local_view_bits & (1 << i)) == 0) {
|
||||
*reset = true;
|
||||
*r_reset = true;
|
||||
return (1 << i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
* seq->depth must be set before running this function so we know if the strips
|
||||
* are root level or not
|
||||
*/
|
||||
static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag)
|
||||
static void SeqTransInfo(TransInfo *t, Sequence *seq, int *r_recursive, int *r_count, int *r_flag)
|
||||
{
|
||||
/* for extend we need to do some tricks */
|
||||
if (t->mode == TFM_TIME_EXTEND) {
|
||||
|
@ -60,51 +60,51 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
|
|||
int right = BKE_sequence_tx_get_final_right(seq, true);
|
||||
|
||||
if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
|
||||
*recursive = false;
|
||||
*count = 0;
|
||||
*flag = 0;
|
||||
*r_recursive = false;
|
||||
*r_count = 0;
|
||||
*r_flag = 0;
|
||||
}
|
||||
else if (seq->type == SEQ_TYPE_META) {
|
||||
|
||||
/* for meta's we only ever need to extend their children, no matter what depth
|
||||
* just check the meta's are in the bounds */
|
||||
if (t->frame_side == 'R' && right <= cfra) {
|
||||
*recursive = false;
|
||||
*r_recursive = false;
|
||||
}
|
||||
else if (t->frame_side == 'L' && left >= cfra) {
|
||||
*recursive = false;
|
||||
*r_recursive = false;
|
||||
}
|
||||
else {
|
||||
*recursive = true;
|
||||
*r_recursive = true;
|
||||
}
|
||||
|
||||
*count = 1;
|
||||
*flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*r_count = 1;
|
||||
*r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
}
|
||||
else {
|
||||
|
||||
*recursive = false; /* not a meta, so no thinking here */
|
||||
*count = 1; /* unless its set to 0, extend will never set 2 handles at once */
|
||||
*flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*r_recursive = false; /* not a meta, so no thinking here */
|
||||
*r_count = 1; /* unless its set to 0, extend will never set 2 handles at once */
|
||||
*r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
|
||||
if (t->frame_side == 'R') {
|
||||
if (right <= cfra) {
|
||||
*count = *flag = 0;
|
||||
*r_count = *r_flag = 0;
|
||||
} /* ignore */
|
||||
else if (left > cfra) {
|
||||
} /* keep the selection */
|
||||
else {
|
||||
*flag |= SEQ_RIGHTSEL;
|
||||
*r_flag |= SEQ_RIGHTSEL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (left >= cfra) {
|
||||
*count = *flag = 0;
|
||||
*r_count = *r_flag = 0;
|
||||
} /* ignore */
|
||||
else if (right < cfra) {
|
||||
} /* keep the selection */
|
||||
else {
|
||||
*flag |= SEQ_LEFTSEL;
|
||||
*r_flag |= SEQ_LEFTSEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,28 +121,28 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
|
|||
|
||||
/* Non nested strips (resect selection and handles) */
|
||||
if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
|
||||
*recursive = false;
|
||||
*count = 0;
|
||||
*flag = 0;
|
||||
*r_recursive = false;
|
||||
*r_count = 0;
|
||||
*r_flag = 0;
|
||||
}
|
||||
else {
|
||||
if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) {
|
||||
*flag = seq->flag;
|
||||
*count = 2; /* we need 2 transdata's */
|
||||
*r_flag = seq->flag;
|
||||
*r_count = 2; /* we need 2 transdata's */
|
||||
}
|
||||
else {
|
||||
*flag = seq->flag;
|
||||
*count = 1; /* selected or with a handle selected */
|
||||
*r_flag = seq->flag;
|
||||
*r_count = 1; /* selected or with a handle selected */
|
||||
}
|
||||
|
||||
/* Recursive */
|
||||
|
||||
if ((seq->type == SEQ_TYPE_META) && ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) {
|
||||
/* if any handles are selected, don't recurse */
|
||||
*recursive = true;
|
||||
*r_recursive = true;
|
||||
}
|
||||
else {
|
||||
*recursive = false;
|
||||
*r_recursive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,23 +150,23 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
|
|||
/* Nested, different rules apply */
|
||||
|
||||
#ifdef SEQ_TX_NESTED_METAS
|
||||
*flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*count = 1; /* ignore the selection for nested */
|
||||
*recursive = (seq->type == SEQ_TYPE_META);
|
||||
*r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*r_count = 1; /* ignore the selection for nested */
|
||||
*r_recursive = (seq->type == SEQ_TYPE_META);
|
||||
#else
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
/* Meta's can only directly be moved between channels since they
|
||||
* don't have their start and length set directly (children affect that)
|
||||
* since this Meta is nested we don't need any of its data in fact.
|
||||
* BKE_sequence_calc() will update its settings when run on the top-level meta. */
|
||||
*flag = 0;
|
||||
*count = 0;
|
||||
*recursive = true;
|
||||
*r_flag = 0;
|
||||
*r_count = 0;
|
||||
*r_recursive = true;
|
||||
}
|
||||
else {
|
||||
*flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*count = 1; /* ignore the selection for nested */
|
||||
*recursive = false;
|
||||
*r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
|
||||
*r_count = 1; /* ignore the selection for nested */
|
||||
*r_recursive = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -478,9 +478,9 @@ static void draw_uvs(SpaceImage *sima,
|
|||
}
|
||||
|
||||
static void draw_uv_shadows_get(
|
||||
SpaceImage *sima, Object *ob, Object *obedit, bool *show_shadow, bool *show_texpaint)
|
||||
SpaceImage *sima, Object *ob, Object *obedit, bool *r_show_shadow, bool *r_show_texpaint)
|
||||
{
|
||||
*show_shadow = *show_texpaint = false;
|
||||
*r_show_shadow = *r_show_texpaint = false;
|
||||
|
||||
if (ED_space_image_show_render(sima) || (sima->flag & SI_NO_DRAW_TEXPAINT)) {
|
||||
return;
|
||||
|
@ -489,10 +489,10 @@ static void draw_uv_shadows_get(
|
|||
if ((sima->mode == SI_MODE_PAINT) && obedit && obedit->type == OB_MESH) {
|
||||
struct BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
|
||||
*show_shadow = EDBM_uv_check(em);
|
||||
*r_show_shadow = EDBM_uv_check(em);
|
||||
}
|
||||
|
||||
*show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT);
|
||||
*r_show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT);
|
||||
}
|
||||
|
||||
void ED_uvedit_draw_main(SpaceImage *sima,
|
||||
|
|
|
@ -347,7 +347,7 @@ static PHashLink *phash_next(PHash *ph, PHashKey key, PHashLink *link)
|
|||
|
||||
/* Geometry */
|
||||
|
||||
static float p_vec_angle_cos(float *v1, float *v2, float *v3)
|
||||
static float p_vec_angle_cos(const float v1[3], const float v2[3], const float v3[3])
|
||||
{
|
||||
float d1[3], d2[3];
|
||||
|
||||
|
@ -365,7 +365,7 @@ static float p_vec_angle_cos(float *v1, float *v2, float *v3)
|
|||
return d1[0] * d2[0] + d1[1] * d2[1] + d1[2] * d2[2];
|
||||
}
|
||||
|
||||
static float p_vec_angle(float *v1, float *v2, float *v3)
|
||||
static float p_vec_angle(const float v1[3], const float v2[3], const float v3[3])
|
||||
{
|
||||
float dot = p_vec_angle_cos(v1, v2, v3);
|
||||
|
||||
|
@ -380,7 +380,7 @@ static float p_vec_angle(float *v1, float *v2, float *v3)
|
|||
}
|
||||
}
|
||||
|
||||
static float p_vec2_angle(float *v1, float *v2, float *v3)
|
||||
static float p_vec2_angle(const float v1[2], const float v2[2], const float v3[2])
|
||||
{
|
||||
float u1[3], u2[3], u3[3];
|
||||
|
||||
|
@ -397,19 +397,20 @@ static float p_vec2_angle(float *v1, float *v2, float *v3)
|
|||
return p_vec_angle(u1, u2, u3);
|
||||
}
|
||||
|
||||
static void p_triangle_angles(float *v1, float *v2, float *v3, float *a1, float *a2, float *a3)
|
||||
static void p_triangle_angles(
|
||||
const float v1[3], const float v2[3], const float v3[3], float *r_a1, float *r_a2, float *r_a3)
|
||||
{
|
||||
*a1 = p_vec_angle(v3, v1, v2);
|
||||
*a2 = p_vec_angle(v1, v2, v3);
|
||||
*a3 = (float)M_PI - *a2 - *a1;
|
||||
*r_a1 = p_vec_angle(v3, v1, v2);
|
||||
*r_a2 = p_vec_angle(v1, v2, v3);
|
||||
*r_a3 = (float)M_PI - *r_a2 - *r_a1;
|
||||
}
|
||||
|
||||
static void p_face_angles(PFace *f, float *a1, float *a2, float *a3)
|
||||
static void p_face_angles(PFace *f, float *r_a1, float *r_a2, float *r_a3)
|
||||
{
|
||||
PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
|
||||
PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
|
||||
|
||||
p_triangle_angles(v1->co, v2->co, v3->co, a1, a2, a3);
|
||||
p_triangle_angles(v1->co, v2->co, v3->co, r_a1, r_a2, r_a3);
|
||||
}
|
||||
|
||||
static float p_face_area(PFace *f)
|
||||
|
@ -420,7 +421,7 @@ static float p_face_area(PFace *f)
|
|||
return area_tri_v3(v1->co, v2->co, v3->co);
|
||||
}
|
||||
|
||||
static float p_area_signed(float *v1, float *v2, float *v3)
|
||||
static float p_area_signed(const float v1[2], const float v2[2], const float v3[2])
|
||||
{
|
||||
return 0.5f * (((v2[0] - v1[0]) * (v3[1] - v1[1])) - ((v3[0] - v1[0]) * (v2[1] - v1[1])));
|
||||
}
|
||||
|
@ -527,7 +528,11 @@ static void UNUSED_FUNCTION(p_chart_uv_from_array)(PChart *chart, float (*points
|
|||
}
|
||||
}
|
||||
|
||||
static PBool p_intersect_line_2d_dir(float *v1, float *dir1, float *v2, float *dir2, float *isect)
|
||||
static PBool p_intersect_line_2d_dir(const float v1[2],
|
||||
const float dir1[2],
|
||||
const float v2[2],
|
||||
const float dir2[2],
|
||||
float r_isect[2])
|
||||
{
|
||||
float lmbda, div;
|
||||
|
||||
|
@ -538,14 +543,18 @@ static PBool p_intersect_line_2d_dir(float *v1, float *dir1, float *v2, float *d
|
|||
}
|
||||
|
||||
lmbda = ((v1[1] - v2[1]) * dir1[0] - (v1[0] - v2[0]) * dir1[1]) / div;
|
||||
isect[0] = v1[0] + lmbda * dir2[0];
|
||||
isect[1] = v1[1] + lmbda * dir2[1];
|
||||
r_isect[0] = v1[0] + lmbda * dir2[0];
|
||||
r_isect[1] = v1[1] + lmbda * dir2[1];
|
||||
|
||||
return P_TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static PBool p_intersect_line_2d(float *v1, float *v2, float *v3, float *v4, float *isect)
|
||||
static PBool p_intersect_line_2d(const float v1[2],
|
||||
const float v2[2],
|
||||
const float v3[2],
|
||||
const float v4[2],
|
||||
const float r_isect[2])
|
||||
{
|
||||
float dir1[2], dir2[2];
|
||||
|
||||
|
@ -892,7 +901,7 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
|
|||
return P_FALSE;
|
||||
}
|
||||
|
||||
static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl)
|
||||
static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PBool impl, PEdge **r_pair)
|
||||
{
|
||||
PHashKey key;
|
||||
PEdge *pe;
|
||||
|
@ -906,7 +915,7 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
|
|||
|
||||
key = PHASH_edge(key1, key2);
|
||||
pe = (PEdge *)phash_lookup(handle->hash_edges, key);
|
||||
*pair = NULL;
|
||||
*r_pair = NULL;
|
||||
|
||||
while (pe) {
|
||||
if (pe != e) {
|
||||
|
@ -917,34 +926,34 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
|
|||
((v1->u.key == key2) && (v2->u.key == key1))) {
|
||||
|
||||
/* don't connect seams and t-junctions */
|
||||
if ((pe->flag & PEDGE_SEAM) || *pair || (impl && p_edge_implicit_seam(e, pe))) {
|
||||
*pair = NULL;
|
||||
if ((pe->flag & PEDGE_SEAM) || *r_pair || (impl && p_edge_implicit_seam(e, pe))) {
|
||||
*r_pair = NULL;
|
||||
return P_FALSE;
|
||||
}
|
||||
|
||||
*pair = pe;
|
||||
*r_pair = pe;
|
||||
}
|
||||
}
|
||||
|
||||
pe = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)pe);
|
||||
}
|
||||
|
||||
if (*pair && (e->vert == (*pair)->vert)) {
|
||||
if ((*pair)->next->pair || (*pair)->next->next->pair) {
|
||||
if (*r_pair && (e->vert == (*r_pair)->vert)) {
|
||||
if ((*r_pair)->next->pair || (*r_pair)->next->next->pair) {
|
||||
/* non unfoldable, maybe mobius ring or klein bottle */
|
||||
*pair = NULL;
|
||||
*r_pair = NULL;
|
||||
return P_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pair != NULL);
|
||||
return (*r_pair != NULL);
|
||||
}
|
||||
|
||||
static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBool impl)
|
||||
static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PBool impl, PEdge ***stack)
|
||||
{
|
||||
PEdge *pair = NULL;
|
||||
|
||||
if (!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
|
||||
if (!e->pair && p_edge_has_pair(handle, e, impl, &pair)) {
|
||||
if (e->vert == pair->vert) {
|
||||
p_face_flip(pair->face);
|
||||
}
|
||||
|
@ -992,13 +1001,13 @@ static int p_connect_pairs(PHandle *handle, PBool impl)
|
|||
/* assign verts to charts so we can sort them later */
|
||||
f->u.chart = ncharts;
|
||||
|
||||
if (!p_edge_connect_pair(handle, e, &stack, impl)) {
|
||||
if (!p_edge_connect_pair(handle, e, impl, &stack)) {
|
||||
e->vert->edge = e;
|
||||
}
|
||||
if (!p_edge_connect_pair(handle, e1, &stack, impl)) {
|
||||
if (!p_edge_connect_pair(handle, e1, impl, &stack)) {
|
||||
e1->vert->edge = e1;
|
||||
}
|
||||
if (!p_edge_connect_pair(handle, e2, &stack, impl)) {
|
||||
if (!p_edge_connect_pair(handle, e2, impl, &stack)) {
|
||||
e2->vert->edge = e2;
|
||||
}
|
||||
}
|
||||
|
@ -1255,16 +1264,16 @@ static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys
|
|||
|
||||
/* Construction: boundary filling */
|
||||
|
||||
static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
|
||||
static void p_chart_boundaries(PChart *chart, int *r_nboundaries, PEdge **r_outer)
|
||||
{
|
||||
PEdge *e, *be;
|
||||
float len, maxlen = -1.0;
|
||||
|
||||
if (nboundaries) {
|
||||
*nboundaries = 0;
|
||||
if (r_nboundaries) {
|
||||
*r_nboundaries = 0;
|
||||
}
|
||||
if (outer) {
|
||||
*outer = NULL;
|
||||
if (r_outer) {
|
||||
*r_outer = NULL;
|
||||
}
|
||||
|
||||
for (e = chart->edges; e; e = e->nextlink) {
|
||||
|
@ -1272,8 +1281,8 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (nboundaries) {
|
||||
(*nboundaries)++;
|
||||
if (r_nboundaries) {
|
||||
(*r_nboundaries)++;
|
||||
}
|
||||
|
||||
len = 0.0f;
|
||||
|
@ -1285,8 +1294,8 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
|
|||
be = be->next->vert->edge;
|
||||
} while (be != e);
|
||||
|
||||
if (outer && (len > maxlen)) {
|
||||
*outer = e;
|
||||
if (r_outer && (len > maxlen)) {
|
||||
*r_outer = e;
|
||||
maxlen = len;
|
||||
}
|
||||
}
|
||||
|
@ -1427,7 +1436,7 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
|
|||
#if 0
|
||||
/* Polygon kernel for inserting uv's non overlapping */
|
||||
|
||||
static int p_polygon_point_in(float *cp1, float *cp2, float *p)
|
||||
static int p_polygon_point_in(const float cp1[2], const float cp2[2], const float p[2])
|
||||
{
|
||||
if ((cp1[0] == p[0]) && (cp1[1] == p[1])) {
|
||||
return 2;
|
||||
|
@ -1443,43 +1452,43 @@ static int p_polygon_point_in(float *cp1, float *cp2, float *p)
|
|||
static void p_polygon_kernel_clip(float (*oldpoints)[2],
|
||||
int noldpoints,
|
||||
float (*newpoints)[2],
|
||||
int *nnewpoints,
|
||||
float *cp1,
|
||||
float *cp2)
|
||||
int *r_nnewpoints,
|
||||
const float cp1[2],
|
||||
const float cp2[2])
|
||||
{
|
||||
float *p2, *p1, isect[2];
|
||||
int i, p2in, p1in;
|
||||
|
||||
p1 = oldpoints[noldpoints - 1];
|
||||
p1in = p_polygon_point_in(cp1, cp2, p1);
|
||||
*nnewpoints = 0;
|
||||
*r_nnewpoints = 0;
|
||||
|
||||
for (i = 0; i < noldpoints; i++) {
|
||||
p2 = oldpoints[i];
|
||||
p2in = p_polygon_point_in(cp1, cp2, p2);
|
||||
|
||||
if ((p2in >= 2) || (p1in && p2in)) {
|
||||
newpoints[*nnewpoints][0] = p2[0];
|
||||
newpoints[*nnewpoints][1] = p2[1];
|
||||
(*nnewpoints)++;
|
||||
newpoints[*r_nnewpoints][0] = p2[0];
|
||||
newpoints[*r_nnewpoints][1] = p2[1];
|
||||
(*r_nnewpoints)++;
|
||||
}
|
||||
else if (p1in && !p2in) {
|
||||
if (p1in != 3) {
|
||||
p_intersect_line_2d(p1, p2, cp1, cp2, isect);
|
||||
newpoints[*nnewpoints][0] = isect[0];
|
||||
newpoints[*nnewpoints][1] = isect[1];
|
||||
(*nnewpoints)++;
|
||||
newpoints[*r_nnewpoints][0] = isect[0];
|
||||
newpoints[*r_nnewpoints][1] = isect[1];
|
||||
(*r_nnewpoints)++;
|
||||
}
|
||||
}
|
||||
else if (!p1in && p2in) {
|
||||
p_intersect_line_2d(p1, p2, cp1, cp2, isect);
|
||||
newpoints[*nnewpoints][0] = isect[0];
|
||||
newpoints[*nnewpoints][1] = isect[1];
|
||||
(*nnewpoints)++;
|
||||
newpoints[*r_nnewpoints][0] = isect[0];
|
||||
newpoints[*r_nnewpoints][1] = isect[1];
|
||||
(*r_nnewpoints)++;
|
||||
|
||||
newpoints[*nnewpoints][0] = p2[0];
|
||||
newpoints[*nnewpoints][1] = p2[1];
|
||||
(*nnewpoints)++;
|
||||
newpoints[*r_nnewpoints][0] = p2[0];
|
||||
newpoints[*r_nnewpoints][1] = p2[1];
|
||||
(*r_nnewpoints)++;
|
||||
}
|
||||
|
||||
p1in = p2in;
|
||||
|
@ -1556,7 +1565,7 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
|
|||
int NCOLLAPSE = 1;
|
||||
int NCOLLAPSEX = 0;
|
||||
|
||||
static float p_vert_cotan(float *v1, float *v2, float *v3)
|
||||
static float p_vert_cotan(const float v1[3], const float v2[3], const float v3[3])
|
||||
{
|
||||
float a[3], b[3], c[3], clen;
|
||||
|
||||
|
@ -1733,16 +1742,16 @@ static void p_vert_fix_edge_pointer(PVert *v)
|
|||
}
|
||||
}
|
||||
|
||||
static void p_collapsing_verts(PEdge *edge, PEdge *pair, PVert **newv, PVert **keepv)
|
||||
static void p_collapsing_verts(PEdge *edge, PEdge *pair, PVert **r_newv, PVert **r_keepv)
|
||||
{
|
||||
/* the two vertices that are involved in the collapse */
|
||||
if (edge) {
|
||||
*newv = edge->vert;
|
||||
*keepv = edge->next->vert;
|
||||
*r_newv = edge->vert;
|
||||
*r_keepv = edge->next->vert;
|
||||
}
|
||||
else {
|
||||
*newv = pair->next->vert;
|
||||
*keepv = pair->vert;
|
||||
*r_newv = pair->next->vert;
|
||||
*r_keepv = pair->vert;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2107,20 +2116,20 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
|
|||
return cost;
|
||||
}
|
||||
|
||||
static void p_collapse_cost_vertex(PVert *vert, float *mincost, PEdge **mine)
|
||||
static void p_collapse_cost_vertex(PVert *vert, float *r_mincost, PEdge **r_mine)
|
||||
{
|
||||
PEdge *e, *enext, *pair;
|
||||
|
||||
*mine = NULL;
|
||||
*mincost = 0.0f;
|
||||
*r_mine = NULL;
|
||||
*r_mincost = 0.0f;
|
||||
e = vert->edge;
|
||||
do {
|
||||
if (p_collapse_allowed(e, e->pair)) {
|
||||
float cost = p_collapse_cost(e, e->pair);
|
||||
|
||||
if ((*mine == NULL) || (cost < *mincost)) {
|
||||
*mincost = cost;
|
||||
*mine = e;
|
||||
if ((*r_mine == NULL) || (cost < *r_mincost)) {
|
||||
*r_mincost = cost;
|
||||
*r_mine = e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2133,9 +2142,9 @@ static void p_collapse_cost_vertex(PVert *vert, float *mincost, PEdge **mine)
|
|||
if (p_collapse_allowed(NULL, pair)) {
|
||||
float cost = p_collapse_cost(NULL, pair);
|
||||
|
||||
if ((*mine == NULL) || (cost < *mincost)) {
|
||||
*mincost = cost;
|
||||
*mine = pair;
|
||||
if ((*r_mine == NULL) || (cost < *r_mincost)) {
|
||||
*r_mincost = cost;
|
||||
*r_mine = pair;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3549,7 +3558,7 @@ static int p_compare_geometric_uv(const void *a, const void *b)
|
|||
}
|
||||
}
|
||||
|
||||
static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int *right)
|
||||
static PBool p_chart_convex_hull(PChart *chart, PVert ***r_verts, int *r_nverts, int *r_right)
|
||||
{
|
||||
/* Graham algorithm, taken from:
|
||||
* http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117225 */
|
||||
|
@ -3608,9 +3617,9 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
|
|||
*p = L[i];
|
||||
}
|
||||
|
||||
*verts = points;
|
||||
*nverts = npoints;
|
||||
*right = ulen - 1;
|
||||
*r_verts = points;
|
||||
*r_nverts = npoints;
|
||||
*r_right = ulen - 1;
|
||||
|
||||
MEM_freeN(U);
|
||||
MEM_freeN(L);
|
||||
|
|
|
@ -211,7 +211,7 @@ static bool uvedit_have_selection_multi(const Scene *scene,
|
|||
}
|
||||
|
||||
void ED_uvedit_get_aspect(
|
||||
const Scene *UNUSED(scene), Object *ob, BMesh *bm, float *aspx, float *aspy)
|
||||
const Scene *UNUSED(scene), Object *ob, BMesh *bm, float *r_aspx, float *r_aspy)
|
||||
{
|
||||
bool sloppy = true;
|
||||
bool selected = false;
|
||||
|
@ -223,11 +223,11 @@ void ED_uvedit_get_aspect(
|
|||
if (efa) {
|
||||
ED_object_get_active_image(ob, efa->mat_nr + 1, &ima, NULL, NULL, NULL);
|
||||
|
||||
ED_image_get_uv_aspect(ima, NULL, aspx, aspy);
|
||||
ED_image_get_uv_aspect(ima, NULL, r_aspx, r_aspy);
|
||||
}
|
||||
else {
|
||||
*aspx = 1.0f;
|
||||
*aspy = 1.0f;
|
||||
*r_aspx = 1.0f;
|
||||
*r_aspy = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,21 +422,21 @@ static ParamHandle *construct_param_handle_multi(const Scene *scene,
|
|||
return handle;
|
||||
}
|
||||
|
||||
static void texface_from_original_index(BMFace *efa,
|
||||
static void texface_from_original_index(const Scene *scene,
|
||||
const int cd_loop_uv_offset,
|
||||
BMFace *efa,
|
||||
int index,
|
||||
float **uv,
|
||||
ParamBool *pin,
|
||||
ParamBool *select,
|
||||
const Scene *scene,
|
||||
const int cd_loop_uv_offset)
|
||||
float **r_uv,
|
||||
ParamBool *r_pin,
|
||||
ParamBool *r_select)
|
||||
{
|
||||
BMLoop *l;
|
||||
BMIter liter;
|
||||
MLoopUV *luv;
|
||||
|
||||
*uv = NULL;
|
||||
*pin = 0;
|
||||
*select = 1;
|
||||
*r_uv = NULL;
|
||||
*r_pin = 0;
|
||||
*r_select = 1;
|
||||
|
||||
if (index == ORIGINDEX_NONE) {
|
||||
return;
|
||||
|
@ -445,9 +445,9 @@ static void texface_from_original_index(BMFace *efa,
|
|||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
if (BM_elem_index_get(l->v) == index) {
|
||||
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
|
||||
*uv = luv->uv;
|
||||
*pin = (luv->flag & MLOOPUV_PINNED) ? 1 : 0;
|
||||
*select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
|
||||
*r_uv = luv->uv;
|
||||
*r_pin = (luv->flag & MLOOPUV_PINNED) ? 1 : 0;
|
||||
*r_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -595,34 +595,34 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene,
|
|||
/* This is where all the magic is done.
|
||||
* If the vertex exists in the, we pass the original uv pointer to the solver, thus
|
||||
* flushing the solution to the edit mesh. */
|
||||
texface_from_original_index(origFace,
|
||||
texface_from_original_index(scene,
|
||||
cd_loop_uv_offset,
|
||||
origFace,
|
||||
origVertIndices[mloop[0].v],
|
||||
&uv[0],
|
||||
&pin[0],
|
||||
&select[0],
|
||||
scene,
|
||||
cd_loop_uv_offset);
|
||||
texface_from_original_index(origFace,
|
||||
&select[0]);
|
||||
texface_from_original_index(scene,
|
||||
cd_loop_uv_offset,
|
||||
origFace,
|
||||
origVertIndices[mloop[1].v],
|
||||
&uv[1],
|
||||
&pin[1],
|
||||
&select[1],
|
||||
scene,
|
||||
cd_loop_uv_offset);
|
||||
texface_from_original_index(origFace,
|
||||
&select[1]);
|
||||
texface_from_original_index(scene,
|
||||
cd_loop_uv_offset,
|
||||
origFace,
|
||||
origVertIndices[mloop[2].v],
|
||||
&uv[2],
|
||||
&pin[2],
|
||||
&select[2],
|
||||
scene,
|
||||
cd_loop_uv_offset);
|
||||
texface_from_original_index(origFace,
|
||||
&select[2]);
|
||||
texface_from_original_index(scene,
|
||||
cd_loop_uv_offset,
|
||||
origFace,
|
||||
origVertIndices[mloop[3].v],
|
||||
&uv[3],
|
||||
&pin[3],
|
||||
&select[3],
|
||||
scene,
|
||||
cd_loop_uv_offset);
|
||||
&select[3]);
|
||||
|
||||
param_face_add(handle, key, 4, vkeys, co, uv, pin, select);
|
||||
}
|
||||
|
|
|
@ -199,8 +199,8 @@ void IMB_colormanagement_buffer_make_display_space(
|
|||
|
||||
void IMB_colormanagement_display_settings_from_ctx(
|
||||
const struct bContext *C,
|
||||
struct ColorManagedViewSettings **view_settings_r,
|
||||
struct ColorManagedDisplaySettings **display_settings_r);
|
||||
struct ColorManagedViewSettings **r_view_settings,
|
||||
struct ColorManagedDisplaySettings **r_display_settings);
|
||||
|
||||
const char *IMB_colormanagement_get_display_colorspace_name(
|
||||
const struct ColorManagedViewSettings *view_settings,
|
||||
|
|
|
@ -72,7 +72,7 @@ void IMB_moviecache_cleanup(struct MovieCache *cache,
|
|||
void *userdata);
|
||||
|
||||
void IMB_moviecache_get_cache_segments(
|
||||
struct MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r);
|
||||
struct MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points);
|
||||
|
||||
struct MovieCacheIter;
|
||||
struct MovieCacheIter *IMB_moviecacheIter_new(struct MovieCache *cache);
|
||||
|
|
|
@ -789,18 +789,18 @@ void colormanage_cache_free(ImBuf *ibuf)
|
|||
|
||||
void IMB_colormanagement_display_settings_from_ctx(
|
||||
const bContext *C,
|
||||
ColorManagedViewSettings **view_settings_r,
|
||||
ColorManagedDisplaySettings **display_settings_r)
|
||||
ColorManagedViewSettings **r_view_settings,
|
||||
ColorManagedDisplaySettings **r_display_settings)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
|
||||
*view_settings_r = &scene->view_settings;
|
||||
*display_settings_r = &scene->display_settings;
|
||||
*r_view_settings = &scene->view_settings;
|
||||
*r_display_settings = &scene->display_settings;
|
||||
|
||||
if (sima && sima->image) {
|
||||
if ((sima->image->flag & IMA_VIEW_AS_RENDER) == 0) {
|
||||
*view_settings_r = NULL;
|
||||
*r_view_settings = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,10 +479,10 @@ void IMB_moviecache_cleanup(MovieCache *cache,
|
|||
|
||||
/* get segments of cached frames. useful for debugging cache policies */
|
||||
void IMB_moviecache_get_cache_segments(
|
||||
MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r)
|
||||
MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
|
||||
{
|
||||
*totseg_r = 0;
|
||||
*points_r = NULL;
|
||||
*r_totseg = 0;
|
||||
*r_points = NULL;
|
||||
|
||||
if (!cache->getdatafp) {
|
||||
return;
|
||||
|
@ -497,8 +497,8 @@ void IMB_moviecache_get_cache_segments(
|
|||
}
|
||||
|
||||
if (cache->points) {
|
||||
*totseg_r = cache->totseg;
|
||||
*points_r = cache->points;
|
||||
*r_totseg = cache->totseg;
|
||||
*r_points = cache->points;
|
||||
}
|
||||
else {
|
||||
int totframe = BLI_ghash_len(cache->hash);
|
||||
|
@ -555,8 +555,8 @@ void IMB_moviecache_get_cache_segments(
|
|||
}
|
||||
}
|
||||
|
||||
*totseg_r = totseg;
|
||||
*points_r = points;
|
||||
*r_totseg = totseg;
|
||||
*r_points = points;
|
||||
|
||||
cache->totseg = totseg;
|
||||
cache->points = points;
|
||||
|
|
|
@ -360,15 +360,15 @@ void PyC_StackSpit(void)
|
|||
}
|
||||
}
|
||||
|
||||
void PyC_FileAndNum(const char **filename, int *lineno)
|
||||
void PyC_FileAndNum(const char **r_filename, int *r_lineno)
|
||||
{
|
||||
PyFrameObject *frame;
|
||||
|
||||
if (filename) {
|
||||
*filename = NULL;
|
||||
if (r_filename) {
|
||||
*r_filename = NULL;
|
||||
}
|
||||
if (lineno) {
|
||||
*lineno = -1;
|
||||
if (r_lineno) {
|
||||
*r_lineno = -1;
|
||||
}
|
||||
|
||||
if (!(frame = PyThreadState_GET()->frame)) {
|
||||
|
@ -376,13 +376,13 @@ void PyC_FileAndNum(const char **filename, int *lineno)
|
|||
}
|
||||
|
||||
/* when executing a script */
|
||||
if (filename) {
|
||||
*filename = _PyUnicode_AsString(frame->f_code->co_filename);
|
||||
if (r_filename) {
|
||||
*r_filename = _PyUnicode_AsString(frame->f_code->co_filename);
|
||||
}
|
||||
|
||||
/* when executing a module */
|
||||
if (filename && *filename == NULL) {
|
||||
/* try an alternative method to get the filename - module based
|
||||
if (r_filename && *r_filename == NULL) {
|
||||
/* try an alternative method to get the r_filename - module based
|
||||
* references below are all borrowed (double checked) */
|
||||
PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
|
||||
if (mod_name) {
|
||||
|
@ -390,7 +390,7 @@ void PyC_FileAndNum(const char **filename, int *lineno)
|
|||
if (mod) {
|
||||
PyObject *mod_file = PyModule_GetFilenameObject(mod);
|
||||
if (mod_file) {
|
||||
*filename = _PyUnicode_AsString(mod_name);
|
||||
*r_filename = _PyUnicode_AsString(mod_name);
|
||||
Py_DECREF(mod_file);
|
||||
}
|
||||
else {
|
||||
|
@ -399,24 +399,24 @@ void PyC_FileAndNum(const char **filename, int *lineno)
|
|||
}
|
||||
|
||||
/* unlikely, fallback */
|
||||
if (*filename == NULL) {
|
||||
*filename = _PyUnicode_AsString(mod_name);
|
||||
if (*r_filename == NULL) {
|
||||
*r_filename = _PyUnicode_AsString(mod_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lineno) {
|
||||
*lineno = PyFrame_GetLineNumber(frame);
|
||||
if (r_lineno) {
|
||||
*r_lineno = PyFrame_GetLineNumber(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void PyC_FileAndNum_Safe(const char **filename, int *lineno)
|
||||
void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno)
|
||||
{
|
||||
if (!PyC_IsInterpreterActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PyC_FileAndNum(filename, lineno);
|
||||
PyC_FileAndNum(r_filename, r_lineno);
|
||||
}
|
||||
|
||||
/* Would be nice if python had this built in */
|
||||
|
|
|
@ -38,8 +38,8 @@ PyObject *PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char *
|
|||
|
||||
void PyC_Err_PrintWithFunc(PyObject *py_func);
|
||||
|
||||
void PyC_FileAndNum(const char **filename, int *lineno);
|
||||
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
|
||||
void PyC_FileAndNum(const char **r_filename, int *r_lineno);
|
||||
void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno); /* checks python is running */
|
||||
int PyC_AsArray_FAST(void *array,
|
||||
PyObject *value_fast,
|
||||
const Py_ssize_t length,
|
||||
|
|
|
@ -5092,23 +5092,23 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
|
|||
static bool foreach_attr_type(BPy_PropertyRNA *self,
|
||||
const char *attr,
|
||||
/* Values to assign. */
|
||||
RawPropertyType *raw_type,
|
||||
int *attr_tot,
|
||||
bool *attr_signed)
|
||||
RawPropertyType *r_raw_type,
|
||||
int *r_attr_tot,
|
||||
bool *r_attr_signed)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
bool attr_ok = true;
|
||||
*raw_type = PROP_RAW_UNSET;
|
||||
*attr_tot = 0;
|
||||
*attr_signed = false;
|
||||
*r_raw_type = PROP_RAW_UNSET;
|
||||
*r_attr_tot = 0;
|
||||
*r_attr_signed = false;
|
||||
|
||||
/* Note: this is fail with zero length lists, so don't let this get caled in that case. */
|
||||
RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
|
||||
prop = RNA_struct_find_property(&itemptr, attr);
|
||||
if (prop) {
|
||||
*raw_type = RNA_property_raw_type(prop);
|
||||
*attr_tot = RNA_property_array_length(&itemptr, prop);
|
||||
*attr_signed = (RNA_property_subtype(prop) != PROP_UNSIGNED);
|
||||
*r_raw_type = RNA_property_raw_type(prop);
|
||||
*r_attr_tot = RNA_property_array_length(&itemptr, prop);
|
||||
*r_attr_signed = (RNA_property_subtype(prop) != PROP_UNSIGNED);
|
||||
}
|
||||
else {
|
||||
attr_ok = false;
|
||||
|
@ -5125,53 +5125,53 @@ static int foreach_parse_args(BPy_PropertyRNA *self,
|
|||
PyObject *args,
|
||||
|
||||
/* Values to assign. */
|
||||
const char **attr,
|
||||
PyObject **seq,
|
||||
int *tot,
|
||||
int *size,
|
||||
RawPropertyType *raw_type,
|
||||
int *attr_tot,
|
||||
bool *attr_signed)
|
||||
const char **r_attr,
|
||||
PyObject **r_seq,
|
||||
int *r_tot,
|
||||
int *r_size,
|
||||
RawPropertyType *r_raw_type,
|
||||
int *r_attr_tot,
|
||||
bool *r_attr_signed)
|
||||
{
|
||||
#if 0
|
||||
int array_tot;
|
||||
int target_tot;
|
||||
#endif
|
||||
|
||||
*size = *attr_tot = 0;
|
||||
*attr_signed = false;
|
||||
*raw_type = PROP_RAW_UNSET;
|
||||
*r_size = *r_attr_tot = 0;
|
||||
*r_attr_signed = false;
|
||||
*r_raw_type = PROP_RAW_UNSET;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO:foreach_get/set", attr, seq)) {
|
||||
if (!PyArg_ParseTuple(args, "sO:foreach_get/set", r_attr, r_seq)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) {
|
||||
if (!PySequence_Check(*r_seq) && PyObject_CheckBuffer(*r_seq)) {
|
||||
PyErr_Format(
|
||||
PyExc_TypeError,
|
||||
"foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
|
||||
Py_TYPE(*seq)->tp_name);
|
||||
Py_TYPE(*r_seq)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO - buffer may not be a sequence! array.array() is though. */
|
||||
*tot = PySequence_Size(*seq);
|
||||
*r_tot = PySequence_Size(*r_seq);
|
||||
|
||||
if (*tot > 0) {
|
||||
if (!foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed)) {
|
||||
if (*r_tot > 0) {
|
||||
if (!foreach_attr_type(self, *r_attr, r_raw_type, r_attr_tot, r_attr_signed)) {
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"foreach_get/set '%.200s.%200s[...]' elements have no attribute '%.200s'",
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
RNA_property_identifier(self->prop),
|
||||
*attr);
|
||||
*r_attr);
|
||||
return -1;
|
||||
}
|
||||
*size = RNA_raw_type_sizeof(*raw_type);
|
||||
*r_size = RNA_raw_type_sizeof(*r_raw_type);
|
||||
|
||||
#if 0 /* Works fine, but not strictly needed. \
|
||||
* we could allow RNA_property_collection_raw_* to do the checks */
|
||||
if ((*attr_tot) < 1) {
|
||||
*attr_tot = 1;
|
||||
if ((*r_attr_tot) < 1) {
|
||||
*r_attr_tot = 1;
|
||||
}
|
||||
|
||||
if (RNA_property_type(self->prop) == PROP_COLLECTION) {
|
||||
|
@ -5181,23 +5181,23 @@ static int foreach_parse_args(BPy_PropertyRNA *self,
|
|||
array_tot = RNA_property_array_length(&self->ptr, self->prop);
|
||||
}
|
||||
|
||||
target_tot = array_tot * (*attr_tot);
|
||||
target_tot = array_tot * (*r_attr_tot);
|
||||
|
||||
/* rna_access.c - rna_raw_access(...) uses this same method. */
|
||||
if (target_tot != (*tot)) {
|
||||
if (target_tot != (*r_tot)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"foreach_get(attr, sequence) sequence length mismatch given %d, needed %d",
|
||||
*tot,
|
||||
*r_tot,
|
||||
target_tot);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check 'attr_tot' otherwise we don't know if any values were set.
|
||||
/* Check 'r_attr_tot' otherwise we don't know if any values were set.
|
||||
* This isn't ideal because it means running on an empty list may
|
||||
* fail silently when it's not compatible. */
|
||||
if (*size == 0 && *attr_tot != 0) {
|
||||
if (*r_size == 0 && *r_attr_tot != 0) {
|
||||
PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ static int validate_array_length(PyObject *rvalue,
|
|||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
int lvalue_dim,
|
||||
int *totitem,
|
||||
int *r_totitem,
|
||||
const char *error_prefix)
|
||||
{
|
||||
int dimsize[MAX_ARRAY_DIMENSION];
|
||||
|
@ -296,7 +296,7 @@ static int validate_array_length(PyObject *rvalue,
|
|||
return -1;
|
||||
}
|
||||
#else
|
||||
*totitem = tot;
|
||||
*r_totitem = tot;
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
|
@ -346,7 +346,7 @@ static int validate_array_length(PyObject *rvalue,
|
|||
}
|
||||
}
|
||||
|
||||
*totitem = len;
|
||||
*r_totitem = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ static int validate_array(PyObject *rvalue,
|
|||
int lvalue_dim,
|
||||
ItemTypeCheckFunc check_item_type,
|
||||
const char *item_type_str,
|
||||
int *totitem,
|
||||
int *r_totitem,
|
||||
const char *error_prefix)
|
||||
{
|
||||
int dimsize[MAX_ARRAY_DIMENSION];
|
||||
|
@ -405,7 +405,7 @@ static int validate_array(PyObject *rvalue,
|
|||
return -1;
|
||||
}
|
||||
else {
|
||||
*totitem = dimsize[0] * dimsize[1];
|
||||
*r_totitem = dimsize[0] * dimsize[1];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ static int validate_array(PyObject *rvalue,
|
|||
return -1;
|
||||
}
|
||||
|
||||
return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
|
||||
return validate_array_length(rvalue, ptr, prop, lvalue_dim, r_totitem, error_prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue