Isotropix Forums

Attribute tooltip / documentation

Clarisse Scripting related topics

Attribute tooltip / documentation

Unread postby Braden99 » Wed Jan 09, 2019 6:52 am

Hey

It doesn't appear to be possible to set any attribute tooltips / description using Clarisse Python modules, even custom attributes.

Am I missing something obvious?

Having tooltips is important for custom pipeline specific attributes.

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

Re: Attribute tooltip / documentation

Unread postby bvaldes » Wed Jan 09, 2019 11:52 am

Hi,

Adding a documentation string to a custom attribute is not possible for now. More over if you are using ScriptedClass, you can add documentation to you arribute by using the CID syntax. I've added a feature request () you should be notified by mail if it's approved.

About the scripted class you can find some usage example on the forum. Take a look to the following links:
viewtopic.php?f=21&t=3788&p=15666&hilit=ScriptedClass#p15666
viewtopic.php?f=21&t=2906&p=11808&hilit=ScriptedClass#p11806

To have more information about CID take a look to the SDK documentation (only availlable on your local documentation)L press F in Clarisse > Reference > Scripting API > Introduction to CID syntax

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

Re: Attribute tooltip / documentation

Unread postby Braden99 » Wed Jan 09, 2019 9:16 pm

Thanks Benoit.

There are cases where custom attributes might be added to existing classes, for example to a Image or Layer. It would be great if these attributes could also be documented / have tooltips.
Braden99
 
Posts: 50
Joined: Mon Jan 08, 2018 3:05 am

Re: Attribute tooltip / documentation

Unread postby bvaldes » Thu Jan 10, 2019 9:42 am

Hi,

After more investigation, there is no function to do that but by editing your .project, you can add a doc to your attribute.
I've created a polysphere with a custom attribute called my_custom_attribute. I've saved my project and opened the file in a text editor. Then I found the line where my attribute is declared. That should be something like that:
Code: Select all
custom_attributes {
    attribute_group "custom" {
        distance "my_custom_attribute" {
            value 0.0
        }
    }
}

I've then added between the semicolon my documentation. At the end that looks like that:
Code: Select all
custom_attributes {
    attribute_group "custom" {
        distance "my_custom_attribute" {
            value 0.0
            doc "My documentation text"
        }
    }
}

I didn't found any other way to add a doc to a custom attribute. We continue digging into this, I will keep you informed if we find anything.

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

Re: Attribute tooltip / documentation

Unread postby bvaldes » Thu Jan 10, 2019 2:09 pm

Hi again,

We found something else: you can access to the class (the thing under the hood that makes your item work) and set the documentation to an attribute. If the attribute doesn't exists no error is returned and if you create this custom attribute to your item with the name that didn't exist before, the documentation will appear on your attribute.
I tried several things and I wrote a function that could make your life easier:

python code

def setDoc(attr, doc):
if isinstance(attr, ix.api.OfAttr):
item = attr.get_parent_object() # Get the item that is the parent of the attribute
className = item.get_class_name() # Find the className (i.e. Layer3d, GeopetryPolymesh...)
classFactory = ix.application.get_factory().get_classes().exists(className) # Try to get the class object
if classFactory:
classFactory.set_attr_doc(attr.get_name(), doc) # Set the doc

if attr.get_doc() != doc:
ix.log_warning("The doc hasn't been setted correctly.")
else:
ix.log_warning("The first argument of the function must be an attribute")


attribute = ix.get_item("project://scene/polysphere.my_custom_attribute")
setDoc(attribute, "My custom documentation")

The function doesn't update the attribute editor so if the object you set the doc is selected, you have to select it again to update the widget.

I hope this help you, best regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 384
Joined: Mon Sep 26, 2016 10:44 am

Re: Attribute tooltip / documentation

Unread postby Braden99 » Thu Jan 10, 2019 11:23 pm

Thanks Benoit, works perfectly and is serialized into the project and recalled as expected on project load.

It would be great if setting the attribute documentation could be shown in Create Custom Attribute dialog as well. To make users aware of it.
Braden99
 
Posts: 50
Joined: Mon Jan 08, 2018 3:05 am

Re: Attribute tooltip / documentation

Unread postby Braden99 » Fri Jan 11, 2019 12:54 am

Assuming Clarisse was using Qt the documentation tooltips would likely be displayed with a QLabel, which can also render html tags.
It would be useful int the future if these formatting tags worked...
<i></i>
<b></b>
etc
Braden99
 
Posts: 50
Joined: Mon Jan 08, 2018 3:05 am

Re: Attribute tooltip / documentation

Unread postby bvaldes » Fri Jan 11, 2019 9:07 am

Hi,

Clarisse doesn't use QT. So it's not possible to change the font style like this. Currently, there is no way to change font style on the user side.

About the documentation on the custom attribute, I think this is not displayed because custom attributes are not supposed to have a documentation. The way I showed you to have a documentation is a workaround because of the custom attributes' limitation. You can add a feature request if you really need it and our team will discuss about it.
https://www.isotropix.com/user/feature

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


Return to Scripting