PointerProperty

参考:

Object referenced by PointerProperty in Python can not be deleted properly – Blender Stack Exchange

expected a single argument エラー

現象:

クラスのインスタンスを作成しようとすると、引数の数が不一致である旨のエラーが発生する。

TypeError: bpy_struct.__new__(type): expected a single argument

対処法:

インスタンス生成用の関数を使用する。

mesh = bpy.data.meshes.new(name="New Mesh")Code language: Python (python)

参考:

Data Creation/Removal | Blender Python API [Official]

PyExc_TypeError: expected a single argument – blender/bpy_rna.c at v2.93.5 · blender/blender – GitHub

Writing is not allowed エラー

現象:

コンテキストアクセスで、プロパティを変更しようとするとエラーが発生する。

AttributeError: Writing to ID classes in this context is not allowed

参考:

AttributeError: Writing to ID classes in this context is not allowed – Blender Artists Community

How can I change a custom property value in python? – Blender Stack Exchange

Can’t change objects’ property – Writing to ID classes in this context is not allowed. location: :-1 – Blender Stack Exchange

PyExc_AttributeError: Writing to ID classes in this context is not allowed – blender/bpy_rna.c at v2.93.5 · blender/blender – GitHub

no attribute scene エラー

現象:

初期化が完了していない段階で bpy.centext.scene にアクセスするとエラーが発生する。

AttributeError: '_RestrictContext' object has no attribute 'scene'

参考:

Accessing bpy.context gives a ‘_RestrictContext’ warning, how to fix this? – Blender Stack Exchange

AttributeError: ‘_RestrictContext’ object has no attribute ‘scene’ – Stack Overflow

already registered as a subclass

現象:

アドオンを有効化する際に、サブクラスとして既に登録されている旨のエラーが発生する。

ValueError register_class(...) already registered as a subclass

原因:

  • 該当するアドオンが壊れている。
  • アドオンの初期化に失敗し、再度有効化しようとした際に発生する。その場合は Blender の再起動が必要。

対処法:

  • register / unregister 関数において、register_class 及び unregister_class を呼び出す記述の整合性が取れているか確認する。

参考:

Error “register_class(…): already registered as a subclass” – Blender Artists Community

Class already registered as subclass? – Blender Stack Exchange

プロパティが表示/設定できない

カスタムプロパティは IDBonePoseBone 及びその派生クラスにのみ追加できる。

Custom properties can be added to any subclass of an ID, Bone and PoseBone.

── Blender Python API

参考:

TypeError: UILayout.prop() when trying to display custom settings in a menu – Blender Stack Exchange

missing bl_rna attribute エラー

現象:

Pointer Property の定義時に、bl_rna 属性が見つからない旨のエラーが発生する。

TypeError: PointerProperty(...) expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

原因:

  • ポインタープロパティが指す型が登録されていない?

対処法:

  • ポインタープロパティが指す型を登録する。

参考:

Can’t register property group – Blender Stack Exchange

Setting custom prop to Sequences – Blender Developer Talk

getting error on IDPropertyGroup and PointerProperty – Blender Artists Community

コード:

RNAMetaPropGroup – bpy_types.py at b08c5381ac – GitHub

property not found エラー

現象:

プロパティが見つからない旨のエラーが発生する。

rna_uiItemR: property not found: TypeName.prop_name

原因:

  • パネルにプロパティを定義しようとした。
  • パネルにはプロパティは定義できない。

対処法:

  • シーンにプロパティを定義する。
  • プロパティを定義できる対象を確認する。

参考:

rna_uiItemR: property not found – Blender Artists Community

without __addon_enabled__ field 警告

アドオンモジュールに __addon_enabled__ フィールドが見つからない旨の警告が発生する。

Warning: addon-module xxx found module but without '__addon_enabled__' field, possible name collision from file: C:\path\to\addon\file.py

コード:

Warning – addon_utils.py at v4.0.2 – GitHub

参考:

found module but without __addon_enabled__ – Blender Artists Community

アクセス違反例外

アクセス違反例外が発生して Blender が強制終了する。

Error : EXCEPTION_ACCESS_VIOLATION

ドキュメント:

faulthandler – Dump the Python Traceback | Python 3.x Documentation [Official]

参考:

落とし穴 #9 | MR が楽しい

Debugging mode? – Blender Artists Community

Blender crashes during script execution – Blender Developer Forum

Blender keeps crashing while I’m debugging scripts – reddit

Getting a stack trace when addon crashes Blender – Blender Stack Exchange

Why does my Python script crash Blender? – Blender Stack Exchange

Blender crashes when render call back calls render – Blender Stack Exchange

Tips

Gotchas | Blender Python API [Official]

記事をシェアする:
タグ:

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Protected by reCAPTCHA