[Plugin] UVEditor 0.30

[Plugin] UVEditor 0.30

Postby Marginal » Sun Apr 13, 2014 8:23 pm

The tools that SketchUp offers for texturing Faces have their good points and bad points.
Good:
  • When using Texture → Position it's easy to understand and visualise what's going on.
  • Once someone has pointed you to a video (like this one) explaining how it works, projecting textures is a powerful technique.
Bad:
  • Texture → Position only works on single Faces.
  • Whether positioning textures on a single Face or projecting a texture across many Faces, it's difficult to get *really* accurate positioning - e.g. the pixel or sub-pixel accuracy that's required when using a texture atlas.
This plugin aims to address the above "Bad" points by offering a traditional UV Editor. It's loosely inspired by Blender's "UV/Image Editor", but with a SketchUp user interface and interaction model. Here's a screen shot of it in action:
screenshot.jpg

Requirements: SketchUp 8 or later. MacOS 10.5 or later, or Windows XP or later with IE 9 or later.

Quick start:
  • Download and install the plugin in the usual way:
    • Mac: choose SketchUp → Preferences → Extensions → Install Extension
    • Windows: choose Windows → Preferences → Extensions → Install Extension
    • Re-start SketchUp if upgrading from an older version of this plugin.
  • Use Tools → UV Editor to display the "UV Editor" window.
  • Select one or more Faces in the main SketchUp window; the "UV Editor" window shows the UV assignments of the selected faces. Note: Because the "UV Window" only shows one texture at a time, only those faces that use the same texture file are shown.
  • Use the mouse wheel or zoom gesture in the "UV Editor" window as desired to focus on the UV assignments of interest to you.
  • In the "UV Editor" window select one or more UV points, and use the "Move", "Rotate" or "Scale" tool to adjust them.

Other features:
  • The "Export UV layout" button in the "UV Editor" window saves a PNG with the selected faces' UV coordinates outlined in it. You can use these outlines to help paint your texture.
  • The plugin provides a toolbar which currently has two buttons:
    • UV Editor window: This just does the same thing as the Tools → UV Editor menu option.
    • Project UVs from View: This provides an alternative to SketchUp's built-in texture projection - the texture is projected from the current camera view rather than from a plane. (This is similar to Blender's "Project From View" feature).
    I hope to add more projection and unwrapping choices in future.

This is an alpha release - it's functional but missing some features:
  • Rotate and Scale tools not implemented.
  • Numeric input not implemented.
  • No manual (but context-sensitive help is shown in the status bar).
  • No support for projecting or unwrapping (but other built-in tools and 3rd-party plugins support unwrapping).

I'm publishing this as an alpha because I'm looking for feedback:
  • Is this kind of tool useful?
  • Is there an existing tool that does this better?
  • Is it easy to use?
  • What functionality is missing?
  • etc.

Finally, thanks to those who have posted guidance and code snippets in the Developers forum, especially to thomthom for his Sketchup WebDialogs - The Lost Manual.
6
Last edited by Marginal on Thu Apr 17, 2014 6:55 pm, edited 2 times in total.

Marginal 
 

Re: [Plugin] UVEditor 0.10

Postby Krisidious » Sun Apr 13, 2014 8:44 pm

Very kool... I'll give it a try. That's quite a first post.
0
By: Kristoff Rand
Home Designer
Unique House Plans
User avatar
Krisidious 
 

Re: [Plugin] UVEditor 0.10

Postby jeff hammond » Sun Apr 13, 2014 8:56 pm

Marginal wrote:Is this kind of tool useful?


yes, of course ;)
[*]Is there an existing tool that does this better?


maybe not exactly because i'm still possibly missing some functionality you're trying to offer which isn't available in other plugins but have you seen ThruPaint by fredo yet?

viewtopic.php?t=44552

[*]Is it easy to use?


hmm.. not really.. or, it seems like it would take a _really_ long time to edit the uvs so all the texture lines match up in this example.. but again, i'm probably overlooking a scenario where it's useful or not as complicated.

Screen Shot 2014-04-13 at 3.41.56 PM.jpg


[*]What functionality is missing?


i kept wanting to grab a point and drag it.. instead of select a point then switch to move tool in order to move it..

[EDIT] nevermind-- i can do that if i have the move tool selected instead of the selection arrow :thumb: [/edit]

[*]etc.

seems like it would would be better if the uveditor window stayed on top of the sketchup window.. as in- if i select a surface in sketchup, the uv window goes behind sketchup and i have to bring it back to the front.. seems as if you're using the plugin, the window should always stay on top?

crazy first post though :)
nice!
0
dotdotdot
User avatar
jeff hammond 
Global Moderator
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Mon Apr 14, 2014 8:09 am

Very interesting. Will have to try this.
One of SU long missed functions. :thumb:
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby kaas » Mon Apr 14, 2014 8:55 am

Nice first post! Something to enhance the mapping process has been on my wish-list for a long time.
I wanted to try your plugin but I'm not sure what's going wrong here. Front face has texture on it, face is selected, UVeditor launched but no image or points appear in the editor... Any idea what I am doing wrong here?

On Win 7 X64 - SUpro 2014.
0

kaas 
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Mon Apr 14, 2014 2:04 pm

I have the same problem.
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby mitcorb » Mon Apr 14, 2014 3:02 pm

Probably not relevant, but has this been designed for SU 2013 and 2014, also?
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] UVEditor 0.10

Postby solo » Mon Apr 14, 2014 3:37 pm

Pixero wrote:I have the same problem.


I'm also getting blank window SU 2014
0
http://www.solos-art.com

I'm better with polys than words
User avatar
solo 
Global Moderator
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Mon Apr 14, 2014 3:50 pm

I see in his post he shows it with SketchUp on a Mac. Maybe there is something not working with the Windows version? I have a Macbook Pro at home I'll try it there and see if it works...
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby driven » Mon Apr 14, 2014 5:24 pm

@PC folk,

looking at the code it is Windows friendly, but does have a line in the javascript
Code: Select all
//Called after DOM inititialised. Not called under IE<9 since DOMContentLoaded not supported

so that may be your issue...

post your SU 'used' IE version if you shooting blanks...

if unsure what version SU uses, paste this into 'Ruby Console'
Code: Select all
dlg = UI::WebDialog.new()
dlg.show_modal do
dlg.execute_script('document.body.innerText=navigator.userAgent;')
end
then copy/paste the EDIT: text in the WebDialogback into a reply...
2014-04-14 06.42.14 pm.png


mine [on mac] contains this
webDialog wrote:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.74.9 (KHTML, like Gecko) SketchUp/14.0 (Mac; Safari)


john
0
Last edited by driven on Mon Apr 14, 2014 6:47 pm, edited 1 time in total.
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Mon Apr 14, 2014 6:04 pm

This is what I get on Windows 8 with Internet Explorer 11:

Code: Select all
dlg = UI::WebDialog.new()
dlg.show_modal do
dlg.execute_script('document.body.innerText=navigator.userAgent;')
end
true


And a empty window appears.
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Mon Apr 14, 2014 6:12 pm

Just tried it on my MacBook and all I can see no matter how I select or zoom is 1 (one) vertex???
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby kaas » Mon Apr 14, 2014 6:16 pm

Pixero wrote:This is what I get on Windows 8 with Internet Explorer 11:

Code: Select all
dlg = UI::WebDialog.new()
dlg.show_modal do
dlg.execute_script('document.body.innerText=navigator.userAgent;')
end
true


And a empty window appears.

Same here on Win7 IE11
0

kaas 
 

Re: [Plugin] UVEditor 0.10

Postby driven » Mon Apr 14, 2014 6:50 pm

it does look like browser version issue,

also I edited my earlier post, 3 above...
to show which bit I copy pasted back...

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] UVEditor 0.10

Postby Marginal » Mon Apr 14, 2014 7:49 pm

I've edited the first post to clarify system requirements, namely:
SketchUp 8 or later. MacOS 10.5 or later, or Windows XP or later with IE 9 or later.

And to upload a new version:
  • Fix for texture not appearing in UV Editor window on Windows.
  • UV Editor window stays on top.
Please let me know if you're still having trouble getting started.

jeff hammond wrote:it seems like it would take a _really_ long time to edit the uvs so all the texture lines match up in this example.. but again, i'm probably overlooking a scenario where it's useful or not as complicated.
I'd envisaged it being useful for tweaking the position of textures that have already been projected.

But I'm starting to think that to be truly useful it's going to have to support a range of unwrapping and projection tools. (I looked at ThruPaint and, as far as I can tell, it doesn't offer these).
0

Marginal 
 

Re: [Plugin] UVEditor 0.10

Postby jolran » Mon Apr 14, 2014 8:20 pm

is the body ready ? Try with a button..

Code: Select all
html = <<-HTML
      <!DOCTYPE html>
      <html>
      <body>
         <input type='button' onclick='alert(document.body.innerText=navigator.userAgent);'>
      </body>
      </html>
   HTML
   dlg = UI::WebDialog.new()
   dlg.set_html(html)
   dlg.show_modal
0
User avatar
jolran 
PluginStore Author
PluginStore Author
 

Re: [Plugin] UVEditor 0.10

Postby kaas » Mon Apr 14, 2014 8:29 pm

Marginal wrote:And to upload a new version:
  • Fix for texture not appearing in UV Editor window on Windows.
  • UV Editor window stays on top.
Please let me know if you're still having trouble getting started.

Texture appears in v0.20 but I cant select the move button. Win7 32bits Su2014 , IE 11

edit: Still empty window with v0.20 on Win7 64bits Su2014 , IE 11
0
Last edited by kaas on Tue Apr 15, 2014 12:34 pm, edited 1 time in total.

kaas 
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Tue Apr 15, 2014 7:27 am

Installed v0.2 still nothing visible with Windows 7 and IE9.
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby kaas » Tue Apr 15, 2014 9:53 am

Pixero wrote:Installed v0.2 still nothing visible with Windows 7 and IE9.

You are sure you are using v0.2? I had to remove v0.1 first before v0.2 was being used.
0

kaas 
 

Re: [Plugin] UVEditor 0.10

Postby jolran » Tue Apr 15, 2014 10:39 am

Hi. Get an "undefined" JavaScript error on line 636.

I see in the JS code "ctx.drawImage" is being called. BUT I can't see it has been assigned anywhere..
0
User avatar
jolran 
PluginStore Author
PluginStore Author
 

Re: [Plugin] UVEditor 0.10

Postby Pixero » Tue Apr 15, 2014 12:23 pm

kaas wrote:
Pixero wrote:Installed v0.2 still nothing visible with Windows 7 and IE9.

You are sure you are using v0.2? I had to remove v0.1 first before v0.2 was being used.


I uninstalled and reinstalled v0.2 but nothing is visible in the UV editor.
SketchUp 2014, Windows 7 and IE9.
0
User avatar
Pixero 
 

Re: [Plugin] UVEditor 0.10

Postby kaas » Tue Apr 15, 2014 12:37 pm

Pixero wrote:I uninstalled and reinstalled v0.2 but nothing is visible in the UV editor. SketchUp 2014, Windows 7 and IE9.

I edited my post above. For v0.2:
On my win7 32bits SU2014 and IE11 the contents are visible but I can't select the move tool.
On my win7 64bits SU2014 and IE11 the contents are not visible.
0

kaas 
 

Re: [Plugin] UVEditor 0.10

Postby jolran » Tue Apr 15, 2014 2:33 pm

ctx.drawImage


Doh! It's a HTML Canvas function call.. I prefer SVG ;)

Anyway. Spits out an error at initialization..

Edit: I can't dig through all your code, but could it be that the "imgresource" needed for the drawImage functioncall is somehow not getting through ?

The dialog is showing up fine without any errors. But when applying a Texture onto a face(any texture from materials palette) and reentering the dialog the JS error occours and persists. No texture is shown on the canvas.
0
User avatar
jolran 
PluginStore Author
PluginStore Author
 

Re: [Plugin] UVEditor 0.30

Postby Marginal » Thu Apr 17, 2014 9:28 pm

I've updated the initial post with version 0.30 which implements Rotate, Scale, exporting UV coordinates, and Project from View. Plus some optimisations and fixes.

Hopefully I've fixed the issues that many people are having on Windows. If you still don't see anything appear in the "UV Editor" window when you select faces, please look in the Ruby Console window: This version prints out the URL of the texture file that it's sending to the UV Editor window. Please let me know if you don't see this, or if it is incorrect. (If it is correct you should be able to copy and paste it into IE's address bar and have IE display the texture file).

Thanks to Aerilius for the code review. I don't have PM privileges so I'll answer here. I've addressed most of your comments, except the following:
- I can't use Point3d's built-in rounding when comparing coordinates - it's way too coarse for UV co-ordinates which have values typically in the range 0->1.
- I have to provide my own version of basename because I need to ensure that the texture file is present in the filesystem and not just embedded in the SketchUp model. And it's possible for the SketchUp model to contain embedded textures with Mac-style pathnames on a PC, and vice versa.
0

Marginal 
 

Re: [Plugin] UVEditor 0.30

Postby SquidCap » Wed May 07, 2014 4:16 pm

SU2014, Win7 32bit and IE11 (probably applies to all SU versions and OS versions..)

Empty screen, nothing on Ruby console. That is if you are using default Sketchup textures. Import your own and it works.

No one should use SU internal textures anyway, they have a habit of mysteriously duplicating themselves (and causing all kinds of havoc with various game engines, specially if the engine is limited to powers of two resolutions, for ex gMotor2...With SU internal textures i've ended up with 2000 duplicates on 2000 tri-count object..) So get in habit of not using them ever, not even as placeholders. I believe there is a way to export all SU textures but that's another topic.

Took me a while to figure this out. Hope it helps
0

SquidCap 
 

Re: [Plugin] UVEditor 0.30

Postby nabil2k6 » Sun May 11, 2014 9:45 am

USEFUL AND VERY INTERSTING
0

nabil2k6 
 

Re: [Plugin] UVEditor 0.30

Postby greenskp » Tue May 13, 2014 6:20 am

Works great but a bit confusing see vertex and edges because the image texture repeats a lot and the uv is not highlighted.

Thanks!
0
User avatar
greenskp 
Premium Member
Premium Member
 

Re: [Plugin] UVEditor 0.30

Postby charly2008 » Tue May 13, 2014 1:19 pm

Hi,

With internet explorer 10 I get this message.
0
He who makes no mistakes, makes nothing
User avatar
charly2008 
 

Re: [Plugin] UVEditor 0.30

Postby Marginal » Thu May 15, 2014 4:58 am

SquidCap wrote:Empty screen, nothing on Ruby console. That is if you are using default Sketchup textures. Import your own and it works.
...
Took me a while to figure this out. Hope it helps
Thanks. I can reproduce the problem with default textures in a model that's never been saved. Will be fixed in the next release.

greenskp wrote:Works great but a bit confusing see vertex and edges because the image texture repeats a lot and the uv is not highlighted.
I agree usability isn't as good as I'd like.
You can turn on "Hidden Geometry" to view the UVs of just Faces you're interested in. Or am I misunderstanding your issue?

charly2008 wrote:With internet explorer 10 I get this message.
I can't reproduce this on Sketchup 8, Windows 7 64bit, IE10 (which I think is your setup). And the error message is useless. Does this occur with all models that you've tried, or just sometimes?
1

Marginal 
 

Re: [Plugin] UVEditor 0.30

Postby dtrarch » Thu May 15, 2014 7:30 pm

Marginal
FYI
Selected UV shows up in the view but none of the tools work.
Firefox default
IE 11 installed

dtr
0

dtrarch 
Premium Member
Premium Member
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: david2d, JacekJacek111, jhayxian, pascal1964 and 32 guests

Visit our sponsors: