Isotropix Forums

3.5: AddParticle always gives signature error in script

Clarisse Scripting related topics

3.5: AddParticle always gives signature error in script

Unread postby atnreg » Tue Jun 13, 2017 10:49 am

Hi!

I am trying to make a simple script that creates Particle Container with normals. When I add a particle to the container using particle paint, the log shows this:
AddParticle("project://scene/obj/particle_container", (-0.225571881629223, 0.591839200439675, 3.23247483668989), (0.0242527540919755, 0.0, 0.999705858699925))

Note that ix.cmds is missing from that in the log, all other commands show full name. But according to manual the AddParticle is only found in the cmds module so it must be ix.cms.AddParticle.
But that is not all, when I try to use that SAME command in a script i.e.
ix.cmds.AddParticle("project://scene/obj/particle_container", (-0.225571881629223, 0.591839200439675, 3.23247483668989), (0.0242527540919755, 0.0, 0.999705858699925))
I get error message "No matching signature found for command 'AddParticle' with '3' arguments." :o
I also get the same error message if I try to use the log line from brush density 3 which gives this in the log:
AddParticle("project://scene/obj/particle_container", [(2.88744242442087, 0.452151155535554, 1.49957106108746), (2.86707889127584, 0.418236013019598, 1.5287524573988), (2.85665025479539, 0.444317312742067, 1.54369692562813)], [(0.820068669138885, 0.0, 0.572265129023932), (0.820068669138885, 0.0, 0.572265129023932), (0.820068669138885, 0.0, 0.572265129023932)])

Can you please explain or give simple code snippet that creates a particle container of say 3 points and with normals?
Do I understand correctly that if the particle has the normal, then I can use 'use support normals' as 100% in a scatterer to rotate the objects according to that? So I don't need to edit the particles unless I need to adjust the scale by particle?

And just additional note, the AddParticle does not work in script even with single tuple (one particle, no normals), then it gives the error of not finding signature with 2 arguments :o

I wonder how that is possible as the log shows exactly those commands :O

Thanks!

Antti
Intel i7(6-core),32GB RAM,NVIDIA GTX690 (2GPU)+GTX Titan Black,Win10Pro 64bit
Clarisse 3.5,Blender,ZBrush 4R8,(3D-Coat,Lightwave+Octane...)
Clarisse since 2016-09-29 (Py 2017-01-04), Python since 2016-11-10
I do all 3D stuff for fun, no business
atnreg
 
Posts: 231
Joined: Mon Sep 19, 2016 5:20 pm
Location: Helsinki, Finland

Re: 3.5: AddParticle always gives signature error in script

Unread postby bvaldes » Tue Jun 13, 2017 12:31 pm

Hi,

Inside of the log, when the error displayed, you should see something like this:
Code: Select all
No matching signature found for command 'AddParticle' with '2' arguments.
Found signatures:
(TYPE_STRING, TYPE_ARRAY_VEC3D)
(TYPE_STRING, TYPE_ARRAY_VEC3D, TYPE_ARRAY_VEC3D)
(TYPE_STRING, TYPE_ARRAY_VEC3D, TYPE_ARRAY_VEC3D, TYPE_ARRAY_STRING)


The found signature list is really useful because it gives you the type of object that you have to give as a parameter.

So Even if inside of the log Clarisse tell you something, most of the time the information that is displayed is transformed to be human readable.

In that case, you have to give an array of Vec3D so you have to create this kind of item:

python code

array = ix.api.GMathVec3dArray() #spefify the length inside as argument

Then you have to set the Vectors inside of this array:

python code

array = ix.api.GMathVec3dArray(10)
array[0] = ix.api.GMathVec3d(3, 3, 3)

Now your array contain a particle, you just have to run the addParticle function with this array as second argument and it will work:

python code

array = ix.api.GMathVec3dArray(1)
array[0] = ix.api.GMathVec3d(3, 3, 3)

ix.cmds.AddParticle("project://scene/particle_container", array)

About the missing "ix.cmds" in the log, this is a known bug, already in our bug tracker (#6121). This will be fixed asap.

I hope this help. Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 117
Joined: Mon Sep 26, 2016 11:44 am

Re: 3.5: AddParticle always gives signature error in script

Unread postby atnreg » Tue Jun 13, 2017 12:38 pm

Thank you very much for very fast and thorough reply :)

I didn't try your code yet but it seems clear to me so now I know how to do that :)

Just one note: the error message does NOT give the found signatures, it only says it cannot find it.

Thank you again!

Edit: your example code works perfectly, also with normals! :mrgreen:

Antti
Intel i7(6-core),32GB RAM,NVIDIA GTX690 (2GPU)+GTX Titan Black,Win10Pro 64bit
Clarisse 3.5,Blender,ZBrush 4R8,(3D-Coat,Lightwave+Octane...)
Clarisse since 2016-09-29 (Py 2017-01-04), Python since 2016-11-10
I do all 3D stuff for fun, no business
atnreg
 
Posts: 231
Joined: Mon Sep 19, 2016 5:20 pm
Location: Helsinki, Finland


Return to Scripting