struct and Custom atrributes

struct and Custom atrributes

Anonymous
Not applicable
282 Views
2 Replies
Message 1 of 3

struct and Custom atrributes

Anonymous
Not applicable
So I am having a problem, I am trying to create an script that will eventually create a floater that will allow animators to create arbitrary anim ranges and store these ranges as a custom attribute to the rootNode, so this is what I have so far, the problem that i am having is that I want to use a struct instance to store each range as it's been created, then append an array with each struct, so array index x gives us 3 values (name of the range, start frame and end frame) the problem surfaces when I try to define a type for the custom attribute.

some code:
THIS I AM PRELOADING IN STDPLUGS/STDSCRIPTS

struct AnimRangerRange (Rangename, beginframe, endframe)

global defaultAnimRange = AnimRangerRange "Default" 0 100
global bhg_global_anim_ranges_list = #()
append bhg_global_anim_ranges_list defaultAnimRange




then here is my work in progress for the script, (NO FLOATER YET, i AM STILL WORKING OUT THE CUSTOM ATTRIBUTE)

( --begin local scope

animRangerArray = bhg_global_anim_ranges_list

if custAttributes.count rootnode == 0 then --# check to see if any custattributes exist at all, if not, then add the anim ranger attribute and default array.
( -- add attribute and default array



rangerdata = attributes AnimRangerData

(
parameters main rollout:params
(
glbanimranges type:#string --# HERE IS THE PROBLEM, HOW DO i SOLVE IT???
) --end params

rollout params "nodata"
(
)
) --end pathdata

custAttributes.add rootNode rangerdata #unique

rootNode.AnimRangerData.glbanimranges = animRangerArray


) -- # end no attribute found

else --# of course if custom attributes exist, we need to see if ours is one of them
(

) --# end else attributes exist



) -- end local scope


Thanks in advance
0 Likes
283 Views
2 Replies
Replies (2)
Message 2 of 3

paulneale
Advisor
Advisor
There is no data type that will store a struct. What you can do is have three parameters that each
hold an one of the needed pieces of data. So something like this...


parmeters paramsP
(
NameArray type:#stringTab tabSize:0 tabSizeVariable:true
StartArray type:#floatTab tabSize:0 tabSizeVariable:true
EndArray type:#floatTab tabSize:0 tabSizeVariable:true
)


Doesn't look at clean but works just as well.


Mighty_Marcos wrote:
> So I am having a problem, I am trying to create an script that will eventually create a floater that will allow animators to create arbitrary anim ranges and store these ranges as a custom attribute to the rootNode, so this is what I have so far, the problem that i am having is that I want to use a struct instance to store each range as it's been created, then append an array with each struct, so array index x gives us 3 values (name of the range, start frame and end frame) the problem surfaces when I try to define a type for the custom attribute.
>
> some code:
> THIS I AM PRELOADING IN STDPLUGS/STDSCRIPTS
>

> struct AnimRangerRange (Rangename, beginframe, endframe)
>
> global defaultAnimRange = AnimRangerRange "Default" 0 100
> global bhg_global_anim_ranges_list = #()
> append bhg_global_anim_ranges_list defaultAnimRange
>

>
>
>
> then here is my work in progress for the script, (NO FLOATER YET, i AM STILL WORKING OUT THE CUSTOM ATTRIBUTE)
>

> ( --begin local scope
>
> animRangerArray = bhg_global_anim_ranges_list
>
> if custAttributes.count rootnode == 0 then --# check to see if any custattributes exist at all, if not, then add the anim ranger attribute and default array.
> ( -- add attribute and default array
>
>
>
> rangerdata = attributes AnimRangerData
>
> (
> parameters main rollout:params
> (
> glbanimranges type:#string --# HERE IS THE PROBLEM, HOW DO i SOLVE IT???
> ) --end params
>
> rollout params "nodata"
> (
> )
> ) --end pathdata
>
> custAttributes.add rootNode rangerdata #unique
>
> rootNode.AnimRangerData.glbanimranges = animRangerArray
>
>
> ) -- # end no attribute found
>
> else --# of course if custom attributes exist, we need to see if ours is one of them
> (
>
> ) --# end else attributes exist
>
>
>
> ) -- end local scope
>

>
> Thanks in advance
Paul Neale

http://paulneale.com


Paul Neale




EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable
There is no data type that will store a struct.


Lame!!! But your solution is great, I just wanted to parse less arrays, but as long as it works, who cares?

Thanks Paul!

MB
0 Likes