Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Carlisle <carlisle.b3d@gmail.com>2021-08-09 22:30:55 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2021-08-09 22:33:06 +0300
commit2d867426b1b7e28b58bf0c84119679c73f08175f (patch)
tree38ecf773a3f328a9bdb92d096a4973b38c793229 /source/blender/makesrna
parentce95a2b148ed498a7e8ac7fb6565d7e5f21fca6f (diff)
UI: Clip Editor: Expose 2D Cursor Location to RNA and UI
To be consistent with the image editors and 3D viewport the cursor location can be changed from the sidebar. This was missing from the clip editor, but support has been added in this commit. Previously, the only way to precisely set the cursor was to call the set cursor operator then use the redo panel to adjust the value.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_space.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8c62484f229..fe43237963d 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2477,6 +2477,18 @@ static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr,
ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
}
+static void rna_SpaceClipEditor_cursor_location_get(PointerRNA *ptr, float *values)
+{
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
+ copy_v2_v2(values, sc->cursor);
+}
+
+static void rna_SpaceClipEditor_cursor_location_set(PointerRNA *ptr, const float *values)
+{
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
+ copy_v2_v2(sc->cursor, values);
+}
+
static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
PointerRNA *ptr)
@@ -7330,6 +7342,16 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+ /* transform */
+ prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(prop,
+ "rna_SpaceClipEditor_cursor_location_get",
+ "rna_SpaceClipEditor_cursor_location_set",
+ NULL);
+ RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
/* pivot point */
prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "around");