Update for Depsgraph API changes
Reviewers: sergey Differential Revision: https://developer.blender.org/D4883
This commit is contained in:
parent
b455cbf6b1
commit
222969e380
|
@ -527,7 +527,7 @@ def discombobulate(self, minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3
|
|||
|
||||
bpy.ops.object.select_pattern(pattern=object1.name, extend=False)
|
||||
bpy.context.view_layer.objects.active = bpy.data.objects[object1.name]
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
# translate, scale and rotate discombobulated results
|
||||
object1.location = to_translate
|
||||
|
|
|
@ -556,10 +556,10 @@ def add_worm(teethNum, rowNum, radius, Ad, De, p_angle,
|
|||
#### Delete object
|
||||
def ObjectDelete(self, context, delete):
|
||||
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
bpy.ops.object.delete()
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
return
|
||||
|
||||
|
@ -765,7 +765,7 @@ class AddGear(Operator):
|
|||
|
||||
##### INVOKE #####
|
||||
def invoke(self, context, event):
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
if self.change:
|
||||
bpy.context.scene.cursor.location = self.startlocation
|
||||
else:
|
||||
|
@ -960,7 +960,7 @@ class AddWormGear(Operator):
|
|||
|
||||
##### INVOKE #####
|
||||
def invoke(self, context, event):
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
if self.change:
|
||||
bpy.context.scene.cursor.location = self.startlocation
|
||||
else:
|
||||
|
@ -970,4 +970,4 @@ class AddWormGear(Operator):
|
|||
|
||||
self.execute(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
return {'FINISHED'}
|
||||
|
|
|
@ -50,10 +50,10 @@ def align_matrix(context, location):
|
|||
#### Delete object
|
||||
def ObjectDelete(self, context, delete):
|
||||
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
bpy.ops.object.delete()
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
return
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ class GenerateGeodesicDome(Operator):
|
|||
#bpy.ops.view3d.snap_cursor_to_center()
|
||||
if geodesic_not_yet_called:
|
||||
geodesic_not_yet_called = False
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
if self.change:
|
||||
bpy.context.scene.cursor.location = self.startlocation
|
||||
else:
|
||||
|
|
|
@ -45,7 +45,7 @@ def center_obs_for_thumbnail(obs):
|
|||
parent = parent.parent
|
||||
# reset parent rotation, so we see how it really snaps.
|
||||
parent.rotation_euler = (0, 0, 0)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
minx, miny, minz, maxx, maxy, maxz = utils.get_bounds_worldspace(obs)
|
||||
|
||||
cx = (maxx - minx) / 2 + minx
|
||||
|
@ -87,7 +87,7 @@ if __name__ == "__main__":
|
|||
main_object, allobs = append_link.append_objects(file_name=BLENDERKIT_EXPORT_FILE_INPUT,
|
||||
obnames=obnames,
|
||||
link=True)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
camdict = {
|
||||
'GROUND': 'camera ground',
|
||||
|
@ -128,7 +128,7 @@ if __name__ == "__main__":
|
|||
= data['thumbnail_background_lightness']
|
||||
s.cycles.samples = data['thumbnail_samples']
|
||||
bpy.context.view_layer.cycles.use_denoising = data['thumbnail_denoising']
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
# import blender's HDR here
|
||||
hdr_path = Path('datafiles/studiolights/world/interior.exr')
|
||||
|
|
|
@ -521,7 +521,7 @@ def bvh_node_dict2armature(
|
|||
# Quats default
|
||||
pass
|
||||
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
arm_ob.animation_data_create()
|
||||
action = bpy.data.actions.new(name=bvh_name)
|
||||
|
|
|
@ -984,7 +984,7 @@ def triangulate_mesh(object):
|
|||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
me_ob.data = bpy.data.meshes.new_from_object(object.evaluated_get(depsgraph)) # write data object
|
||||
bpy.context.collection.objects.link(me_ob)
|
||||
bpy.context.scene.update()
|
||||
view_layer.update()
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
for i in scene.objects:
|
||||
|
@ -999,7 +999,7 @@ def triangulate_mesh(object):
|
|||
bpy.ops.mesh.select_all(action='SELECT') # select all the face/vertex/edge
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
bpy.ops.mesh.quads_convert_to_tris()
|
||||
bpy.context.scene.update()
|
||||
view_layer.update()
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ def triangulate_mesh(object):
|
|||
verbose("Triangulated mesh")
|
||||
|
||||
me_ob.data = bpy.data.meshes.new_from_object(me_ob.evaluated_get(depsgraph)) # write data object
|
||||
bpy.context.scene.update()
|
||||
view_layer.update()
|
||||
return me_ob
|
||||
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ def parse_animation(armature, udk_bones, actions_to_export, psa):
|
|||
# apply action to armature and update scene
|
||||
# note if loop all actions that is not armature it will override and will break armature animation
|
||||
armature.animation_data.action = action
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
# min/max frames define range
|
||||
framemin, framemax = action.frame_range
|
||||
|
@ -2048,7 +2048,7 @@ class OBJECT_OT_UTSelectedFaceSmooth(Operator):
|
|||
flatcount += 1
|
||||
face.select = False
|
||||
mesh.to_mesh(obj.data)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
print("Select Smooth Count(s):", smoothcount, " Flat Count(s):", flatcount)
|
||||
bselected = True
|
||||
|
@ -2163,7 +2163,7 @@ def rebuildmesh(obj):
|
|||
|
||||
me_ob.update() # need to update the information to able to see into the secne
|
||||
obmesh = bpy.data.objects.new(("Re_" + obj.name), me_ob)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
# Build tmp materials
|
||||
materialname = "ReMaterial"
|
||||
|
@ -2189,7 +2189,7 @@ def rebuildmesh(obj):
|
|||
matcount += 1
|
||||
|
||||
print("Mesh Object Name:", obmesh.name)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
return obmesh
|
||||
|
||||
|
@ -2628,7 +2628,7 @@ def udkcheckmeshline():
|
|||
break
|
||||
bpy.ops.object.mode_set(mode='EDIT') # set in edit mode to see the select vertex
|
||||
objmesh.data.update() # update object
|
||||
bpy.context.scene.update() # update scene
|
||||
bpy.context.view_layer.update() # update scene
|
||||
message = "MESH PASS"
|
||||
if len(vertex_list) > 0:
|
||||
message = "MESH FAIL"
|
||||
|
|
|
@ -635,10 +635,10 @@ class Do:
|
|||
obj.location = transformation @ obj.location
|
||||
obj.rotation_euler.rotate(transformation)
|
||||
|
||||
def _bbox(self, objects, scene):
|
||||
def _bbox(self, objects):
|
||||
xmin = ymin = zmin = float('+inf')
|
||||
xmax = ymax = zmax = float('-inf')
|
||||
scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
for obj in objects:
|
||||
om = obj.matrix_basis
|
||||
|
@ -672,8 +672,8 @@ class Do:
|
|||
|
||||
return xmin, ymin, zmin, xmax, ymax, zmax
|
||||
|
||||
def _object_bbox(self, objects, scene, name, do_widgets=True):
|
||||
xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(objects, scene)
|
||||
def _object_bbox(self, objects, name, do_widgets=True):
|
||||
xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(objects)
|
||||
|
||||
# creating bbox geometry
|
||||
bm = bmesh.new()
|
||||
|
@ -879,7 +879,7 @@ class Do:
|
|||
# determining the main object o
|
||||
if len(objects) > 1 or len(insert_bounding_boxes) > 0:
|
||||
if self.do_bounding_boxes:
|
||||
o = self._object_bbox(objects + insert_bounding_boxes, scene, name, recursion_level == 0)
|
||||
o = self._object_bbox(objects + insert_bounding_boxes, name, recursion_level == 0)
|
||||
scene.collection.objects.link(o)
|
||||
else:
|
||||
o = bpy.data.objects.new(name, None)
|
||||
|
@ -986,7 +986,7 @@ class Do:
|
|||
i = self.insert(INSERT, block_scene, None, block_group, invisible, recursion_level + 1, True)
|
||||
inserts.append(i)
|
||||
|
||||
bbox = self._object_bbox(objects + inserts, block_scene, name, True)
|
||||
bbox = self._object_bbox(objects + inserts, name, True)
|
||||
|
||||
for i in inserts:
|
||||
sub_group = i.instance_collection
|
||||
|
@ -1398,12 +1398,12 @@ class Do:
|
|||
|
||||
def _recenter(self, scene, name):
|
||||
bpy.context.screen.scene = scene
|
||||
scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
|
||||
recenter_objects = (o for o in scene.objects if "BEVEL" not in o.name and "TAPER" not in o.name
|
||||
and o not in self.objects_before)
|
||||
xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(recenter_objects, scene)
|
||||
xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(recenter_objects)
|
||||
vmin = Vector((xmin, ymin, zmin))
|
||||
vmax = Vector((xmax, ymax, zmax))
|
||||
center = vmin + (vmax - vmin) / 2
|
||||
|
|
|
@ -598,7 +598,7 @@ def setup_compositing(context, plane, img_spec):
|
|||
axis_fcurve.is_valid = True
|
||||
driver.expression = "%s" % driver.expression
|
||||
|
||||
scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -893,7 +893,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||
# Create individual planes
|
||||
planes = [self.single_image_spec_to_plane(context, img_spec) for img_spec in images]
|
||||
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
# Align planes relative to each other
|
||||
if self.offset:
|
||||
|
|
|
@ -1207,7 +1207,7 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
|
|||
ob_dict[ob_key][0].parent= parent_ob[0]
|
||||
ob_dict[ob_key][0].location-= parent_ob[0].location
|
||||
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
print("Done Importing LWO File")
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
|
|||
else:
|
||||
newbone.roll = math.radians(-90.0)
|
||||
"""
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
#==================================================================================================
|
||||
#END BONE DATA BUILD
|
||||
|
@ -698,7 +698,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
|
|||
#bpy.context.scene.objects.active = ob_new
|
||||
me_ob.update()
|
||||
bpy.context.collection.objects.link(obmesh)
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
obmesh.select_set(False)
|
||||
ob_new.select_set(False)
|
||||
obmesh.select_set(True)
|
||||
|
@ -959,7 +959,7 @@ def psaimport(filename,context):
|
|||
Group = raw_action[1]
|
||||
Totalbones = raw_action[2]
|
||||
NumRawFrames = raw_action[3]
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
object = bpy.data.objects['ArmObject']
|
||||
object.animation_data_create()
|
||||
action = bpy.data.actions.new(name=Name)
|
||||
|
@ -995,7 +995,7 @@ def psaimport(filename,context):
|
|||
bone.keyframe_insert("location")
|
||||
|
||||
def whirlSingleBone(pose_bone,quat):
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
#record child's matrix and origin rotate
|
||||
hymat = Quaternion((0.707, -0.707, 0, 0)).inverted().to_matrix().to_4x4()
|
||||
children_infos = {}
|
||||
|
@ -1011,7 +1011,7 @@ def psaimport(filename,context):
|
|||
pose_bone.matrix *= quat.to_matrix().to_4x4()
|
||||
pose_bone.keyframe_insert("location")
|
||||
pose_bone.keyframe_insert("rotation_quaternion")
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
#set back children bon to original position
|
||||
#reverse whirl child bone by quat.inverse()
|
||||
|
||||
|
|
|
@ -945,7 +945,7 @@ def load_3ds(filepath,
|
|||
ob.sel = 1
|
||||
"""
|
||||
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
axis_min = [1000000000] * 3
|
||||
axis_max = [-1000000000] * 3
|
||||
|
|
|
@ -3182,7 +3182,8 @@ def save(operator, context,
|
|||
scene.unit_settings.system_rotation = best_src_scene.unit_settings.system_rotation
|
||||
scene.unit_settings.scale_length = best_src_scene.unit_settings.scale_length
|
||||
|
||||
scene.update()
|
||||
# new scene [only one viewlayer to update]
|
||||
scene.view_layers[0].update()
|
||||
# TODO - BUMMER! Armatures not in the group wont animate the mesh
|
||||
else:
|
||||
scene = data
|
||||
|
|
|
@ -216,7 +216,7 @@ def __gather_mesh(blender_object, export_settings):
|
|||
edge_split.split_angle = blender_object.data.auto_smooth_angle
|
||||
edge_split.use_edge_angle = not blender_object.data.has_custom_normals
|
||||
blender_object.data.use_auto_smooth = False
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
armature_modifiers = {}
|
||||
if export_settings[gltf2_blender_export_keys.SKINS]:
|
||||
|
|
|
@ -189,7 +189,7 @@ class BlenderNode():
|
|||
obj.select_set(True)
|
||||
bpy.data.objects[node.blender_armature_name].select_set(True)
|
||||
bpy.context.view_layer.objects.active = bpy.data.objects[node.blender_armature_name]
|
||||
bpy.context.scene.update()
|
||||
bpy.context.view_layer.update()
|
||||
bpy.ops.object.parent_set(type='BONE_RELATIVE', keep_transform=True)
|
||||
# From world transform to local (-armature transform -bone transform)
|
||||
bone_trans = bpy.data.objects[node.blender_armature_name] \
|
||||
|
|
|
@ -409,7 +409,7 @@ class Ms3dImportOperator(Operator, ImportHelper):
|
|||
self.filepath
|
||||
)
|
||||
if finished:
|
||||
blender_context.scene.update()
|
||||
blender_context.view_layer.update()
|
||||
return {"FINISHED"}
|
||||
return {"CANCELLED"}
|
||||
|
||||
|
@ -618,7 +618,7 @@ class Ms3dExportOperator(Operator, ExportHelper):
|
|||
self.filepath
|
||||
)
|
||||
if finished:
|
||||
blender_context.scene.update()
|
||||
blender_context.view_layer.update()
|
||||
return {"FINISHED"}
|
||||
return {"CANCELLED"}
|
||||
|
||||
|
|
|
@ -3585,7 +3585,7 @@ def load_web3d(
|
|||
c.parent = parent
|
||||
|
||||
# update deps
|
||||
bpyscene.update()
|
||||
bpycontext.view_layer.update()
|
||||
del child_dict
|
||||
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ def cell_fracture_objects(context, obj,
|
|||
|
||||
from . import fracture_cell_calc
|
||||
collection = context.collection
|
||||
scene = context.scene
|
||||
view_layer = context.view_layer
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# GET POINTS
|
||||
|
@ -296,10 +296,10 @@ def cell_fracture_objects(context, obj,
|
|||
slot_dst.material = slot_src.material
|
||||
|
||||
if use_debug_redraw:
|
||||
scene.update()
|
||||
view_layer.update()
|
||||
_redraw_yasiamevil()
|
||||
|
||||
scene.update()
|
||||
view_layer.update()
|
||||
|
||||
# move this elsewhere...
|
||||
for obj_cell in objects:
|
||||
|
@ -404,7 +404,7 @@ def cell_fracture_boolean(context, obj, objects,
|
|||
|
||||
objects_boolean[:] = [obj_cell for obj_cell in scene.objects if obj_cell.select]
|
||||
|
||||
scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
return objects_boolean
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ def bmesh_check_thick_object(obj, thickness):
|
|||
|
||||
# Create a real mesh (lame!)
|
||||
context = bpy.context
|
||||
scene = context.scene
|
||||
layer = context.view_layer
|
||||
layer_collection = context.layer_collection or layer.active_layer_collection
|
||||
scene_collection = layer_collection.collection
|
||||
|
@ -181,7 +180,7 @@ def bmesh_check_thick_object(obj, thickness):
|
|||
base.layers_from_view(context.space_data)
|
||||
'''
|
||||
|
||||
scene.update()
|
||||
layer.update()
|
||||
ray_cast = obj_tmp.ray_cast
|
||||
|
||||
EPS_BIAS = 0.0001
|
||||
|
@ -217,7 +216,7 @@ def bmesh_check_thick_object(obj, thickness):
|
|||
bpy.data.objects.remove(obj_tmp)
|
||||
bpy.data.meshes.remove(me_tmp)
|
||||
|
||||
scene.update()
|
||||
layer.update()
|
||||
|
||||
return array.array('i', faces_error)
|
||||
|
||||
|
@ -286,7 +285,7 @@ def object_merge(context, objects):
|
|||
|
||||
obj_eval.to_mesh_clear()
|
||||
|
||||
scene.update()
|
||||
layer.update()
|
||||
|
||||
# return new object
|
||||
return obj_base
|
||||
|
|
|
@ -115,8 +115,8 @@ class ExtractWavOperator(Operator):
|
|||
cache=False
|
||||
)
|
||||
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
|
||||
newstrip = context.scene.sequence_editor.active_strip
|
||||
|
||||
|
@ -125,8 +125,8 @@ class ExtractWavOperator(Operator):
|
|||
if i.name != newstrip.name:
|
||||
i.select = False
|
||||
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
|
||||
# Match the original clip's length
|
||||
newstrip.frame_start = strip.frame_start - strip.animation_offset_start
|
||||
|
@ -249,8 +249,8 @@ class ExternalAudioReloadOperator(Operator):
|
|||
cache=False
|
||||
)
|
||||
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
|
||||
newstrip = context.scene.sequence_editor.active_strip
|
||||
|
||||
|
@ -259,8 +259,8 @@ class ExternalAudioReloadOperator(Operator):
|
|||
if i.name != newstrip.name:
|
||||
i.select = False
|
||||
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
|
||||
# trim sound strip like original one
|
||||
functions.triminout(newstrip,
|
||||
|
|
|
@ -326,7 +326,7 @@ class OBJECT_OT_Metapaste(Operator): # Operator paste source in/out
|
|||
bpy.ops.sequencer.snap(frame=scene.frame_current)
|
||||
strips = context.selected_editable_sequences
|
||||
context.scene.sequence_editor.active_strip = strips[0]
|
||||
context.scene.update()
|
||||
context.view_layer.update()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
|
|
@ -175,8 +175,8 @@ class CreateProxyOperator(Operator):
|
|||
commands = create_proxy(context, strip, self.size, res)
|
||||
|
||||
if commands is None:
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
newstrip = context.scene.sequence_editor.active_strip
|
||||
|
||||
# deselect all other strips
|
||||
|
@ -184,8 +184,8 @@ class CreateProxyOperator(Operator):
|
|||
if i.name != newstrip.name:
|
||||
i.select = False
|
||||
|
||||
# Update scene
|
||||
context.scene.update()
|
||||
# Update view_layer
|
||||
context.view_layer.update()
|
||||
else:
|
||||
create_proxy_scripts(proxy_scripts_path, commands, strip.name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue