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:
authorHans Goudey <h.goudey@me.com>2020-11-06 01:08:00 +0300
committerHans Goudey <h.goudey@me.com>2020-11-06 01:08:00 +0300
commit00374fbde2bd717f3fe7b8ee5eb79be0145de37b (patch)
tree90b746916c59f1cdf8e7b5440ef618fbb885995a
parentad481bdd354bc82ac32866240bf816d2abdbb608 (diff)
Move "Camera Parent Lock" from preferences to Object Relations
"Camera Parent Lock" can be useful when rigging cameras, but it is not intuitive, and has also generated a lot of confusion (bug reports). This is because it breaks the fundamental parent <-> child relationship conventions in Blender, and there is no indication that it's intended without diving into the preferences. This commit moves the setting to the object level, and exposes it in the relations panel in the property editor. It is exposed for every object type because any object type can be "View Locked" in the 3D view. The property description is also updated to reflect this change and be more specific without getting too long. In the future this could become a more general feature of the transform system, but for now it is limited to "Lock Camera to View". Differential Revision: https://developer.blender.org/D9239
-rw-r--r--release/scripts/startup/bl_ui/properties_object.py1
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py3
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_280.c6
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h3
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c6
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c7
14 files changed, 34 insertions, 34 deletions
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 4530b4bbe48..7101a78e18f 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -141,6 +141,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, Panel):
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
sub.prop_search(ob, "parent_bone", parent.data, "bones")
sub.active = (parent is not None)
+ sub.prop(ob, "use_camera_lock_parent")
col.separator()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 1707c21c164..8c1409f00ac 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1548,9 +1548,6 @@ class USERPREF_PT_navigation_fly_walk(NavigationPanel, CenterAlignMixIn, Panel):
layout.row().prop(inputs, "navigation_mode", expand=True)
- flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
- flow.prop(inputs, "use_camera_lock_parent")
-
class USERPREF_PT_navigation_fly_walk_navigation(NavigationPanel, CenterAlignMixIn, Panel):
bl_label = "Walk"
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 289caae7f94..5a64140b917 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 2
+#define BLENDER_FILE_SUBVERSION 3
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index f568f9befe9..c46fdfc5b6a 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3494,7 +3494,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->flag &= ~(OB_FLAG_UNUSED_11 | OB_FLAG_UNUSED_12);
- ob->transflag &= ~(OB_TRANSFLAG_UNUSED_0 | OB_TRANSFLAG_UNUSED_1);
+ ob->transflag &= ~(OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK | OB_TRANSFLAG_UNUSED_1);
ob->shapeflag &= ~OB_SHAPE_FLAG_UNUSED_1;
}
@@ -3663,8 +3663,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- ob->transflag &= ~(OB_TRANSFLAG_UNUSED_0 | OB_TRANSFLAG_UNUSED_1 | OB_TRANSFLAG_UNUSED_3 |
- OB_TRANSFLAG_UNUSED_6 | OB_TRANSFLAG_UNUSED_12);
+ ob->transflag &= ~(OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK | OB_TRANSFLAG_UNUSED_1 |
+ OB_TRANSFLAG_UNUSED_3 | OB_TRANSFLAG_UNUSED_6 | OB_TRANSFLAG_UNUSED_12);
ob->nlaflag &= ~(OB_ADS_UNUSED_1 | OB_ADS_UNUSED_2);
}
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 6b6d226bd90..d152230e4bf 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -800,6 +800,14 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
+ if (!USER_VERSION_ATLEAST(292, 3)) {
+ if (userdef->pixelsize == 0.0f) {
+ userdef->pixelsize = 1.0f;
+ }
+ /* Clear old userdef flag for "Camera Parent Lock". */
+ userdef->uiflag &= ~USER_UIFLAG_UNUSED_3;
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
@@ -813,10 +821,6 @@ void blo_do_versions_userdef(UserDef *userdef)
/* Keep this block, even when empty. */
}
- if (userdef->pixelsize == 0.0f) {
- userdef->pixelsize = 1.0f;
- }
-
LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) {
do_versions_theme(userdef, btheme);
}
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index 1d5b33e7b90..bce0e49d60a 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -127,8 +127,7 @@ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl)
struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- RegionView3D *rv3d,
- const bool use_parent_root)
+ RegionView3D *rv3d)
{
View3DCameraControl *vctrl;
@@ -139,7 +138,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph
vctrl->ctx_v3d = v3d;
vctrl->ctx_rv3d = rv3d;
- vctrl->use_parent_root = use_parent_root;
+ vctrl->use_parent_root = v3d->camera->transflag & OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK;
vctrl->persp_backup = rv3d->persp;
vctrl->dist_backup = rv3d->dist;
@@ -153,7 +152,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph
if (rv3d->persp == RV3D_CAMOB) {
Object *ob_back;
- if (use_parent_root && (vctrl->root_parent = v3d->camera->parent)) {
+ if (vctrl->use_parent_root && (vctrl->root_parent = v3d->camera->parent)) {
while (vctrl->root_parent->parent) {
vctrl->root_parent = vctrl->root_parent->parent;
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 6ce76c478df..6824c526888 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -392,7 +392,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
}
fly->v3d_camera_control = ED_view3d_cameracontrol_acquire(
- fly->depsgraph, fly->scene, fly->v3d, fly->rv3d, (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
+ fly->depsgraph, fly->scene, fly->v3d, fly->rv3d);
/* calculate center */
if (ED_view3d_cameracontrol_object_get(fly->v3d_camera_control)) {
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index b23b9db3211..0815850d694 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -228,8 +228,7 @@ void view3d_buttons_register(struct ARegionType *art);
struct View3DCameraControl *ED_view3d_cameracontrol_acquire(struct Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- RegionView3D *rv3d,
- const bool use_parent_root);
+ RegionView3D *rv3d);
void ED_view3d_cameracontrol_update(struct View3DCameraControl *vctrl,
const bool use_autokey,
struct bContext *C,
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 631994c9b85..3f7d6142758 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -552,7 +552,8 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV
ObjectTfmProtectedChannels obtfm;
Object *root_parent;
- if ((U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0 && (root_parent = v3d->camera->parent)) {
+ if (v3d->camera->transflag & OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK &&
+ (root_parent = v3d->camera->parent)) {
Object *ob_update;
float tmat[4][4];
float imat[4][4];
@@ -655,7 +656,8 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d,
Scene *scene = CTX_data_scene(C);
ID *id_key;
Object *root_parent;
- if ((U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0 && (root_parent = v3d->camera->parent)) {
+ if (v3d->camera->transflag & OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK &&
+ (root_parent = v3d->camera->parent)) {
while (root_parent->parent) {
root_parent = root_parent->parent;
}
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 3c9e4fa49b9..7de28096607 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -585,11 +585,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->scene, 0, walk->region, walk->v3d);
walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(
- walk->depsgraph,
- walk->scene,
- walk->v3d,
- walk->rv3d,
- (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
+ walk->depsgraph, walk->scene, walk->v3d, walk->rv3d);
/* center the mouse */
walk->center_mval[0] = walk->region->winx * 0.5f;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 112c8210460..345d1287ab1 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -508,7 +508,7 @@ enum {
/* (short) transflag */
enum {
- OB_TRANSFLAG_UNUSED_0 = 1 << 0, /* cleared */
+ OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK = 1 << 0,
OB_TRANSFLAG_UNUSED_1 = 1 << 1, /* cleared */
OB_NEG_SCALE = 1 << 2,
OB_TRANSFLAG_UNUSED_3 = 1 << 3, /* cleared */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 733b459495d..ed232d4ad89 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -1046,7 +1046,7 @@ typedef enum eUserpref_UI_Flag {
USER_HIDE_DOT = (1 << 16),
USER_SHOW_GIZMO_NAVIGATE = (1 << 17),
USER_SHOW_VIEWPORTNAME = (1 << 18),
- USER_CAM_LOCK_NO_PARENT = (1 << 19),
+ USER_UIFLAG_UNUSED_3 = (1 << 19), /* Cleared. */
USER_ZOOM_TO_MOUSEPOS = (1 << 20),
USER_SHOW_FPS = (1 << 21),
USER_UIFLAG_UNUSED_22 = (1 << 22), /* cleared */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 8b227774d66..6f7116bfe22 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2699,6 +2699,15 @@ static void rna_def_object(BlenderRNA *brna)
prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+ prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "transflag", OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK);
+ RNA_def_property_ui_text(prop,
+ "Camera Parent Lock",
+ "View Lock 3D viewport camera transformation affects the object's "
+ "parent instead");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
/* Track and Up flags */
/* XXX: these have been saved here for a bit longer (after old track was removed),
* since some other tools still refer to this */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e6821d6e4a7..f0106c3729b 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -5659,13 +5659,6 @@ static void rna_def_userdef_input(BlenderRNA *brna)
"Auto Depth",
"Use the depth under the mouse to improve view pan/rotate/zoom functionality");
- prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
- RNA_def_property_ui_text(prop,
- "Camera Parent Lock",
- "When the camera is locked to the view and in fly mode, "
- "transform the parent rather than the camera");
-
/* view zoom */
prop = RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);