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

   5062   6   0
User Avatar
Member
5 posts
Joined: 11月 2016
オフライン
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
8177 posts
Joined: 9月 2011
オンライン
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
9374 posts
Joined: 7月 2007
オフライン
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
CG Supervisor
Framestore, NY
User Avatar
Member
2162 posts
Joined: 9月 2015
オフライン
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 - 2019年9月24日 10:08:07
User Avatar
Member
5 posts
Joined: 11月 2016
オフライン
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: 11月 2016
オフライン
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: 11月 2016
オフライン
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