non vorrei lavorare

昔はおもにプログラミングやガジェット系、今は?

Blender2.80betaにしたら、Pythonのスクリプトが動かなくなって対応した件

こんばんは、@kjunichiです。 この記事は、@kjunichiの2018年パーソナルアドベントカレンダーの13日目の記事です。

背景

Blender 2.80betaをようやくmacOSで試したところ、以前の記事のPythonスクリプトが動かなくなった。

abrakatabura.hatenablog.com

Blender 2.80betaでPythonスクリプトがエラーでまくり

python bpy.context.scene.objects.link(obj)がエラー

以下のように記述する事で対応できた。

bpy.context.scene.collection.objects.link(obj)

python bpy.context.scene.objects.active = bpy.data.objects[objName]がエラー

以下のように記述する事で対応できた。

bpy.context.view_layer.objects.active = bpy.data.objects[objName]

python bpy.ops.object.editmode_toggle()がエラー

以下のように記述する事で対応できた。

bpy.ops.object.mode_set(mode='EDIT')

f:id:kjw_junichi:20181213205637p:plain

関連記事

14年前の記事

13年前の記事

6年前の記事

4年前の記事

3年前の記事

2年前の記事

1年前の記事