Cleanup: return argument naming
This commit is contained in:
		@@ -906,7 +906,7 @@ int UI_autocomplete_end(AutoComplete *autocpl, char *autoname);
 | 
				
			|||||||
 * not clear yet so we postpone that. */
 | 
					 * not clear yet so we postpone that. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_panels_begin(const struct bContext *C, struct ARegion *ar);
 | 
					void UI_panels_begin(const struct bContext *C, struct ARegion *ar);
 | 
				
			||||||
void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *x, int *y);
 | 
					void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *r_x, int *r_y);
 | 
				
			||||||
void UI_panels_draw(const struct bContext *C, struct ARegion *ar);
 | 
					void UI_panels_draw(const struct bContext *C, struct ARegion *ar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt);
 | 
					struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt);
 | 
				
			||||||
@@ -916,7 +916,7 @@ struct Panel *UI_panel_begin(
 | 
				
			|||||||
        bool *r_open);
 | 
					        bool *r_open);
 | 
				
			||||||
void UI_panel_end(uiBlock *block, int width, int height);
 | 
					void UI_panel_end(uiBlock *block, int width, int height);
 | 
				
			||||||
void UI_panels_scale(struct ARegion *ar, float new_width);
 | 
					void UI_panels_scale(struct ARegion *ar, float new_width);
 | 
				
			||||||
void UI_panel_label_offset(struct uiBlock *block, int *x, int *y);
 | 
					void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
 | 
				
			||||||
int UI_panel_size_y(const struct Panel *pa);
 | 
					int UI_panel_size_y(const struct Panel *pa);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool                       UI_panel_category_is_visible(struct ARegion *ar);
 | 
					bool                       UI_panel_category_is_visible(struct ARegion *ar);
 | 
				
			||||||
@@ -1034,7 +1034,7 @@ enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style);
 | 
					uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style);
 | 
				
			||||||
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout);
 | 
					void UI_block_layout_set_current(uiBlock *block, uiLayout *layout);
 | 
				
			||||||
void UI_block_layout_resolve(uiBlock *block, int *x, int *y);
 | 
					void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_region_message_subscribe(struct ARegion *ar, struct wmMsgBus *mbus);
 | 
					void UI_region_message_subscribe(struct ARegion *ar, struct wmMsgBus *mbus);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -209,10 +209,10 @@ bool  UI_view2d_view_to_region_rcti_clip(struct View2D *v2d, const struct rctf *
 | 
				
			|||||||
struct View2D *UI_view2d_fromcontext(const struct bContext *C);
 | 
					struct View2D *UI_view2d_fromcontext(const struct bContext *C);
 | 
				
			||||||
struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C);
 | 
					struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_view2d_scale_get(struct View2D *v2d, float *x, float *y);
 | 
					void UI_view2d_scale_get(struct View2D *v2d, float *r_x, float *r_y);
 | 
				
			||||||
void UI_view2d_scale_get_inverse(struct View2D *v2d, float *x, float *y);
 | 
					void UI_view2d_scale_get_inverse(struct View2D *v2d, float *r_x, float *r_y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_view2d_center_get(struct View2D *v2d, float *x, float *y);
 | 
					void UI_view2d_center_get(struct View2D *v2d, float *r_x, float *r_y);
 | 
				
			||||||
void UI_view2d_center_set(struct View2D *v2d, float x, float y);
 | 
					void UI_view2d_center_set(struct View2D *v2d, float x, float y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac);
 | 
					void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6016,7 +6016,7 @@ static bool ui_numedit_but_HSVCIRCLE(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ui_hsvcircle_vals_from_pos(hsv, hsv + 1, &rect, mx_fl, my_fl);
 | 
						ui_hsvcircle_vals_from_pos(&rect, mx_fl, my_fl, hsv, hsv + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((cpicker->use_color_cubic) && (U.color_picker_type == USER_CP_CIRCLE_HSV)) {
 | 
						if ((cpicker->use_color_cubic) && (U.color_picker_type == USER_CP_CIRCLE_HSV)) {
 | 
				
			||||||
		hsv[1] = 1.0f - sqrt3f(1.0f - hsv[1]);
 | 
							hsv[1] = 1.0f - sqrt3f(1.0f - hsv[1]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -462,8 +462,8 @@ extern void ui_but_v3_get(uiBut *but, float vec[3]);
 | 
				
			|||||||
extern void ui_but_v3_set(uiBut *but, const float vec[3]);
 | 
					extern void ui_but_v3_set(uiBut *but, const float vec[3]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void ui_hsvcircle_vals_from_pos(
 | 
					extern void ui_hsvcircle_vals_from_pos(
 | 
				
			||||||
        float *val_rad, float *val_dist, const rcti *rect,
 | 
					        const rcti *rect, const float mx, const float my,
 | 
				
			||||||
        const float mx, const float my);
 | 
					        float *r_val_rad, float *r_val_dist);
 | 
				
			||||||
extern void ui_hsvcircle_pos_from_vals(const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *xpos, float *ypos);
 | 
					extern void ui_hsvcircle_pos_from_vals(const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *xpos, float *ypos);
 | 
				
			||||||
extern void ui_hsvcube_pos_from_vals(const struct uiBut *but, const rcti *rect, const float *hsv, float *xp, float *yp);
 | 
					extern void ui_hsvcube_pos_from_vals(const struct uiBut *but, const rcti *rect, const float *hsv, float *xp, float *yp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2135,24 +2135,24 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
 | 
				
			|||||||
/* Pointer RNA button with search */
 | 
					/* Pointer RNA button with search */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA **prop)
 | 
					static void search_id_collection(StructRNA *ptype, PointerRNA *r_ptr, PropertyRNA **r_prop)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	StructRNA *srna;
 | 
						StructRNA *srna;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* look for collection property in Main */
 | 
						/* look for collection property in Main */
 | 
				
			||||||
	/* Note: using global Main is OK-ish here, UI shall not access other Mains anyay... */
 | 
						/* Note: using global Main is OK-ish here, UI shall not access other Mains anyay... */
 | 
				
			||||||
	RNA_main_pointer_create(G_MAIN, ptr);
 | 
						RNA_main_pointer_create(G_MAIN, r_ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*prop = NULL;
 | 
						*r_prop = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RNA_STRUCT_BEGIN (ptr, iprop)
 | 
						RNA_STRUCT_BEGIN (r_ptr, iprop)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		/* if it's a collection and has same pointer type, we've got it */
 | 
							/* if it's a collection and has same pointer type, we've got it */
 | 
				
			||||||
		if (RNA_property_type(iprop) == PROP_COLLECTION) {
 | 
							if (RNA_property_type(iprop) == PROP_COLLECTION) {
 | 
				
			||||||
			srna = RNA_property_pointer_type(ptr, iprop);
 | 
								srna = RNA_property_pointer_type(r_ptr, iprop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (ptype == srna) {
 | 
								if (ptype == srna) {
 | 
				
			||||||
				*prop = iprop;
 | 
									*r_prop = iprop;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -4442,7 +4442,7 @@ static void ui_item_layout(uiItem *item)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
 | 
					static void ui_layout_end(uiBlock *block, uiLayout *layout, int *r_x, int *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (layout->root->handlefunc) {
 | 
						if (layout->root->handlefunc) {
 | 
				
			||||||
		UI_block_func_handle_set(block, layout->root->handlefunc, layout->root->argv);
 | 
							UI_block_func_handle_set(block, layout->root->handlefunc, layout->root->argv);
 | 
				
			||||||
@@ -4451,11 +4451,11 @@ static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
 | 
				
			|||||||
	ui_item_estimate(&layout->item);
 | 
						ui_item_estimate(&layout->item);
 | 
				
			||||||
	ui_item_layout(&layout->item);
 | 
						ui_item_layout(&layout->item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (x) {
 | 
						if (r_x) {
 | 
				
			||||||
		*x = layout->x;
 | 
							*r_x = layout->x;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (y) {
 | 
						if (r_y) {
 | 
				
			||||||
		*y = layout->y;
 | 
							*r_y = layout->y;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -4599,17 +4599,17 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv)
 | 
				
			|||||||
	layout->root->argv = argv;
 | 
						layout->root->argv = argv;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_block_layout_resolve(uiBlock *block, int *x, int *y)
 | 
					void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uiLayoutRoot *root;
 | 
						uiLayoutRoot *root;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BLI_assert(block->active);
 | 
						BLI_assert(block->active);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (x) {
 | 
						if (r_x) {
 | 
				
			||||||
		*x = 0;
 | 
							*r_x = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (y) {
 | 
						if (r_y) {
 | 
				
			||||||
		*y = 0;
 | 
							*r_y = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	block->curlayout = NULL;
 | 
						block->curlayout = NULL;
 | 
				
			||||||
@@ -4618,7 +4618,7 @@ void UI_block_layout_resolve(uiBlock *block, int *x, int *y)
 | 
				
			|||||||
		ui_layout_add_padding_button(root);
 | 
							ui_layout_add_padding_button(root);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* NULL in advance so we don't interfere when adding button */
 | 
							/* NULL in advance so we don't interfere when adding button */
 | 
				
			||||||
		ui_layout_end(block, root->layout, x, y);
 | 
							ui_layout_end(block, root->layout, r_x, r_y);
 | 
				
			||||||
		ui_layout_free(root->layout);
 | 
							ui_layout_free(root->layout);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -191,9 +191,9 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b
 | 
				
			|||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **pa_animate)
 | 
					static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	*pa_animate = NULL;
 | 
						*r_pa_animate = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
 | 
						if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
 | 
				
			||||||
		SpaceProperties *sbuts = sa->spacedata.first;
 | 
							SpaceProperties *sbuts = sa->spacedata.first;
 | 
				
			||||||
@@ -219,7 +219,7 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **pa_animate)
 | 
				
			|||||||
	/* Detect panel marked for animation, if we're not already animating. */
 | 
						/* Detect panel marked for animation, if we're not already animating. */
 | 
				
			||||||
	if (pa_animation) {
 | 
						if (pa_animation) {
 | 
				
			||||||
		if (!no_animation) {
 | 
							if (!no_animation) {
 | 
				
			||||||
			*pa_animate = pa_animation;
 | 
								*r_pa_animate = pa_animation;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -630,16 +630,16 @@ static void ui_draw_panel_dragwidget(uint pos, uint col, const rctf *rect)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* For button layout next to label. */
 | 
					/* For button layout next to label. */
 | 
				
			||||||
void UI_panel_label_offset(uiBlock *block, int *x, int *y)
 | 
					void UI_panel_label_offset(uiBlock *block, int *r_x, int *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Panel *panel = block->panel;
 | 
						Panel *panel = block->panel;
 | 
				
			||||||
	const bool is_subpanel = (panel->type && panel->type->parent);
 | 
						const bool is_subpanel = (panel->type && panel->type->parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*x = UI_UNIT_X * 1.0f;
 | 
						*r_x = UI_UNIT_X * 1.0f;
 | 
				
			||||||
	*y = UI_UNIT_Y * 1.5f;
 | 
						*r_y = UI_UNIT_Y * 1.5f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (is_subpanel) {
 | 
						if (is_subpanel) {
 | 
				
			||||||
		*x += (0.7f * UI_UNIT_X);
 | 
							*r_x += (0.7f * UI_UNIT_X);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1167,7 +1167,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
 | 
				
			|||||||
	return done;
 | 
						return done;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
 | 
					static void ui_panels_size(ScrArea *sa, ARegion *ar, int *r_x, int *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Panel *pa;
 | 
						Panel *pa;
 | 
				
			||||||
	int align = panel_aligned(sa, ar);
 | 
						int align = panel_aligned(sa, ar);
 | 
				
			||||||
@@ -1200,8 +1200,8 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
 | 
				
			|||||||
		sizey = -UI_PANEL_WIDTH;
 | 
							sizey = -UI_PANEL_WIDTH;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*x = sizex;
 | 
						*r_x = sizex;
 | 
				
			||||||
	*y = sizey;
 | 
						*r_y = sizey;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ui_do_animate(const bContext *C, Panel *panel)
 | 
					static void ui_do_animate(const bContext *C, Panel *panel)
 | 
				
			||||||
@@ -1250,7 +1250,7 @@ void UI_panels_begin(const bContext *UNUSED(C), ARegion *ar)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* only draws blocks with panels */
 | 
					/* only draws blocks with panels */
 | 
				
			||||||
void UI_panels_end(const bContext *C, ARegion *ar, int *x, int *y)
 | 
					void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ScrArea *sa = CTX_wm_area(C);
 | 
						ScrArea *sa = CTX_wm_area(C);
 | 
				
			||||||
	uiBlock *block;
 | 
						uiBlock *block;
 | 
				
			||||||
@@ -1313,7 +1313,7 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *x, int *y)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* compute size taken up by panel */
 | 
						/* compute size taken up by panel */
 | 
				
			||||||
	ui_panels_size(sa, ar, x, y);
 | 
						ui_panels_size(sa, ar, r_x, r_y);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void UI_panels_draw(const bContext *C, ARegion *ar)
 | 
					void UI_panels_draw(const bContext *C, ARegion *ar)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2680,8 +2680,8 @@ static void ui_hsv_cursor(float x, float y)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ui_hsvcircle_vals_from_pos(
 | 
					void ui_hsvcircle_vals_from_pos(
 | 
				
			||||||
        float *val_rad, float *val_dist, const rcti *rect,
 | 
					        const rcti *rect, const float mx, const float my,
 | 
				
			||||||
        const float mx, const float my)
 | 
					        float *r_val_rad, float *r_val_dist)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* duplication of code... well, simple is better now */
 | 
						/* duplication of code... well, simple is better now */
 | 
				
			||||||
	const float centx = BLI_rcti_cent_x_fl(rect);
 | 
						const float centx = BLI_rcti_cent_x_fl(rect);
 | 
				
			||||||
@@ -2690,8 +2690,8 @@ void ui_hsvcircle_vals_from_pos(
 | 
				
			|||||||
	const float m_delta[2] = {mx - centx, my - centy};
 | 
						const float m_delta[2] = {mx - centx, my - centy};
 | 
				
			||||||
	const float dist_sq = len_squared_v2(m_delta);
 | 
						const float dist_sq = len_squared_v2(m_delta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*val_dist = (dist_sq < (radius * radius)) ? sqrtf(dist_sq) / radius : 1.0f;
 | 
						*r_val_dist = (dist_sq < (radius * radius)) ? sqrtf(dist_sq) / radius : 1.0f;
 | 
				
			||||||
	*val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f;
 | 
						*r_val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* cursor in hsv circle, in float units -1 to 1, to map on radius */
 | 
					/* cursor in hsv circle, in float units -1 to 1, to map on radius */
 | 
				
			||||||
@@ -2780,7 +2780,9 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const
 | 
				
			|||||||
		float hsv_ang[3];
 | 
							float hsv_ang[3];
 | 
				
			||||||
		float rgb_ang[3];
 | 
							float rgb_ang[3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ui_hsvcircle_vals_from_pos(hsv_ang, hsv_ang + 1, rect, centx + co * radius, centy + si * radius);
 | 
							ui_hsvcircle_vals_from_pos(
 | 
				
			||||||
 | 
							        rect, centx + co * radius, centy + si * radius,
 | 
				
			||||||
 | 
							        hsv_ang, hsv_ang + 1);
 | 
				
			||||||
		hsv_ang[2] = hsv[2];
 | 
							hsv_ang[2] = hsv[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ui_color_picker_to_rgb_v(hsv_ang, rgb_ang);
 | 
							ui_color_picker_to_rgb_v(hsv_ang, rgb_ang);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1115,9 +1115,9 @@ void UI_view2d_zoom_cache_reset(void)
 | 
				
			|||||||
/* View Matrix Setup */
 | 
					/* View Matrix Setup */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* mapping function to ensure 'cur' draws extended over the area where sliders are */
 | 
					/* mapping function to ensure 'cur' draws extended over the area where sliders are */
 | 
				
			||||||
static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
 | 
					static void view2d_map_cur_using_mask(View2D *v2d, rctf *r_curmasked)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	*curmasked = v2d->cur;
 | 
						*r_curmasked = v2d->cur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (view2d_scroll_mapped(v2d->scroll)) {
 | 
						if (view2d_scroll_mapped(v2d->scroll)) {
 | 
				
			||||||
		float sizex = BLI_rcti_size_x(&v2d->mask);
 | 
							float sizex = BLI_rcti_size_x(&v2d->mask);
 | 
				
			||||||
@@ -1130,17 +1130,17 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
 | 
				
			|||||||
			float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
 | 
								float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (v2d->mask.xmin != 0) {
 | 
								if (v2d->mask.xmin != 0) {
 | 
				
			||||||
				curmasked->xmin -= dx * (float)v2d->mask.xmin;
 | 
									r_curmasked->xmin -= dx * (float)v2d->mask.xmin;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (v2d->mask.xmax + 1 != v2d->winx) {
 | 
								if (v2d->mask.xmax + 1 != v2d->winx) {
 | 
				
			||||||
				curmasked->xmax += dx * (float)(v2d->winx - v2d->mask.xmax - 1);
 | 
									r_curmasked->xmax += dx * (float)(v2d->winx - v2d->mask.xmax - 1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (v2d->mask.ymin != 0) {
 | 
								if (v2d->mask.ymin != 0) {
 | 
				
			||||||
				curmasked->ymin -= dy * (float)v2d->mask.ymin;
 | 
									r_curmasked->ymin -= dy * (float)v2d->mask.ymin;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (v2d->mask.ymax + 1 != v2d->winy) {
 | 
								if (v2d->mask.ymax + 1 != v2d->winy) {
 | 
				
			||||||
				curmasked->ymax += dy * (float)(v2d->winy - v2d->mask.ymax - 1);
 | 
									r_curmasked->ymax += dy * (float)(v2d->winy - v2d->mask.ymax - 1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1244,14 +1244,14 @@ struct View2DGrid {
 | 
				
			|||||||
/* --------------- */
 | 
					/* --------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* try to write step as a power of 10 */
 | 
					/* try to write step as a power of 10 */
 | 
				
			||||||
static void step_to_grid(float *step, int *power, int unit)
 | 
					static void step_to_grid(float *step, const int unit, int *r_power)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const float loga = (float)log10(*step);
 | 
						const float loga = (float)log10(*step);
 | 
				
			||||||
	float rem;
 | 
						float rem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*power = (int)(loga);
 | 
						int power = (int)(loga);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rem = loga - (*power);
 | 
						rem = loga - power;
 | 
				
			||||||
	rem = (float)pow(10.0, rem);
 | 
						rem = (float)pow(10.0, rem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (loga < 0.0f) {
 | 
						if (loga < 0.0f) {
 | 
				
			||||||
@@ -1265,7 +1265,7 @@ static void step_to_grid(float *step, int *power, int unit)
 | 
				
			|||||||
			rem = 1.0f;
 | 
								rem = 1.0f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		*step = rem * (float)pow(10.0, (*power));
 | 
							*step = rem * (float)pow(10.0, power);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* for frames, we want 1.0 frame intervals only */
 | 
							/* for frames, we want 1.0 frame intervals only */
 | 
				
			||||||
		if (unit == V2D_UNIT_FRAMES) {
 | 
							if (unit == V2D_UNIT_FRAMES) {
 | 
				
			||||||
@@ -1277,7 +1277,7 @@ static void step_to_grid(float *step, int *power, int unit)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		/* prevents printing 1.0 2.0 3.0 etc */
 | 
							/* prevents printing 1.0 2.0 3.0 etc */
 | 
				
			||||||
		if (rem == 1.0f) {
 | 
							if (rem == 1.0f) {
 | 
				
			||||||
			(*power)++;
 | 
								power++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
@@ -1291,14 +1291,16 @@ static void step_to_grid(float *step, int *power, int unit)
 | 
				
			|||||||
			rem = 10.0f;
 | 
								rem = 10.0f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		*step = rem * (float)pow(10.0, (*power));
 | 
							*step = rem * (float)pow(10.0, power);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		(*power)++;
 | 
							power++;
 | 
				
			||||||
		/* prevents printing 1.0, 2.0, 3.0, etc. */
 | 
							/* prevents printing 1.0, 2.0, 3.0, etc. */
 | 
				
			||||||
		if (rem == 10.0f) {
 | 
							if (rem == 10.0f) {
 | 
				
			||||||
			(*power)++;
 | 
								power++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*r_power = power;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -1347,7 +1349,7 @@ View2DGrid *UI_view2d_grid_calc(
 | 
				
			|||||||
			const float pixels = (float)BLI_rcti_size_x(&v2d->mask);
 | 
								const float pixels = (float)BLI_rcti_size_x(&v2d->mask);
 | 
				
			||||||
			if (pixels != 0.0f) {
 | 
								if (pixels != 0.0f) {
 | 
				
			||||||
				grid->dx = (U.v2d_min_gridsize * UI_DPI_FAC * space) / (seconddiv * pixels);
 | 
									grid->dx = (U.v2d_min_gridsize * UI_DPI_FAC * space) / (seconddiv * pixels);
 | 
				
			||||||
				step_to_grid(&grid->dx, &grid->powerx, xunits);
 | 
									step_to_grid(&grid->dx, xunits, &grid->powerx);
 | 
				
			||||||
				grid->dx *= seconddiv;
 | 
									grid->dx *= seconddiv;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1366,7 +1368,7 @@ View2DGrid *UI_view2d_grid_calc(
 | 
				
			|||||||
			const float pixels = (float)winy;
 | 
								const float pixels = (float)winy;
 | 
				
			||||||
			if (pixels != 0.0f) {
 | 
								if (pixels != 0.0f) {
 | 
				
			||||||
				grid->dy = U.v2d_min_gridsize * UI_DPI_FAC * space / pixels;
 | 
									grid->dy = U.v2d_min_gridsize * UI_DPI_FAC * space / pixels;
 | 
				
			||||||
				step_to_grid(&grid->dy, &grid->powery, yunits);
 | 
									step_to_grid(&grid->dy, yunits, &grid->powery);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2234,11 +2236,11 @@ void UI_view2d_listview_cell_to_view(
 | 
				
			|||||||
 * (like for Animation Editor channel lists, to make the first entry more visible), these will be
 | 
					 * (like for Animation Editor channel lists, to make the first entry more visible), these will be
 | 
				
			||||||
 * the min-coordinates of the first item.
 | 
					 * the min-coordinates of the first item.
 | 
				
			||||||
 * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for
 | 
					 * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for
 | 
				
			||||||
 * \param column, row: the 'coordinates' of the relevant 'cell'
 | 
					 * \param r_column, r_row: the 'coordinates' of the relevant 'cell'
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void UI_view2d_listview_view_to_cell(
 | 
					void UI_view2d_listview_view_to_cell(
 | 
				
			||||||
        View2D *v2d, float columnwidth, float rowheight, float startx, float starty,
 | 
					        View2D *v2d, float columnwidth, float rowheight, float startx, float starty,
 | 
				
			||||||
        float viewx, float viewy, int *column, int *row)
 | 
					        float viewx, float viewy, int *r_column, int *r_row)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* adjust view coordinates to be all positive ints, corrected for the start offset */
 | 
						/* adjust view coordinates to be all positive ints, corrected for the start offset */
 | 
				
			||||||
	const int x = (int)(floorf(fabsf(viewx) + 0.5f) - startx);
 | 
						const int x = (int)(floorf(fabsf(viewx) + 0.5f) - startx);
 | 
				
			||||||
@@ -2246,30 +2248,30 @@ void UI_view2d_listview_view_to_cell(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* sizes must not be negative */
 | 
						/* sizes must not be negative */
 | 
				
			||||||
	if ((v2d == NULL) || ((columnwidth <= 0) && (rowheight <= 0))) {
 | 
						if ((v2d == NULL) || ((columnwidth <= 0) && (rowheight <= 0))) {
 | 
				
			||||||
		if (column) {
 | 
							if (r_column) {
 | 
				
			||||||
			*column = 0;
 | 
								*r_column = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (row) {
 | 
							if (r_row) {
 | 
				
			||||||
			*row = 0;
 | 
								*r_row = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get column */
 | 
						/* get column */
 | 
				
			||||||
	if ((column) && (columnwidth > 0)) {
 | 
						if ((r_column) && (columnwidth > 0)) {
 | 
				
			||||||
		*column = x / columnwidth;
 | 
							*r_column = x / columnwidth;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (column) {
 | 
						else if (r_column) {
 | 
				
			||||||
		*column = 0;
 | 
							*r_column = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get row */
 | 
						/* get row */
 | 
				
			||||||
	if ((row) && (rowheight > 0)) {
 | 
						if ((r_row) && (rowheight > 0)) {
 | 
				
			||||||
		*row = y / rowheight;
 | 
							*r_row = y / rowheight;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (row) {
 | 
						else if (r_row) {
 | 
				
			||||||
		*row = 0;
 | 
							*r_row = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2512,27 +2514,27 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
 | 
				
			|||||||
 * Is used to inverse correct drawing of icons, etc. that need to follow view
 | 
					 * Is used to inverse correct drawing of icons, etc. that need to follow view
 | 
				
			||||||
 * but not be affected by scale
 | 
					 * but not be affected by scale
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * \param x, y: scale on each axis
 | 
					 * \param r_x, r_y: scale on each axis
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void UI_view2d_scale_get(View2D *v2d, float *x, float *y)
 | 
					void UI_view2d_scale_get(View2D *v2d, float *r_x, float *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (x) {
 | 
						if (r_x) {
 | 
				
			||||||
		*x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur);
 | 
							*r_x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (y) {
 | 
						if (r_y) {
 | 
				
			||||||
		*y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur);
 | 
							*r_y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Same as ``UI_view2d_scale_get() - 1.0f / x, y``
 | 
					 * Same as ``UI_view2d_scale_get() - 1.0f / x, y``
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void UI_view2d_scale_get_inverse(View2D *v2d, float *x, float *y)
 | 
					void UI_view2d_scale_get_inverse(View2D *v2d, float *r_x, float *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (x) {
 | 
						if (r_x) {
 | 
				
			||||||
		*x = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
 | 
							*r_x = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (y) {
 | 
						if (r_y) {
 | 
				
			||||||
		*y = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
 | 
							*r_y = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2540,14 +2542,14 @@ void UI_view2d_scale_get_inverse(View2D *v2d, float *x, float *y)
 | 
				
			|||||||
 * Simple functions for consistent center offset access.
 | 
					 * Simple functions for consistent center offset access.
 | 
				
			||||||
 * Used by node editor to shift view center for each individual node tree.
 | 
					 * Used by node editor to shift view center for each individual node tree.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void UI_view2d_center_get(struct View2D *v2d, float *x, float *y)
 | 
					void UI_view2d_center_get(struct View2D *v2d, float *r_x, float *r_y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* get center */
 | 
						/* get center */
 | 
				
			||||||
	if (x) {
 | 
						if (r_x) {
 | 
				
			||||||
		*x = BLI_rctf_cent_x(&v2d->cur);
 | 
							*r_x = BLI_rctf_cent_x(&v2d->cur);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (y) {
 | 
						if (r_y) {
 | 
				
			||||||
		*y = BLI_rctf_cent_y(&v2d->cur);
 | 
							*r_y = BLI_rctf_cent_y(&v2d->cur);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void UI_view2d_center_set(struct View2D *v2d, float x, float y)
 | 
					void UI_view2d_center_set(struct View2D *v2d, float x, float y)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user