UI: Improve 3d text selection #109229

Manually merged
Campbell Barton merged 30 commits from guishe/blender:improve-3dtext-selection into main 2023-07-06 05:28:40 +02:00
6 changed files with 36 additions and 38 deletions
Showing only changes of commit c847c2b2dc - Show all commits

View File

@ -97,7 +97,7 @@ static void rna_Camera_background_images_remove(Camera *cam,
ReportList *reports,
PointerRNA *bgpic_ptr)
{
CameraBGImage *bgpic = static_cast<CameraBGImage *>(bgpic_ptr->data);
CameraBGImage *bgpic = static_cast<CameraBGImage*>(bgpic_ptr->data);
if (BLI_findindex(&cam->bg_images, bgpic) == -1) {
BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
}
@ -117,7 +117,7 @@ static void rna_Camera_background_images_clear(Camera *cam)
static char *rna_Camera_background_image_path(const PointerRNA *ptr)
{
const CameraBGImage *bgpic = static_cast<const CameraBGImage *>(ptr->data);
const CameraBGImage *bgpic = static_cast<const CameraBGImage*>(ptr->data);
Camera *camera = (Camera *)ptr->owner_id;
const int bgpic_index = BLI_findindex(&camera->bg_images, bgpic);
@ -131,7 +131,7 @@ static char *rna_Camera_background_image_path(const PointerRNA *ptr)
char *rna_CameraBackgroundImage_image_or_movieclip_user_path(const PointerRNA *ptr)
{
const char *user = static_cast<const char *>(ptr->data);
const char *user = static_cast<const char*>(ptr->data);
Camera *camera = (Camera *)ptr->owner_id;
int bgpic_index = BLI_findindex(&camera->bg_images, user - offsetof(CameraBGImage, iuser));
@ -154,9 +154,9 @@ static bool rna_Camera_background_images_override_apply(Main *bmain,
PropertyRNA *prop_dst,
PropertyRNA * /*prop_src*/,
PropertyRNA * /*prop_storage*/,
const int /*len_dst*/,
const int /*len_src*/,
const int /*len_storage*/,
const int /*len_dst*/,
const int /*len_src*/,
const int /*len_storage*/,
PointerRNA * /*ptr_item_dst*/,
PointerRNA * /*ptr_item_src*/,
PointerRNA * /*ptr_item_storage*/,
@ -171,12 +171,10 @@ static bool rna_Camera_background_images_override_apply(Main *bmain,
/* Remember that insertion operations are defined and stored in correct order, which means that
* even if we insert several items in a row, we always insert first one, then second one, etc.
* So we should always find 'anchor' constraint in both _src *and* _dst. */
CameraBGImage *bgpic_anchor = static_cast<CameraBGImage *>(
BLI_findlink(&cam_dst->bg_images, opop->subitem_reference_index));
CameraBGImage *bgpic_anchor = static_cast<CameraBGImage*>(BLI_findlink(&cam_dst->bg_images, opop->subitem_reference_index));
/* If `bgpic_anchor` is nullptr, `bgpic_src` will be inserted in first position. */
CameraBGImage *bgpic_src = static_cast<CameraBGImage *>(
BLI_findlink(&cam_src->bg_images, opop->subitem_local_index));
CameraBGImage *bgpic_src = static_cast<CameraBGImage*>(BLI_findlink(&cam_src->bg_images, opop->subitem_local_index));
if (bgpic_src == nullptr) {
BLI_assert(bgpic_src != nullptr);
@ -835,8 +833,7 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "CameraBackgroundImage");
RNA_def_property_ui_text(prop, "Background Images", "List of background images");
RNA_def_property_override_flag(prop, PROPOVERRIDE_LIBRARY_INSERTION | PROPOVERRIDE_NO_PROP_NAME);
RNA_def_property_override_funcs(
prop, nullptr, nullptr, "rna_Camera_background_images_override_apply");
RNA_def_property_override_funcs(prop, nullptr, nullptr, "rna_Camera_background_images_override_apply");
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, nullptr);
RNA_define_lib_overridable(false);

View File

@ -83,8 +83,8 @@ static void rna_MovieClipUser_proxy_render_settings_update(Main *bmain,
ScrArea *area;
SpaceLink *sl;
for (area = static_cast<ScrArea *>(screen->areabase.first); area; area = area->next) {
for (sl = static_cast<SpaceLink *>(area->spacedata.first); sl; sl = sl->next) {
for (area = static_cast<ScrArea*>(screen->areabase.first); area; area = area->next) {
for (sl = static_cast<SpaceLink*>(area->spacedata.first); sl; sl = sl->next) {
if (sl->spacetype == SPACE_CLIP) {
SpaceClip *sc = (SpaceClip *)sl;
@ -217,8 +217,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension");
prop = RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, nullptr, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
RNA_def_property_boolean_sdna(prop, nullptr, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension");

View File

@ -110,8 +110,8 @@ static char *rna_NlaStrip_path(const PointerRNA *ptr)
NlaTrack *nlt;
NlaStrip *nls;
for (nlt = static_cast<NlaTrack *>(adt->nla_tracks.first); nlt; nlt = nlt->next) {
for (nls = static_cast<NlaStrip *>(nlt->strips.first); nls; nls = nls->next) {
for (nlt = static_cast<NlaTrack*>(adt->nla_tracks.first); nlt; nlt = nlt->next) {
for (nls = static_cast<NlaStrip*>(nlt->strips.first); nls; nls = nls->next) {
if (nls == strip) {
/* XXX but if we animate like this, the control will never work... */
char name_esc_nlt[sizeof(nlt->name) * 2];
@ -591,7 +591,7 @@ static NlaStrip *rna_NlaStrip_new(ID *id,
static void rna_NlaStrip_remove(
ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, PointerRNA *strip_ptr)
{
NlaStrip *strip = static_cast<NlaStrip *>(strip_ptr->data);
NlaStrip *strip = static_cast<NlaStrip*>(strip_ptr->data);
if (BLI_findindex(&track->strips, strip) == -1) {
BKE_reportf(
reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name);
@ -908,16 +908,14 @@ static void rna_def_nlastrip(BlenderRNA *brna)
/* XXX: Update temporarily disabled so that the property can be edited at all!
* Even auto-key only applies after the curves have been re-evaluated,
* causing the unkeyed values to be lost. */
RNA_def_property_update(
prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
/* XXX: Update temporarily disabled so that the property can be edited at all!
* Even auto-key only applies after the curves have been re-evaluated,
* causing the unkeyed values to be lost. */
RNA_def_property_update(
prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
/* TODO: should the animated_influence/time settings be animatable themselves? */
prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);

View File

@ -75,10 +75,10 @@ static int rna_Text_current_line_index_get(PointerRNA *ptr)
static void rna_Text_current_line_index_set(PointerRNA *ptr, int value)
{
Text *text = static_cast<Text *>(ptr->data);
TextLine *line = static_cast<TextLine *>(BLI_findlink(&text->lines, value));
Text *text = static_cast<Text*>(ptr->data);
TextLine *line = static_cast<TextLine*>(BLI_findlink(&text->lines, value));
if (line == nullptr) {
line = static_cast<TextLine *>(text->lines.last);
line = static_cast<TextLine*>(text->lines.last);
}
text->curl = line;
text->curc = 0;
@ -86,16 +86,16 @@ static void rna_Text_current_line_index_set(PointerRNA *ptr, int value)
static int rna_Text_select_end_line_index_get(PointerRNA *ptr)
{
Text *text = static_cast<Text *>(ptr->data);
Text *text = static_cast<Text*>(ptr->data);
return BLI_findindex(&text->lines, text->sell);
}
static void rna_Text_select_end_line_index_set(PointerRNA *ptr, int value)
{
Text *text = static_cast<Text *>(ptr->data);
TextLine *line = static_cast<TextLine *>(BLI_findlink(&text->lines, value));
Text *text = static_cast<Text*>(ptr->data);
TextLine *line = static_cast<TextLine*>(BLI_findlink(&text->lines, value));
if (line == nullptr) {
line = static_cast<TextLine *>(text->lines.last);
line = static_cast<TextLine*>(text->lines.last);
}
text->sell = line;
text->selc = 0;
@ -103,13 +103,13 @@ static void rna_Text_select_end_line_index_set(PointerRNA *ptr, int value)
static int rna_Text_current_character_get(PointerRNA *ptr)
{
Text *text = static_cast<Text *>(ptr->data);
Text *text = static_cast<Text*>(ptr->data);
return BLI_str_utf8_offset_to_index(text->curl->line, text->curc);
}
static void rna_Text_current_character_set(PointerRNA *ptr, int index)
{
Text *text = static_cast<Text *>(ptr->data);
Text *text = static_cast<Text*>(ptr->data);
TextLine *line = text->curl;
const int len_utf8 = BLI_strlen_utf8(line->line);
CLAMP_MAX(index, len_utf8);
@ -118,13 +118,13 @@ static void rna_Text_current_character_set(PointerRNA *ptr, int index)
static int rna_Text_select_end_character_get(PointerRNA *ptr)
{
Text *text = static_cast<Text *>(ptr->data);
Text *text = static_cast<Text*>(ptr->data);
return BLI_str_utf8_offset_to_index(text->sell->line, text->selc);
}
static void rna_Text_select_end_character_set(PointerRNA *ptr, int index)
{
Text *text = static_cast<Text *>(ptr->data);
Text *text = static_cast<Text*>(ptr->data);
TextLine *line = text->sell;
const int len_utf8 = BLI_strlen_utf8(line->line);
CLAMP_MAX(index, len_utf8);
@ -158,7 +158,7 @@ static void rna_TextLine_body_set(PointerRNA *ptr, const char *value)
MEM_freeN(line->line);
}
line->line = static_cast<char *>(MEM_mallocN((len + 1) * sizeof(char), "rna_text_body"));
line->line = static_cast<char*>(MEM_mallocN((len + 1) * sizeof(char), "rna_text_body"));
line->len = len;
memcpy(line->line, value, len + 1);

View File

@ -23,11 +23,13 @@
static IDProperty **rna_TimelineMarker_idprops(PointerRNA *ptr)
{
TimeMarker *marker = static_cast<TimeMarker *>(ptr->data);
TimeMarker *marker = static_cast<TimeMarker*>(ptr->data);
return &marker->prop;
}
static void rna_TimelineMarker_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA * /*ptr*/)
static void rna_TimelineMarker_update(Main * /*bmain*/,
Scene * /*scene*/,
PointerRNA * /*ptr*/)
{
WM_main_add_notifier(NC_SCENE | ND_MARKERS, nullptr);
WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, nullptr);

View File

@ -35,7 +35,9 @@ static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char ** /*r_i
return PROP_EDITABLE;
}
static void rna_VectorFont_reload_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
static void rna_VectorFont_reload_update(Main * /*bmain*/,
Scene * /*scene*/,
PointerRNA *ptr)
{
VFont *vf = (VFont *)ptr->owner_id;
BKE_vfont_free_data(vf);