Forum

Define 2 different anchor styles?

13 November 2017 20:30
Hello,

I wanted to define two different anchor styles. But I do not want to add elements in each HTML individually. I was able to change the "Annotation" style in the anchor.js file. But all the anchors will use that one style. I was wondering whether there is a better way to do it so I can use it for multiple blender files that share the same HTML player.

I also noticed that there is a "Category" choice in the "Meta Tags" section. What's the function of this? Would I be able to make 2 anchor categories here?

Thank you very much!
14 November 2017 15:12
Yes, you can apply style depending on category value somewhere in create_annotation() function. Then you should compile the engine:
make compile_b4w
And build webplayer application with Project Manager.
Alexander (Blend4Web Team)
twitter
14 November 2017 19:21
Reply to post of user Alexander Romanov
Yes, you can apply style depending on category value somewhere in create_annotation() function. Then you should compile the engine:
make compile_b4w
And build webplayer application with Project Manager.
Awesome, thanks Alexander.
How do I call the category? Do you mind sharing a simple example?
Thanks!
15 November 2017 14:31
Sorry, I have no time. This is not difficult, just set a breakpoint at the begining of create_annotation and inspect obj fields. Should be something like
if (obj.metatags["category"] == "your_cat") {
//apply styles
}


Of course you should modify engine code and rebuild it as I already mentioned above.
Alexander (Blend4Web Team)
twitter
15 November 2017 21:58
Reply to post of user Alexander Romanov
Sorry, I have no time. This is not difficult, just set a breakpoint at the begining of create_annotation and inspect obj fields. Should be something like
if (obj.metatags["category"] == "your_cat") {
//apply styles
}


Of course you should modify engine code and rebuild it as I already mentioned above.

Yes. This is what I was looking for. Thanks!
 
Please register or log in to leave a reply.