Page 1 of 1

Parse property via python

Unread postPosted: Wed Apr 10, 2019 12:42 am
by pizzaia

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!



Re: Parse property via python

Unread postPosted: Fri Apr 12, 2019 8:37 am
by bvaldes

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

Re: Parse property via python

Unread postPosted: Sat Apr 27, 2019 7:55 pm
by pizzaia
Sorry for the late reply!
Thank you very much for the reply, this works like a charm! It can be super useful to drive all sort of things for geometries.