[Bf-committers] How to create bpy_prop_collection for a particular type?
Anthony LAU
lauliullt at yahoo.com
Tue Apr 19 03:27:02 CEST 2011
Hi!
This was sent as a follow-up to this old mail I sent almost 2 weeks ago.
http://web.archiveorange.com/archive/v/1bjALgeMrd68xjNLOS02
Roughly I could now be able to get over the polling problem for
using bpy.ops.sculpt.brush_stroke() by implementing it in a simple
modal operator class and run it when the View_3D is set to Sculpt Mode.
I also have some ideas how to use OperatorStrokeElement to define new property into the
scene.
Here is the testing script:
http://www.pasteall.org/20953/python
The script may appear odd that I use mouse coordinates to feed into the sculpting brush.
This is just a test trial as I will supply a new set of coordinates from other input
source.
However, I still failed to match the required input type for the "stroke" parameter. I
often encountered such error messages:
====================================================================================
<YOUR BLENDER DIRECTORY>\2.57\scripts\module\bpy\ops.py", line 179, in __call__
ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: SCULPT_OT_brush_stroke.stroke
expected a each sequence member to be a dict for an RNA collection, not XXX
====================================================================================
I'm confused to these error remarks and variations... XXX can be ranging from "tuple",
"str", "dict" or "OperatorStrokeElement", etc. They seem to relate to how I defined and
used the custom property:
If I tried to use a CollectionProperty term of OperatorStrokeElement type (defined in
register())
OR
If I introduced a dict instance to store readings temporarily from CollectionProperty term
instead...
You can find out the exact errors by commenting and uncommenting some of the python
statements.
As a whole, it complaint me for supplying the wrong type of parameters to match the
required bpy_prop_collection term at all. Honestly, what I should do to create this
required [b]bpy_prop_collection[/b] of OperatorStrokeElement type for the "stroke"
parameter?
Is it possible to access such RNA collection from Blender? (as I'm not sure if they are all
read-only). As still being new to Blender Python and the API didn't review everything, I'm
totally stuck.
Hope this time I provided sufficient materials for people to look into my problem. Look forwards to your kind replies soon.
Anthony
More information about the Bf-committers
mailing list