question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Matthew Gillespie commented

How do I set the color of the new operator in FlexScript?

Hi,

Previously when I wanted to change the color of the operator I changed the color of the object. With the new FlexSim 2019 Update 1 operator visuals the colors are separate for all the different parts of the clothes.

How can I e.g. set the color of the shirt of the person using FlexScript?

An option for the color of a certain piece of clothing (or many) to use the same color as the object could also be a nice improvement.

Thank you!

Kind regards,

Axel

FlexSim 19.1.0
operatorflexscriptcolor change
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

David Seo avatar image David Seo commented ·

@Axel Kohonen

It's the same with the old. If you want to change only the shirt color, use Color.byNumber().

I attach the example model.

operator-shirt-color-change.fsm

1 Like 1 ·
Axel Kohonen avatar image Axel Kohonen David Seo commented ·

Hi,

@Seung Yong Seo

Thank you for the answer. You are correct if I have chosen the shape "Male operator" or "Female operator", but if I choose any of the other shapes, then this does not work.

So Martin's answer is better in my opinion as it applies to also the other shapes.

Axel

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

We're working on some improvements for this. For the next 19.1 bug fix the shirts of person flowitems will be set to use object color so that you can easily set their shirt color through code.

For 19.2, the shirts of all the operators will be set to use object color and the Person Visuals panel in Quick Properties will be updated to let you easily toggle the use object color setting.

1 Like 1 ·

1 Answer

·
martin.j avatar image
2 Likes"
martin.j answered Matthew Gillespie commented

Hi Axel,

In the new people type operators you will finde a new node called Operator -> visual / localshapedata. This node contains a table with all the current clothes and options for the task executer. I suggest right clicking on the nameless subnode and chosing "Explore as table" to see the options in a table.

In the table you can see which shapes are currently visible by looking for the zeroes in the hideMesh column. There is also a column named useObjectColor. If set to 1, the mesh will take the color of the overall object color. You can now dictate the color of the clothes for instance by setting the main color of the object, but of course this only allows you to set one color. If you want to programaticllay set the clothing color seperatly you need to go a bit deeper:

Each row node in the table has the simple-data-type and infomation on the clothing or body part. In the nodes there is a 'diffuseColor' tag that defines the color.

If you access the node and use the command:

setsdtvalue(sdtNode, "valName", value);

You can now set the 'diffuseColor':

treenode sdtNode = so; 
Array color = Color.green;
setsdtvalue(sdtNode, "diffuseColor", color);

For more info on setsdtvalue, see this: Topic


operator1.png (75.6 KiB)
operator2.png (75.7 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Axel Kohonen avatar image Axel Kohonen commented ·

Hi,

@martin.jensen Thank you for the thorough explanation.

Axel

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.