Object Mode: move to workspace struct

- Read-only access can often use EvaluationContext.object_mode
- Write access to go to WorkSpace.object_mode.
- Some TODO's remain (marked as "TODO/OBMODE")
- Add-ons will need updating
  (context.active_object.mode -> context.workspace.object_mode)
- There will be small/medium issues that still need resolving
  this does work on a basic level though.

See D3037
This commit is contained in:
2018-02-08 21:14:26 +11:00
parent 14a19fed78
commit 345c6298e9
89 changed files with 691 additions and 516 deletions

View File

@@ -57,9 +57,10 @@ def path_add_property(path, prop):
# selected objects (active object must be in object mode)
def RKS_POLL_selected_objects(ksi, context):
workspace = context.workspace
ob = context.active_object
if ob:
return ob.mode == 'OBJECT'
return workspace.object_mode == 'OBJECT'
else:
return bool(context.selected_objects)
@@ -67,8 +68,9 @@ def RKS_POLL_selected_objects(ksi, context):
# selected bones
def RKS_POLL_selected_bones(ksi, context):
# we must be in Pose Mode, and there must be some bones selected
workspace = context.workspace
ob = context.active_object
if ob and ob.mode == 'POSE':
if ob and workspace.object_mode == 'POSE':
if context.active_pose_bone or context.selected_pose_bones:
return True
@@ -87,8 +89,9 @@ def RKS_POLL_selected_items(ksi, context):
# all selected objects or pose bones, depending on which we've got
def RKS_ITER_selected_item(ksi, context, ks):
workspace = context.workspace
ob = context.active_object
if ob and ob.mode == 'POSE':
if ob and workspace.object_mode == 'POSE':
for bone in context.selected_pose_bones:
ksi.generate(context, ks, bone)
else: