Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 726 times and has 2 replies Next Thread
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 1248
Status: Offline
Reply to this Post  Reply with Quote 
A dash [-] in material names is invalid

I created a part for a bigger model in Blender and gave it the material name "Filler30dg-01". Unfortunately when I import the part in Sweet Home 3D the material name is changed to "1".
(When a material name is invalid the group/object name is used for the material name, possibly with an added "_1" if the same name would occur. That is where the "1" came from.)

I imported the same part in Blender with the the material name still "Filler30dg-01" and it is imported with the correct material name (with the "-"). It seems that the Sweet Home 3D importer has a problem with the dash which causes it to regard the material name invalid where Blender has no such problem.

Removing the "-" from the material name solved this and when imported in Sweet Home 3D the correct name "Filler30dg01" is set as in the obj/mtl files.

I searched for the naming conventions for MTL material names but the only thing I could find is
Names may be any length but cannot include blanks. Underscores may be used in material names.

Numbers are no problem, you can even use only numbers instead of string names.

For Sweet Home 3D:
When defining new material names stick to letters, numbers, and underscores.
----------------------------------------
Dodecagon.nl
950+ 3D models, manuals, and projects
[Jun 4, 2024, 5:42:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9420
Status: Offline
Reply to this Post  Reply with Quote 
Re: A dash [-] in material names is invalid

MTL specifications specify that a .mtl file is at ASCII format (which don't include accentuated and non latin letters), so I would even say "stick to non accentuated letters A to Z, digits 0 to 9 and underscores".
I think I didn't accept dashes because the OBJ specifications accepted only letters and numbers for group names.
Maybe I was too severe and I should accept dashes too?
Anyway, note that from version 4.0, it's possible to use spaces in material names.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jun 6, 2024, 10:19:16 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 1248
Status: Offline
Reply to this Post  Reply with Quote 
Re: A dash [-] in material names is invalid

Maybe I was too severe and I should accept dashes too?
Anyway, note that from version 4.0, it's possible to use spaces in material names.
I usually use underscores, it was a coincidence that I used a dash and ran into the problem.
What I really don't like is spaces in material names. I will never use it.

The problem is retaining compatibility with other programs that export/import OBJ/MTL files. For full compatibility you are almost forced to implement the full capabilities according to the specifications. The given advise would still remain but import from a different source would not cause problems in Sweet Home 3D.


Some good practice rules for users that create their own models (personal preference, YMMV):
1. Follow the naming advise for using only "a-z,0-9,underscores(,dashes), particularly, never use accentuated characters.
2. Always name objects and materials in English, by default. English also has the advantage that it uses few to none accentuated characters. In a furniture library you can add translation files for other languages. It keeps your models more accessible for users that don't understand your language. This also helps with using accentuated letters, the translation is only used for display in the user interface so there is no problem with using accentuated letters.
3. Keep names as short as possible while they remain descriptive. If necessary a longer name is better than a name that makes no sense.
4. Even if allowed, never use spaces in names.
5. Use (upper) Camel Casing (Pascal Casing) for names: the first letter of each word as a capital: "BodyColor", "LeftHandSide". In many cases this avoids having to use underscores, dashes, or spaces which keeps the name shorter.
6. Don't use material names that are too specific. "Red" only makes sense for a material if the material will always be the color red. For the hot/cold colors on a faucet you can use "Red" and "Blue", for the body of a car not.
7. If you have multiple object or material names with an increasing number make sure that all numbers are equal in length if they go beyond 9: pad-left with a 0. This will ensure that the display in the catalog and materials list follows the correct number order. Without the left-padding the order will look like 1, 11, 12, ..., 2, 21, 22. Optionally use an underscore to separate the number from the word(s).
----------------------------------------
Dodecagon.nl
950+ 3D models, manuals, and projects
[Jun 6, 2024, 1:21:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

  Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads  
© Copyright 2024 Space Mushrooms - All rights reserved