Isotropix Forums

If there's any way can get custom attributes in abc

General Discussion about Isotropix and CG related topics

If there's any way can get custom attributes in abc

Unread postby cc_guodong » Thu Mar 29, 2018 4:43 am

We have some custom attributes in abc file(add and export from maya), if there's any way that we can get them in clarisse?
cc_guodong
 
Posts: 13
Joined: Mon Jun 06, 2016 4:17 am

Re: If there's any way can get custom attributes in abc

Unread postby dboude » Thu Mar 29, 2018 8:34 am

Hi,

It depends on the nature of the attributes but you can retrieve them with a texture extract property node. However, if you are dealing with a string you will have to write a script.

Cheers ;)
Démian
Isotropix
Technical Artist - Clarisse Specialist
User avatar
dboude
 
Posts: 595
Joined: Mon Jul 03, 2017 10:51 am

Re: If there's any way can get custom attributes in abc

Unread postby cc_guodong » Fri Mar 30, 2018 9:31 am

dboude wrote:Hi,

It depends on the nature of the attributes but you can retrieve them with a texture extract property node. However, if you are dealing with a string you will have to write a script.

Cheers ;)


Yes they are strings, you mean I have to use Alembic API to read them right, no method from clarisse API?
Do you have some plans to add those attribute values into Clarisse' custom Attribute field?
cc_guodong
 
Posts: 13
Joined: Mon Jun 06, 2016 4:17 am

Re: If there's any way can get custom attributes in abc

Unread postby bvaldes » Tue Apr 03, 2018 8:15 am

Hi,

The custom attributes from Maya are not attributes in Clarisse: they are properties. To use these properties, you have to use a node called Extract Property and then texture the attribute you want with this node. The issue is that you can't texture something with string properties.
The properties are colors (for a bool it's black or white for example).

With Python, you have the ability to get these properties (I tried only on a Point Cloud so I don't know how to do it on a geo). Then if you want you can create a custom attribute in Clarisse and set the data you have extracted in the new attribute.

You didn't explain what you want, so it's hard for us to give you a specific answer. Could you please give us more information about what you are trying to do?

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 287
Joined: Mon Sep 26, 2016 10:44 am

Re: If there's any way can get custom attributes in abc

Unread postby bruce » Tue Apr 03, 2018 3:35 pm

Hi,

Keep in mind that to be able to read an attribute from Maya in Clarisse you must add it to the shape node !

Cheers.
Bruce
Isotropix
Technical Artist - Clarisse Specialist
User avatar
bruce
 
Posts: 206
Joined: Fri May 20, 2016 11:11 am

Re: If there's any way can get custom attributes in abc

Unread postby Braden99 » Tue Dec 04, 2018 6:24 am

Hey

I'm also struggling with how to extract custom Property values on a GeometryAbcMesh item.

For example if I have a property of char type and size and count of 1, called my_property_path on the GeometryAbcMesh.

module = item.get_module()
property = module.get_property('my_property_path')
print(property.get_value_count(), property.get_value_extent())
# (1, 1)


And another property of float64 type and size of 6 and count of 1, called my_property_size_six on the GeometryAbcMesh.

module = item.get_module()
property = module.get_property('my_property_size_six')
print(property.get_value_extent(), property.get_value_count())
# (6, 1)


And another property of int32 type and size of 1 and count of 220220, called .faceIndices on the GeometryAbcMesh.

module = item.get_module()
property = module.get_property('.faceIndices')
print(property.get_value_extent(), property.get_value_count())
# (1, 220220)


But how do you extract all the values with Python?
I tried this, and Clarisse crashes.
ix.api.IOHelpers.get_particles_property(item, 'my_property_path', 0)

The GeometryProperty class in C++ has a very large evaluate method, do i need to call this?
Otherwise maybe something to do with the time sampling object of the property?

Note: I also tried getting the geometry point cloud (of GeometryAbcMesh), and I can get point positions, normals and velocties like this, but seemingly not other custom property data.

Cheers
Braden
Braden99
 
Posts: 19
Joined: Mon Jan 08, 2018 3:05 am

Re: If there's any way can get custom attributes in abc

Unread postby desmond » Thu Dec 06, 2018 4:06 pm

A quick workraround (pseudocode) for this could be (and a very nice python challenge but im on lunch pause and dont have time to write this myself, maybe someone in need will find it instructional/guidance):

lets say i want: store some paths (string) and some span info for each geometry so i can load that back up to clarisse and fill in what we need (print strings, push spans info fo subdiv)

- write a python script in houdini which stores all what you want in a external file, lets name it model_data.
This script should save our attributes to an external file, so the code could look like this:
for each geo in geometries:
get me atrib paths and spans,
file open, write, the name of the shape + paths and spans, separated with a common delimiter lets say "," since paths(string) should not contain any ',' and spans is a number (int). Our output should look like this:
geoshapebox,somepath_formated_like_string1,6
geoshapebox2,somepath_formated_like_string2,2 etc.
close the file. We should be done here. Add whatever you want here, it will come out in clarisse just fine

this piece of code will save what you need in a text file you can open and edit and check if all is ok.


for the spans we can check in Log in clarisse and log gives us this:
>>> ix.cmds.SetValues(["project://scene/polygrid.displacement_adaptive_span_count"], ["10"]),


So for spans we need to replace the commands value to our value fro the file. Since our geo is named as it should be, and we know clarisse ads Shape to the geo name we can for sure know that we can load the name of the shape as a string and add "Shape" and we can select that object trough python. Lets work:

Import your abc in a context you know where it is (so you can hardcode it for now)
-write a python script for clarisse to ingest the data back and setup what you want. Load model_data and :
for each line in model_data we want to check the geo and set it up, like so:
using split and the delimiter we setup in houdini we can gat everything from the line like this:
geo_shape_name = line.split(',')[0], geo_path = line.split(',')[1] and spans = line.split(',')[2], now we have mapped all our stuff we wrote in houdini. Next is putting that into spans with ix.cdms.setvalues on the selected object. Fill in the geoshape name instead of polygrid, and if you manualy places your file in a context that would be ideal (easier to work with).
Press run and voila, if you have written the code and runs without error everything should work just fine. The geoshapes spans are modified and all is working smoothly :)

As for the paths, do as you wish, same logic for spans aplies to it.

Here we could just write a function which parses the file and does everything for us but that is for polishing, this is just quick and dirty way of transfering data between any apps in python, the basic code can be reused, app specific code ofcoruse will need to be changed.

Hope this hints help to any begginer stuck how to do this kind of stuff.
If im not clear or anything write me, and ill correct / edit the help part.

des
User avatar
desmond
 
Posts: 12
Joined: Mon Feb 05, 2018 8:46 am

Re: If there's any way can get custom attributes in abc

Unread postby sam » Fri Dec 07, 2018 9:04 pm

Hi Braden,

Right now, only the point cloud properties are exposed to Python. This should be available in Clarisse 3.6 SP7.
Cheers,
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1174
Joined: Fri Jan 25, 2013 11:33 pm

Re: If there's any way can get custom attributes in abc

Unread postby Braden99 » Mon Dec 10, 2018 5:34 am

Yes I was only wanting a direct way to extract custom Property values on a GeometryAbcMesh item.

Otherwise I guess we would currently need to use Alembic Python API to do this manually, which seems like a hassle, when Clarisse seemingly has a handle to the data.
Last edited by Braden99 on Mon Dec 10, 2018 8:04 pm, edited 1 time in total.
Braden99
 
Posts: 19
Joined: Mon Jan 08, 2018 3:05 am

Re: If there's any way can get custom attributes in abc

Unread postby purchasemediamonks » Mon Dec 10, 2018 12:17 pm

I have the same issue. Can you tell us maybe when SP7 will be available? Thank you.
purchasemediamonks
 
Posts: 13
Joined: Wed Jan 25, 2017 10:03 am


Return to General Discussion