usd-sketchup icon indicating copy to clipboard operation
usd-sketchup copied to clipboard

usd-sketchup does not build on Windows

Open drwave opened this issue 5 years ago • 15 comments

This is a place-holder for work that clearly needs to get done.

drwave avatar Aug 31 '18 19:08 drwave

Hi,

How difficult is it to get these exporters to run on Windows? I have some SketchUp extension experience but not much C++ nor compiling experience.

//Christina

Eneroth3 avatar Apr 29 '19 15:04 Eneroth3

There is a small amount of Windows specific code that needs to be written. I’ve been hoping someone would give me a pull request I could integrate, but no one has stepped up.

Sorry I don’t have better news.

On Apr 29, 2019, at 8:13 AM, Eneroth3 [email protected] wrote:

Hi,

How difficult is it to get these exporters to run on Windows? I have some SketchUp extension experience http://extensions.sketchup.com/en/user/5736/store but not much C++ nor compiling experience.

//Christina

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/drwave/usd-sketchup/issues/1#issuecomment-487620158, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM2AOVVGU6KI4K2MM6PKT3PS4GBJANCNFSM4FSXAZAQ.

drwave avatar Apr 30 '19 01:04 drwave

To give more details: the design of this plugin was inspired by the SDK sample code "skp_to_xml" from SketchUp that they have on both Mac and Windows. There is a small amount of platform specific UI code, basically the checkboxes and text entry fields for the options. This is the code here:

https://github.com/drwave/usd-sketchup/tree/master/usd-sketchup/USD_SketchUp_Mac

So I need someone with Windows knowledge to write the equivalent code and wire the results in there to call into the shared code. I would expect it's a day's work, tops, for an experienced Windows dev that is comfortable in C++, and it might take a few days for someone familiar with the platform but not this kind of work.

I don't have a Windows box, otherwise I would have tried it myself. I spoke several times to the SketchUp team, and was hopeful someone there would do this work, but they have not.

drwave avatar Apr 30 '19 01:04 drwave

BTW, your SketchUp extensions look amazing!

drwave avatar Apr 30 '19 01:04 drwave

Thanks!

I have a little experience with C++ but the most complicated part for me is so far just setting up a compiler with all nitty gritty configurations. Perhaps that is already much done if this project was based on a cross platform example?

Eneroth3 avatar Apr 30 '19 06:04 Eneroth3

You’ll have to get their SDK and take a look. I can’t post it as they didn’t open source it. If you know folks at SketchUp, feel free to lean on them to do it :-)

Sent from one of my iPad Pros

On Apr 29, 2019, at 11:51 PM, Eneroth3 [email protected] wrote:

Thanks!

I have a little experience with C++ but the most complicated part for me is so far just setting up a compiler with all nitty gritty configurations. Perhaps that is already much done if this project was based on a cross platform example?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

drwave avatar Apr 30 '19 13:04 drwave

I'm happy to help disambiguate the interface, In short, the project settings should be the same as any of the other SLAPI examples to match binary compatibility, but it is a DLL called by SU, not an application calling SLAPI.

Best Regards, -Nick Gully

ghost avatar Apr 30 '19 16:04 ghost

I've now familiarized myself with the code base and some basic C++ concepts.

First of all I'm a bit confused of what the anatomy is of a finished SketchUp Mac exporter. On Windows this would be a single .dll file and I expected it to be a .so on Mac but it appears more complex. I tried to locate the file that includes the others and use it as an entry point to mentally parse the code, but neither main.cpp or USDExporter.cpp, my two top candidates, appears to include the other. Are these compiled separately? What do these files map to in the finished exporter?

I have a question that is probably more targeted towards Nick. What is "plugin" referring to in this context? In a SketchUp context I'm used to the term being synonymous with a piece of software that uses the SketchUp Ruby API and loads from the plugin folder. On Windows importers and exporters are loaded from their own folders and I've never thought of them as plugins, but are they loaded from the same folder on Mac?

Thanks

Eneroth3 avatar May 07 '19 08:05 Eneroth3

On the Mac, GUI applications are really directories that end with “.app” and are organized in a particular way. Generically, this is referred to as a “bundle”. It’s a term that comes from the old NeXTSTEP days, which is where macOS comes from.

Most applications that have plug-ins have a particular bundle format, and this includes SketchUp. So for the SketchUp app on macOS, these built-in plugins are here:

/Applications/SketchUp 2019/SketchUp.app/Contents/PlugIns/

On my machine, these are the files (which are really directories) in there:

3DSImporter.plugin 3dsExporter.plugin DEMImporter.plugin DWGImporter.plugin DaeExporter.plugin DaeImporter.plugin FbxExporter.plugin IfcExporter.plugin IfcImporter.plugin KmzExporter.plugin KmzImporter.plugin ObjExporter.plugin Skp2Acad.plugin Skp2Acad.plugin.dSYM StlExporter.plugin StlImporter.plugin USDExporter.plugin VRMLExporter.plugin XsiExporter.plugin

Those are all built-in except for USDExporter.plugin, which is mine. Here’s one of them:

tree 3dsExporter.plugin 3dsExporter.plugin └── Contents ├── Frameworks │ └── lib3ds.dylib ├── Info.plist ├── MacOS │ └── 3dsExporter ├── Resources │ └── English.lproj │ ├── 3DSExporterOptions.nib │ │ ├── designable.nib │ │ └── keyedobjects.nib │ ├── 3ds_exporter.strings │ └── InfoPlist.strings └── _CodeSignature └── CodeResources

7 directories, 8 files

The most important part of this one is the .dylib file in the "3dsExporter.plugin/Frameworks” folder, as that contains the compiled C++ code.

The “.nib” files in the “3dsExporter.plugin/Resources/English.lproj/“ folder are the UI files that contain the UI elements (i.e. the panels with checkboxes on them). If you double clicked them on a Mac, they would open in Xcode, which is the IDE on macOS. .nib stands for NeXT Interface Builder, again - throwback to its NeXTSTEP roots.

The USD plug-in is more complex, since USD has a bunch of files it references at startup, so these have been copied into the “bundle”:

USDExporter.plugin/ └── Contents ├── Frameworks │ └── libusd_ms.dylib ├── Info.plist ├── MacOS │ └── USDExporter ├── Resources │ ├── README.md │ ├── USDSketchUpMacUI.nib │ └── usd │ ├── ar │ │ └── resources │ │ └── plugInfo.json │ ├── ndr │ │ └── resources │ │ └── plugInfo.json │ ├── plugInfo.json │ ├── sdf │ │ └── resources │ │ └── plugInfo.json │ ├── usd │ │ └── resources │ │ ├── codegenTemplates │ │ │ ├── api.h │ │ │ ├── plugInfo.json │ │ │ ├── schemaClass.cpp │ │ │ ├── schemaClass.h │ │ │ ├── tokens.cpp │ │ │ ├── tokens.h │ │ │ ├── wrapSchemaClass.cpp │ │ │ └── wrapTokens.cpp │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usd │ │ └── schema.usda │ ├── usdGeom │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdGeom │ │ └── schema.usda │ ├── usdHydra │ │ └── resources │ │ ├── plugInfo.json │ │ └── shaders │ │ ├── empty.glslfx │ │ └── shaderDefs.usda │ ├── usdLux │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdLux │ │ └── schema.usda │ ├── usdRi │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdRi │ │ └── schema.usda │ ├── usdShade │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdShade │ │ └── schema.usda │ ├── usdSkel │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdSkel │ │ └── schema.usda │ ├── usdUI │ │ └── resources │ │ ├── generatedSchema.usda │ │ ├── plugInfo.json │ │ └── usdUI │ │ └── schema.usda │ └── usdVol │ └── resources │ ├── generatedSchema.usda │ ├── plugInfo.json │ └── usdVol │ └── schema.usda └── _CodeSignature └── CodeResources

40 directories, 45 files

On May 7, 2019, at 1:19 AM, Eneroth3 [email protected] wrote:

I've now familiarized myself with the code base and some basic C++ concepts.

First of all I'm a bit confused of what the anatomy is of a finished SketchUp Mac exporter. On Windows this would be a single .dll file and I expected it to be a .so on Mac but it appears more complex. I tried to locate the file that includes the others and use it as an entry point to mentally parse the code, but neither main.cpp or USDExporter.cpp, my two top candidates, appears to include the other. Are these compiled separately? What do these files map to in the finished exporter?

I have a question that is probably more targeted towards Nick. What is "plugin" referring to in this context? In a SketchUp context I'm used to the term being synonymous with a piece of software that uses the SketchUp Ruby API and loads from the plugin folder. On Windows importers and exporters are loaded from their own folders and I've never thought of them as plugins, but are they loaded from the same folder on Mac?

Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/drwave/usd-sketchup/issues/1#issuecomment-489982965, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM2AORUHKD2V2QCY6XSWALPUE3QPANCNFSM4FSXAZAQ.

drwave avatar May 07 '19 13:05 drwave

Re: the work that would have to be done on Windows. It’s basically replicating the UI of these two panels, and connecting them to the rest of the code. Here’s what they look like on macOS in Xcode (the IDE on macOS). So there’s basically a text box that will contain the string telling the user what got exported, and a series of checkboxes and a text entry for modifying the export:

This basically means making functionally equivalent code to what’s going on in SUToUSDPlugin.h and SUToUSDPlugin.mm.

Note: the .mm file is Objective-C++, so it will probably be confusing to read. Again, I refer you to the SU SDK example skp_to_xml on the windows side.

Screen Shot 2019-05-07 at 7 01 55 AM

drwave avatar May 07 '19 14:05 drwave

Hi Michael,

I have been working on porting the exporter to windows, I encountered a issue with the USD SDK. Specifically the usd zipfile writer method that is found here -> https://github.com/PixarAnimationStudios/USD/blob/master/pxr/usd/lib/usd/zipFile.h

I noticed after struggling to compile the code that the two methods at line 235 and 236 are not exported to the library .dll file which made them unavailable. They should have the USD_API macro added to them I think? I made the change locally and got it to build at least. The plugin worked in sketchup 2018 PRO, I got a working usd file that I tested with usdview.

Now the question I have is; Should I publish my code without the fixed library?

By the way the USDSketchUpUtilities classes worked like a charm, easy to connect to the windows specific UI code.

Regards, Philip Heilmair

philipheilmair avatar May 29 '19 12:05 philipheilmair

Interesting. I would post this question on the google group forum for usd. There are a lot of friendly windows savvy devs there that should know the answer.

Sent from one of my iPad Pros

On May 29, 2019, at 5:16 AM, Philip Heilmair [email protected] wrote:

Hi Michael,

I have been working on porting the exporter to windows, I encountered a issue with the USD SDK. Specifically the usd zipfile writer method that is found here -> https://github.com/PixarAnimationStudios/USD/blob/master/pxr/usd/lib/usd/zipFile.h

I noticed after struggling to compile the code that the two methods at line 235 and 236 are not exported to the library .dll file which made them unavailable. They should have the USD_API macro added to them I think? I made the change locally and got it to build at least. The plugin worked in sketchup 2018 PRO, I got a working usd file that I tested with usdview.

Now the question I have is; Should I publish my code without the fixed library?

By the way the USDSketchUpUtilities classes worked like a charm, easy to connect to the windows specific UI code.

Regards, Philip Heilmair

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

drwave avatar May 29 '19 13:05 drwave

Hey Wave,

I made a PR at USD's repo with the fix, I will clean my code for the windows version and do a PR here as well without the libraries soon.

Regards, Philip Heilmair

philipheilmair avatar Jun 05 '19 06:06 philipheilmair

Hey Michael,

Short update regarding the bug, the USD SDK team has acknowledged the bug and are going to fix it internally :) Signing the CLA and stuff for a PR was a too big hassle in our company, would have taken to long.

When I get some spare time I will clean my project and send you a PR.

Br, Philip Heilmair

philipheilmair avatar Jun 17 '19 05:06 philipheilmair

Great!

I noticed some issues with SketchUp 2019 I need to investigate as well. Hoping to get some time carved off in the next week or two to spend some back on this, so that will work out well.

On Jun 16, 2019, at 10:59 PM, Philip Heilmair [email protected] wrote:

Hey Michael,

Short update regarding the bug, the USD SDK team has acknowledged the bug and are going to fix it internally :) Signing the CLA and stuff for a PR was a too big hassle in our company, would have taken to long.

When I get some spare time I will clean my project and send you a PR.

Br, Philip Heilmair

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/drwave/usd-sketchup/issues/1?email_source=notifications&email_token=AAM2AORSL376NPEL7WBIDZ3P24R25A5CNFSM4FSXAZA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX2DWFA#issuecomment-502545172, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM2AOVQKFKV5FAIIY3CPTDP24R25ANCNFSM4FSXAZAQ.

drwave avatar Jun 17 '19 14:06 drwave