Banner_Support

Forum

 
Welcome, Guest
Username: Password: Remember me
Only registered users can post in this forum
  • Page:
  • 1
  • 2

TOPIC: center text objects depending on how many are used

center text objects depending on how many are used 11 months 6 days ago #537

This one is complex...

I want to keep text objects centered horizontally on the screen depending on how many of the text objects have text in them. So if I have 4 text objects and they all have text in them it would put the 1st object to the top of the page at a certain "Y" position and then a "Function" would keep the other three spaced evenly below the first. (I have that part working) If there objects have text in them first would start a little lower and the next two would follow. If two... etc.

I am guessing that the script would be rather complex... :blink:

Any suggestion other than kidnapping an ORAD trainer and dragging him to the US. (Yup I'm looking at you Philip)



Why you ask... I'm trying to avoid building 4 Pages. If I did then I would also have to make 4 Pages for every style we use. It would add up quickly.
Attachments:
Last Edit: 11 months 6 days ago by James Elrod.
The administrator has disabled public write access.

center text objects depending on how many are used 11 months 3 days ago #550

  • Václav Bígl
  • Václav Bígl's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 24
  • Thank you received: 7
  • Karma: 7
hi, try this... :) (example values, workflow from scratch)

- in 3Designer make 4 text objects (write anything inside them and make them all right font size and PositionX)

- Now little of connecting:
- text obj1 - object tab - bounding box bottom - out connection
- text obj2 - position tab - positionY - in connection - attach
- text obj2 - object tab - bounding box bottom - out connection
- text obj3 - position tab - positionY - in connection - attach
- text obj3 - object tab - bounding box bottom - out connection
- text obj4 - position tab - positionY - in connection - attach
and few more connecting (this needs to be done as second because we are now creating I1 value)
- text obj1 - font tab - text string - out connection
- text obj2 - position tab - positionY - in connection - attach
- text obj2 - font tab - text string - out connection
- text obj3 - position tab - positionY - in connection - attach
- text obj3 - font tab - text string - out connection
- text obj4 - position tab - positionY - in connection - attach
so now its enough of connecting

- Functions time: (I used here "(I-0.5)" where 0.5 defines distance between two text objects...can change it or use I2 value to variable it)
- text obj2 - position tab - positionY - add function: if (strlen(I1)=0) {I} else {I-0.5}
explain of func. (when lenght of string in text object is 0 (when there is no text written) than dont make any space between text objects else make space there...
- text obj3 - position tab - positionY - add function: if (strlen(I1)=0) {I} else {I-0.5}
- text obj4 - position tab - positionY - add function: if (strlen(I1)=0) {I} else {I-0.5}

- create group and put these four text objects inside it

- make connection:
- group - object tab - bounding box height - out connection
- group - position tab - positionY - in connection - attach

- add function:
- group - position tab - positionY - add function: I/2

- put this group1 into new group2
- use group 2 to center all where its needed

- its done now you can write anything to text obj 1,2,3,4... its centered and also it will not make bigger space between objects. so you can fill only obj 1,2,4 etc...
(maybe to connect stringlenght to visibility and hide all when not filled is good also...) writing it from head so sorry for any mistakes but hope there are none.
Václav Bígl, CZ – Looking for job with 4 or 3Designer, please contact me anytime, can go anywhere.
The administrator has disabled public write access.
The following user(s) said Thank You: Shanon

center text objects depending on how many are used 10 months 3 weeks ago #561

That worked. Thanks Václav!

Not sure what the second set of connections are doing but they work. So I'll figure it out some day.
The administrator has disabled public write access.

center text objects depending on how many are used 10 months 3 weeks ago #562

  • Václav Bígl
  • Václav Bígl's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 24
  • Thank you received: 7
  • Karma: 7
1st connecting make something like text objects train from top to bottom, you need to have space between them so every text object has position Y "-0.5" in function.

2nd connecting is controlling if there is something written in text object if not it will cancel "-0.5" space between text objects. its because now you can fill text object 1,3,4 and there is no added space from missing text object 2.
its controlled by if strlen is 0 than make no space (0) else make space (-0.5) in text objects train :) its that value "I1" in function and "I" is position of text object before, all are in one group you are measuring height

tip:
(who dont have height in bounding box control - you can use: bounding box top out conection to "helper" (some hidden group just to make some countings) position x "I" and than bounding box bottom out conn. to "helper positionX "I1" and put to "helper" position X function: I-I1 // and you have height value to connect to text objects group.posY)

and this text object group positionY value is divided by 2 because you want it everytime centered .) and this group you can put to another group with you are adjusting text groups positionY (cause theres no function etc.) :) enjoy contact if anything to solve... bye
Václav Bígl, CZ – Looking for job with 4 or 3Designer, please contact me anytime, can go anywhere.
Last Edit: 10 months 3 weeks ago by Václav Bígl.
The administrator has disabled public write access.
The following user(s) said Thank You: Shanon

center text objects depending on how many are used 10 months 2 weeks ago #569

The next level...

I want a "bullet" to go with each line. I have created a group with the "bullet" and text object.
All the centering features still work. I have added a function that should make the group invisible if there is "0" no text.
if(string(I)!="") {1;}
else{0;}

It only works on the 1st group...? :S

I have also used this on other scenes (without the new centering features) and they work correctly for each group.

bullet.png


bullet_function.png
Last Edit: 10 months 2 weeks ago by James Elrod.
The administrator has disabled public write access.

center text objects depending on how many are used 10 months 2 weeks ago #571

  • Václav Bígl
  • Václav Bígl's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 24
  • Thank you received: 7
  • Karma: 7
so you have groups for row 1 2 3 4 (not so good pictures here at forum its downgrading them and its hard to read rom them)
and every group contains
- text object
- bullet texture rectangle
all is centering as we made before (and bullet is always in right Y position because its in the group with text object, well made, easy way... :)

now you have two ways..
- to hide row group
- or hide just rectangle with bullet texture

tip: when hiding all row group vith visibility (eye) just check if the "centering texts objects train" has not been disconnected when visibility is off
tip: when naming things in scene like Line_1_Gp its hard to rename use... Line_Gp_01 when you will be copying this it will make automaticly ...Gp_02 ...etc. save time .)

- text obj1 - font tab - text string - out connection
- Line_1_Gr - object tab - visibility (check) - in connection - attach
- text obj2 - font tab - text string - out connection
- Line_2_Gr - object tab - visibility (check) - in connection - attach
- text obj3 - font tab - text string - out connection
- Line_3_Gr - object tab - visibility (check) - in connection - attach
- text obj4 - font tab - text string - out connection
- Line_4_Gr - object tab - visibility (check) - in connection - attach

function:
Line_1_Gr - object tab - visibility (check) - add function: if (strlen(I)=0) {1} else {0}
Line_2_Gr - object tab - visibility (check) - add function: if (strlen(I)=0) {1} else {0}
Line_3_Gr - object tab - visibility (check) - add function: if (strlen(I)=0) {1} else {0}
Line_4_Gr - object tab - visibility (check) - add function: if (strlen(I)=0) {1} else {0}

and check what it is doing when LineGr1 is off, if there will be any problems with "train" apply this all only to bullet texture rectangle and it will be fine .)

tip: when using visibility with eye (checkbox) and its off scene is not rendering object inside and sometimes its not counting with them too much :), you can use it to free render engine but it can affect some functions so try all combinations before done .)

bye
Václav Bígl, CZ – Looking for job with 4 or 3Designer, please contact me anytime, can go anywhere.
Last Edit: 10 months 2 weeks ago by Václav Bígl.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.104 seconds
Powered by Kunena Forum