vex language does not support "struct" data type ? houdini-version-17.327

   3119   6   0
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
when i use “struct” type to define customer data type in the node of attribute wrangle, i have fonund something wrong. plz give me some ideas.

my codes:
//////////
struct st{
float x;
}

Syntax error, unexpected struct.
User Avatar
Member
7794 posts
Joined: Sept. 2011
Online
you can't define structs in a function (a wrangle/snippet is a function). You can define your struct in a header file and include it in your wrangle as includes get added to the outercode automatically.
User Avatar
Member
8582 posts
Joined: July 2007
Online
or break into the wrangle and on the snippet define them in Outer Code parameter or promote it to top of your wrangle if you want, I think that should be done by default
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Thanks for this tip tamte. You've helped me indirectly.

I've always wondered why I couldn't include a struct directly and had to put it in a ‘header’ file and use #include.

I've always wondered how I might also be able to ‘include’ all the needed the self-written functions within the hip instead of separately in a header file.

So by creating my own wrangle asset (copying with asset manager of default wrangle) and saving with outercode promoted(and also any amount of defined functions per definition/my asset wrangle ('type').

I can now have my functions ‘follow’ the hip around without having to manage header files. At the same time have two blocks of code. One for the main logic of the operations and the other with the defined functions to be used in the main block.

Also, ‘solves’ the how to create an asset with self-contained wrangle functions that don't need access/reference to external header files.

Cool.
Edited by BabaJ - Sept. 24, 2019 10:08:07
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
jsmack
you can't define structs in a function (a wrangle/snippet is a function). You can define your struct in a header file and include it in your wrangle as includes get added to the outercode automatically.
thank you very much ,guy.
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
tamte
or break into the wrangle and on the snippet define them in Outer Code parameter or promote it to top of your wrangle if you want, I think that should be done by default
thanks for your messages.
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
BabaJ
Thanks for this tip tamte. You've helped me indirectly.

I've always wondered why I couldn't include a struct directly and had to put it in a ‘header’ file and use #include.

I've always wondered how I might also be able to ‘include’ all the needed the self-written functions within the hip instead of separately in a header file.

So by creating my own wrangle asset (copying with asset manager of default wrangle) and saving with outercode promoted(and also any amount of defined functions per definition/my asset wrangle ('type').

I can now have my functions ‘follow’ the hip around without having to manage header files. At the same time have two blocks of code. One for the main logic of the operations and the other with the defined functions to be used in the main block.

Also, ‘solves’ the how to create an asset with self-contained wrangle functions that don't need access/reference to external header files.

Cool.
thank you .
  • Quick Links