Isotropix Forums

My scriptedclass items won't work in 3.5, please help! (CID)

Clarisse Scripting related topics

My scriptedclass items won't work in 3.5, please help! (CID)

Unread postby atnreg » Thu Jun 01, 2017 1:41 pm

Hi!

I'm learning and experimenting with 3.5 and it is absolutely great but I noticed that my ScriptedClass items won't work at all :o
All attributes give this error: The Custom UI cannot be created from attribute xxx

I read in the release notes that there is some change in custom attributes so maybe that is causing it but please tell me how can I fix my code to work again. I have quite a lot of attributes so I wouldn't want to make everything again and I could not find any migration doucmentation in SDK.

I have not used CIDs as I don't quite understand the usage and I also need a lot of dynamically created attributes so I have used the add_attribute method. The documentation has not changed for the SCriptedClass nor the add_attribute so I have no idea how to fix this.

Edit: the only attributes that still work are folder and action, all other display as group title :o
I use add_attribute in declare_attributes method and it has been working fine in 3.0 and Daedalus R1.

So please help me :)


Antti
Last edited by atnreg on Sat Jun 03, 2017 3:57 pm, edited 1 time in total.
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: My scriptedclass items won't work in 3.5, please help!

Unread postby bvaldes » Thu Jun 01, 2017 4:34 pm

Hi,

Without your code, it will be hard for us to understand how to fix that.
The way to create custom attributes changed in 3.5 RC1, you should take a look of that. Moreover, the visual hint number of the attributes changed because some new types of attributes came so you have to update your script for these changes.

Hope this help for now but if you need more help, you should think about sharing your script with us.

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

Re: My scriptedclass items won't work in 3.5, please help!

Unread postby sam » Thu Jun 01, 2017 4:51 pm

And you should use CID as it is there to avoid these kind of issues.
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 955
Joined: Sat Jan 26, 2013 12:33 am

Re: My scriptedclass items won't work in 3.5, please help!

Unread postby atnreg » Thu Jun 01, 2017 5:22 pm

Hi!
Without your code, it will be hard for us to understand how to fix that.

The whole code is too long but here is how I create attributes :)
class myscriptedclass(ix.api.ModuleScriptedClassEngine):
def declare_attributes(self, cls):
attr=cls.add_attribute('a checkbox', 0, 0, 34, 'testgroup')
attr2=cls.add_attribute('another checkbox', 0, 0, 34, 'testgroup')
attr3=cls.add_attribute('folder',3,0,34,'testgroup')

The way to create custom attributes changed in 3.5 RC1, you should take a look of that.

I would but I cannot find anything related in SDK docs, could you please give the local URL (or just html page name) where that is explained? :)

Moreover, the visual hint number of the attributes changed because some new types of attributes came so you have to update your script for these changes.

I can only find one new visual hint, the old values are the same. But as I don't know how to use the 'custom ui' visual hint, could you please explain or give a simple example or point me to correct place in docs :)
Also could you please give simple example of using CID for other than simple color, for example those above?
And can CID be used for dynamic creation of attributes? I have another scripted class that creates attributes on the fly so if that is possible, please explain that too :)

I would love to read about these if I could find where so if there is documentation for using CID and the new attribute creation then please point me to it so I can RTFM :D

Thank you very much!

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: My scriptedclass items won't work in 3.5, please help!

Unread postby sam » Thu Jun 01, 2017 5:34 pm

Sure:

Reference > Scripting/API/Advanced SDK Topics/Introduction to CID syntax

Now you can RTFM ;)
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 955
Joined: Sat Jan 26, 2013 12:33 am

Re: My scriptedclass items won't work in 3.5, please help!

Unread postby atnreg » Thu Jun 01, 2017 5:42 pm

sam wrote:Sure:

Reference > Scripting/API/Advanced SDK Topics/Introduction to CID syntax

Now you can RTFM ;)


WOW indeed :o
Maybe I should get my eyes checked :D, I really didn't notice that even though I have visited the Main page a lot :oops:
Ok there will a lot to RTFM :D in that, I hope I will understand it but thank you very much so far!

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: My scriptedclass items won't work in 3.5, please help!

Unread postby sam » Thu Jun 01, 2017 6:17 pm

;)
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 955
Joined: Sat Jan 26, 2013 12:33 am

Re: My scriptedclass items won't work in 3.5, please help!

Unread postby atnreg » Thu Jun 01, 2017 11:37 pm

Hi!

Ok yes CID seems pretty clear to me now and it makes creating static attributes a lot easier, thank you :)
I also THINK I figured out how to use add_attribute by searching it in the Clarisse Python code, there I found clear code snippets that worked when I tried them in my own code. And from them I got the idea :)
Of course I will have work to do before my earlier scripted classes work like before (or better ;)) but I think I understood how it works now :mrgreen:

So, thank you very much!

P.S. Particle painting is absolutely amazing, incredible, mindblowing, much much much more than I even imagined! :shock: 8-) :)
And PBR standard material is also great, needs some getting used to (haven't read the manual part of it yet) but it will make material creation a lot easier, thank you for that too!

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: My scriptedclass items won't work in 3.5, please help!

Unread postby atnreg » Sat Jun 03, 2017 3:50 pm

Hi!
It seems I didn't understand the CID after all :(

I tried this CID:
Code: Select all
my_cid='''
class "cidtest" "ModuleScriptedClassEngine" {
    attribute_group "test" {
        color "somecolor"
    }
}
'''


When I try to use that here:
ix.api.ModuleScriptedClass.register_scripted_class(ix.application, "cidtest", cidtest(), my_cid)

I get error message: OfClassFactory.add: (2:1) Wrong number of values.

If I leave out the class, i.e. cid is only:
Code: Select all
attribute_group "test" {
    color "somecolor"
}

it works.

BUT if I try to create folder type, like this:
Code: Select all
attribute_group "test" {
    folder "somefolder"
}

I get error: OfClassFactory.add: (3:5) Unknown attribute type ('folder').
The type 'folder' is in the same list as 'color' on the CID manual page so to me it should work the same :O
Even stranger is that e.g. type 'file' works.

To me it seems that only some types from OfAttr.VISUAL_HINT_* are accepted in CID but that cannot be true.

So please explain how can I make CID that declares attributes for all types in OfAttr.VISUAL_HINT_* (e.g. folder)?

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: My scriptedclass items won't work in 3.5, please help! (

Unread postby atnreg » Sat Jun 03, 2017 7:09 pm

I tested most (or at least very many) in the CID manual attribute types second list (starting with 'enum') and it seems that 'folder' is the only one that does not work, other values work :o

But I cannot understand why CID couldn't be used to declare folder attribute so please help :)

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

Next

Return to Scripting