[Plugin] OBJexporter v3.0 20130131

[Plugin] OBJexporter v3.0 20130131

Postby TIG » Thu Dec 16, 2010 6:23 pm



PERHAPS USEFUL FOR 'FREE' USERS, WITHOUT THE OBJ-EXPORTER OPTION AVAILABLE.


TIG (c) 2010-2013
All Rights Reserved.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
###
OBJexporter.rb
###
Usage: menu File > 'OBJexporter...'
It Exports the Model in OBJ Format with an associated MTL file and a folder
of image-files [..._Textures] if appropriate.
By default the files use the SKP's name with spaces etc squeezed out.
By default the files and sub-folder are put into the SKP's folder.
A starting dialog allows you to give an alternative filename/folder.
You are asked if you want to make all Texture files PNG format?
By default everything in the SKP's active_entities, that's not Hidden and that's
on visible Layers will be Exported. If there is a Selection you are prompted to
export the 'Selection Only' [Yes] or 'Everything Active/Visible' [No].
By default the Units are in 'meters'.
By default All Exported Faces are Triangulated .
By default the Y & Z axes are swapped.
Note that 'distorted textures' are exported as new unique texture-files,
distorted to match and re-UVmapped, like the Pro-OBJexporter - any scaled
or rotated textures are UVmapped appropriately using the main texture-file.
Where possible shared-vertex data is reused ensuring correctly formed geometry.
This can mean that a SKP with 100,000 faces and potentially 300,000 vertices can
be 'compacted' to use perhaps 50,000 shared-vertices [but of course this depends
on the SKP's geometry, grouping etc]: this also reduces processing time [now
perhaps 60 seconds for this example], and when combined with optimized
numerical-entries, much smaller OBJ file sizes and faster processing in
3rd-party apps too.
###
Donations:
By PayPal.com to info @ revitrev.org
###
Version:
1.0 20101216 First issue.
1.1 20110106 Image class method extensions only load if not already defined.
1.2 20110224 Distorted textures are now exported correctly, with their own
distorted 'unique texture' files [like the Pro-OBJexporter].
1.3 20110225 Glitch with some distorted textures 'flipping' addressed.
Materials and textures applied within and on to Groups or
Instances now properly defined and UV-mapped.
1.4 20110228 The new Filename now has spaces etc squeezed out.
Startup dialog added to allow Filename/Folder to be changed.
Glitches with reversals of some smoothed faces and materials
occasionally missing from complex faces now addressed.
General speed and Status-Bar progress-reporting improved.
1.5 20110323 Glitch with 'smoothed normals' addressed.
1.6 20110402 Option to export all Texture files in PNG format added.
1.7 20120118 Material images with no filetype now auto-revert to PNG.
Tolerance for deciding if 'distorted texture' relaxed.
1.8 20120214 Fixed issues with flipped-instance reversed face vertices.
1.9 20120215 Completely recoded. Issues with flipped-instance fully fixed.
2.0 20120217 Tolerance checks for deciding if 'distorted texture' improved.
2.1 20120220 Further work on avoiding the glitches with flipped-instances'
face-reversal/orientation/UVmapping.
2.2 20120220 Raw geometry hidden/off-layer merging during export resolved.
2.3 20120221 Typo corrected ;{
2.4 20120221 Recoded - speed ~v1.8, fixed flipped-instance face-reversal.
2.5 20120221 Recoded - resolves nested [flipped] transformation and
multiple-group-instances glitches etc.
2.6 20120222 Recoded for speed improvement ~5%. Flipped/rotated instances
transformations resolved for correct face orientation...
The MTL defaults now generally match the Pro exporter -
specularity=0.333, but ambience=color etc.
2.7 20121008 Alpha now set as d= and Tr= for cross-platform compatibility.
Coords' d.p. increased for accuracy. Option to Export Selection
Only, if there is a selection. Active_entities exported, allowing
just the contents of a group/component being edited to be exported;
or the whole model if the context is model.entities.
2.8 20130127 D.P. accuracy is not now applied to 'whole numbers'; -0 becomes 0;
any shared-vertex entries are now 'reused'.
2.9 20130130 Merging of shared vertices is now optional, as it slows processing
for larger models.
3.0 20130131 Improved shared-vertex merging algorithm is now slightly faster
than a non-merging version, so the option not to merge has been
removed. Notes updated.
###

Download the latest version of the RBZ archive for this Plugin from the SketchUcation PluginStore...

Download



Or get/install the SketchUcation Plugin Store dialogand thereafter you'll be able to AutoInstall all of your Plugins within SketchUp itself, without having to even download an RBZ at all.
http://sketchucation.com/pluginstore?pa ... tchucation
2
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby Chris Fullmer » Thu Dec 16, 2010 6:31 pm

That's awesome TIG! Thanks,

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby Rich O Brien » Thu Dec 16, 2010 7:04 pm

Thanks TIG, much appreciated
0
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby Khai » Thu Dec 16, 2010 7:11 pm

oh nice :D
you've done it again!
will there be an option to export as is? (I model in Quads...)

edit : ignore me.. it does :D
0

Khai 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby richcat » Sat Dec 18, 2010 9:57 pm

Thank you TIG
0

richcat 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby pilou » Sun Dec 19, 2010 12:22 am

Works fine for export to Blender 2.55 ! :fro:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby numbthumb » Sun Dec 19, 2010 11:51 am

Thanks, TIG!
0
Comfortably numb...
User avatar
numbthumb 
Top SketchUcator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby tfdesign » Sun Dec 19, 2010 4:59 pm

This exports materials as well? So I don't have to use FBX? Cool!

Thank you TIG!

I'll try and post you a donation, but I have to wait until after Xmas, because I'm still awaiting payment from a couple of people).
0
My book "Let's SketchUp!" Download from here

tfdesign 
Top SketchUcator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby djbox » Sun Dec 19, 2010 8:30 pm

Thanks, TIG!
0

djbox 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby caddict » Thu Dec 23, 2010 4:10 am

Pilou wrote:Works fine for export to Blender 2.55 !


hey pilou, could you get the materials into 2.55?
0

caddict 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby eagseags » Sun Jan 02, 2011 2:55 am

I am new to Sketchup. I currently am trying the free Sketchup 8 on MacOS 10.6. I can read in an object into Sketchup, and run the OBJexporter from the plugin menu, but the message I keep getting is :

Writing textures failed!
Exporting Component: A
Exporting Component: B
etc.
Nothing to export
Exporting geometry to: /Users/eags/Desktop/Untitled.obj
Done.

The .obj file has content, but cannot be read by Vue or Cheetah3D.

Am I missing something?
0

eagseags 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby TIG » Sun Jan 02, 2011 3:17 pm

Have you saved the SKP before exporting?
Try exploding the imported 'group' and re-export as obj and see what happens...
Have you tried exporting a very simple box with some textured materials applied to it.
Then reimporting the obj...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby User2012 » Sun Jan 02, 2011 9:15 pm

I will render my SU-Model in DAZ-Studio (http://www.daz3d.com) so I need my model as OBJ and I'm very happy to find these plugin. But after the import (.obj and .mtl) in DAZ (or I tested it also in MeshLab) not all textures are correctly. The wrong textures a not the biggest problem, I can fix it in DAZ, but a lot of skins are declared as "Default material" but there are not default. So I can't adjust them separately. Is where anything I can do to fix it?
0

User2012 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby TIG » Mon Jan 03, 2011 12:23 am

User2012 wrote:I will render my SU-Model in DAZ-Studio (http://www.daz3d.com) so I need my model as OBJ and I'm very happy to find these plugin. But after the import (.obj and .mtl) in DAZ (or I tested it also in MeshLab) not all textures are correctly. The wrong textures a not the biggest problem, I can fix it in DAZ, but a lot of skins are declared as "Default material" but there are not default. So I can't adjust them separately. Is where anything I can do to fix it?

Remember to apply textured-materials to faces rather than components/groups.
Textures with 'skewed' UV-mapping will no be correct - make these materials unique before you export.
If you are opening a file based on an earlier obj your application might remember old settings - try afresh...
I suspect this as the main problem... IF you have faces showing with 'default-material' when they aren't in the SKP then I suspect that you have modeled [or have imported others' objects] with some of the faces 'reversed'.
To check this switch you View to Monochrome mode with a Style where the back-face material is very different to the front - say blue v. white. You might then find that you have applied textures to the back of some faces and the front face is indeed still in the 'default-material'. ALL back faces always export as having the 'default-material' since an OBJ by default only shows front faces with applied materials...
It is not the fault of the exporter, or the application importing the file - rather the modeler has simply made the SKP wrong and both other tools are showing the result...
There are several tools like my 'FixReversedFaceMaterials' that help you sort out this kind of messy modeling...... :geek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby User2012 » Mon Jan 03, 2011 12:37 am

Thanks for the answer :thumb: – just these moment I found the same idea in the help …

http://sketchup.google.com/support/bin/answer.py?hlrm=de&answer=36260

A plain has a front and a back side, no problem in SU. But on the export only the front side will be exported – so I have to use the monochrome-view to find all ‘back-side’ plains in my model an change them into a front-side. Easy but takes a long time …
0

User2012 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby TIG » Mon Jan 03, 2011 12:46 am

User2012 wrote:Thanks for the answer :thumb: – just these moment I found the same idea in the help …

http://sketchup.google.com/support/bin/answer.py?hlrm=de&answer=36260

A plain has a front and a back side, no problem in SU. But on the export only the front side will be exported – so I have to use the monochrome-view to find all ‘back-side’ plains in my model an change them into a front-side. Easy but takes a long time …

Look at this viewtopic.php?p=264134#p264134 ............
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby User2012 » Mon Jan 03, 2011 2:10 am

Thanks!!!! Very good advice - the plugin is very helpfully. The German translation of the menutext in the plugin is horrible - but it works :ecstatic:
0

User2012 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby TIG » Mon Jan 03, 2011 12:21 pm

User2012 wrote:Thanks!!!! Very good advice - the plugin is very helpfully. The German translation of the menu-text in the plugin is horrible - but it works :ecstatic:

The ...DE.lingvo file is easily edited - the supplied lingvo files are not the definitive translations - some locales don't even get one! - they are for you to adjust/correct/improve - please do so and post you improved version for other German locale users too... :geek:
It is 'free' so do your bit to improve it... :|
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby User2012 » Mon Jan 03, 2011 5:09 pm

TIG wrote:The ...DE.lingvo file is easily edited - the supplied lingvo files are not the definitive translations - some locales don't even get one! - they are for you to adjust/correct/improve - please do so and post you improved version for other German locale users too... :geek:
It is 'free' so do your bit to improve it... :|

So here is my version of the FixReversedFaceMaterialsDE.lingvo. I hope it will help other German users ("Viel Spass damit!"). Perhaps it's better posted or linked to the FixReversedFaceMaterial topic?
0

User2012 
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby TIG » Mon Jan 03, 2011 5:16 pm

User2012 wrote:
TIG wrote:The ...DE.lingvo file is easily edited - the supplied lingvo files are not the definitive translations - some locales don't even get one! - they are for you to adjust/correct/improve - please do so and post you improved version for other German locale users too... :geek:
It is 'free' so do your bit to improve it... :|

So here is my version of the FixReversedFaceMaterialsDE.lingvo. I hope it will help other German users ("Viel Spass damit!"). Perhaps it's better posted or linked to the FixReversedFaceMaterial topic?

I add it there and also include it in any future updates...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.0 20101216

Postby Foun10Head-X » Tue Jan 04, 2011 8:45 pm

Thanks TIG for this plug-in.
0

Foun10Head-X 
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby TIG » Thu Jan 06, 2011 12:35 pm

Here's v1.1 viewtopic.php?p=294844#p294844
The Image class method extensions now only load if they haven't been defined already...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby Buzzzzy » Thu Jan 20, 2011 9:00 am

I am having some trouble getting this plug-in to show up in the file menu. I placed it in the Plugins folder, but it still won’t show up.
0

Buzzzzy 
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby TIG » Thu Jan 20, 2011 10:38 am

I'm assuming you get no error messages with it ?

If it's still not there under the File menu as 'OBJexporter'... then if you are on Vista it might appear that you have added it to the ../Plugins/ folder but the .rb file has actually been moved into a 'Compatibility Files' folder to 'protect you' :roll:

If so you need to fix your right-click Preferences > Security and reset 'access rights' to be 'full' for both the Plugins folder, and any files or subfolders in it... :geek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby Jabberwock xeno » Fri Jan 21, 2011 1:14 am

Hey, i'm new here.

I just exporeted something, but how do I access it?
0

Jabberwock xeno 
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby TIG » Fri Jan 21, 2011 10:35 am

Jabberwock xeno wrote:Hey, i'm new here.
I just exported something, but how do I access it?

Look in the Model's folder.
There will be the Model.SKP file [and perhaps Model.SKB backup file].
After running the OBJexporter you should also have a Model.OBJ file and a Model.MTL.
The OBJ file defines the geometry and its matching MTL file defines the materials.
If there are 'textures' used by any materials then the required image files are put into a subfolder named 'Model_Textures'.
If you now import the OBJ file into an application it will automatically look for the material MTL file in the same folder as the OBJ... and if there are any images needed by the MTL file that looks in the 'Model_Textures' subfolder that is with the two files... So if you move the files you must ensure that they and the subfolder are all kept together in the same relationship - if you are sending them to someone else zip them in the same relationship too.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby krash88 » Mon Jan 24, 2011 4:59 pm

Just wondering if anyone else has had a problem like mine. When I use your OBJ exporter and then open it in another app, none of the geometry is connected. For instance, after loading in Ultimate Unwrap 3D all triangles are individual and not welded. After imported into Sculptris all modifications affect individual faces only. I hope I explained that well enough :)

Model

SU Pro OBJ in Ultimate Unwrap 3D - Box UV map

TIG's OBJ in Ultimate Unwrap 3D - Box UV map

Any insight as to what I may be doing wrong?
0

krash88 
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby TIG » Mon Jan 24, 2011 5:08 pm

I'm not sure I fully understand...
I does export faces as triangles - irrespective of their original form.
It doesn't 'weld' faces rather export separate faces, but each face's UV-mapping should be respected - unless the texture has been 'skewed'... :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby Jim » Mon Jan 24, 2011 5:12 pm

The exporter is not re-using vertices, instead creating new entries for each face regardless if they are already in the vertex list.



(That's more of an assumption since I haven't looked at the code.)
0

Jim 
Global Moderator
 

Re: [Plugin] OBJexporter v1.1 20110106

Postby krash88 » Mon Jan 24, 2011 5:18 pm

I was hoping to edit the exported OBJ in Sculptris mainly. I just figured that Ultimate Unwrap 3D would give a better example. Here's what I get when smoothing faces in Sculptris...



Since the faces aren't welded, they 'break' when editing. Would it be possible to export with welded faces?
0

krash88 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: alberto2002, iichiversii, luigimux, seafire_ and 13 guests

Visit our sponsors: