Isotropix Forums

Parse property via python

Clarisse Scripting related topics

Parse property via python

Unread postby pizzaia » Wed Apr 10, 2019 12:42 am

Hi,

Is it possible to print the value of a property via python?

I have an attribute I added to a curve in maya, I can see it in the extract property node, but I want to parse the value via python to drive the segment count of the spline in clarisse.

Basically my issue is that you can drive the width of the curve by saving a width attribute in the shape of the curve, that's read by clarisse when you import the abc, but I need to drive the segment count, as I have segments that are square shapes but in clarisse if I don't set the exact number of spans it tries to smooth the corners.

If a solution to the segment count exists I'm happy to use that instead!

Cheers!

Gianluca
pizzaia
 
Posts: 1
Joined: Thu Sep 29, 2016 11:50 am

Re: Parse property via python

Unread postby bvaldes » Fri Apr 12, 2019 8:37 am

Hi,

Sorry for the late reply. This is indeed not possible without python. Moreover, If you have different curve in your abc with different segment_count, the tricks won't work.
There is an example to get the property through python. the segm_count string represent the name of the property I a, looking for, you can set the one corresponding to your property.

python code

item = ix.get_item("project://scene/Custom_Attribute_On_Curve/curveShape1")

collection = item.get_module().get_properties()
property = ""
for i in range(collection.get_property_count()):
property = collection.get_property(i)
if property.get_name() == "segm_count":
ressource = property.get_values_property(0)
print ressource.get_int(0).get_item(0)


Best regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 361
Joined: Mon Sep 26, 2016 10:44 am


Return to Scripting