@whaat said:
I had this problem until I made my web dialog objects global.
I could totally believe thats the problem. ie Ruby (correctly) garbage collects when it goes out of scope.
@whaat said:
I had this problem until I made my web dialog objects global.
I could totally believe thats the problem. ie Ruby (correctly) garbage collects when it goes out of scope.
@mike lucey said:
Thanks Adam, everything opened fine. I've printed the instructions
and will read and have go tomorrow.I really like the icons and way you have presented the package. Do
you use a Mac by any chance?Mike
PS: Maybe you have done this already, I haven't checked on the forum.
Is there a Video Tutorial available showing a step by step approach?
Thank you. Yes, I regularly use Macs and PCs though my main machine is a G5 Mac.
I will be posting some video tutorials. Any suggestions as to areas that would benefit most, would be much appreciated.
AdamB
@ilay7k said:
Adam what about if somebody made scene and configured lightUp's options, and remotely sent to other...how to start rendering?
for example your studio-file, i open and what i do to start simulation? when i push TourTool and there is no actions...then add AO and push TT, it works fine
The lighting options etc are all stored with the .skp file so sending it to somebody else will retain that info. The lighting data is created locally and NOT currently saved with the skp file.
The TourTool checks to see whether you've created lighting data and only starts if you have. So creating either Ambient Occlusion or Direct lighting (or both!) will then allow TourToool to start.
Adam
@jclements said:
I downloaded the zip file, went to its properties and unblocked it, but still couldn't extract the contents without the Windows Block Content dialog.
Sounds like you have a virus-checker stopping the installation. Perhaps you should install elsewhere and move the files manually.
@daniel s said:
:?
I must be doing something wrong..
can you post a .skp example like the ones you use to make the images on your web Adam?Daniel S
There you go.
I've put the LightUp Demo for PC and Macintosh on the website. http://www.light-up.co.uk
With great trepidation, I invite you all to give it a whirl. Please read the GettingStarted.pdf
Now where the hell is that corkscrew!
Adam
Sure you could use grep, sed etc but wait, what if we had a scripting language in Sketchup that had good file reading capability, powerful regular expression matching, and a binding to the Sketchup geometry API etc.
I guess we can only hope.
Seriously, something like this works fine:
IO.foreach("my_inputfile.ext") { |aline|
/^(\S*) ([^$]*)/.match(aline)
verb = $1
rest = $2
case verb
....whatever you need to do here eg entities.add_face, entities.add_group etc
}
This is my mickey mouse .obj importer I use for Sketchup:
pos = []
tex = []
group = nil
IO.foreach("/tmp/test.obj") { |aline|
/^(\S*) ([^$]*)/.match(aline)
verb = $1
rest = $2
case verb
when "s"
# ignore smoothing group
when "v"
# close current group
if group
pos = []
tex = []
group = nil
end
/ (\S*) (\S*) (\S*)/.match(rest)
pos.push Geom;;Point3d.new($1.to_f,$2.to_f,$3.to_f)
when "f"
if /(\S*)\/(\S*) (\S*)\/(\S*) (\S*)\/(\S*)/.match(rest)
vertices = [pos[$1.to_i], pos[$3.to_i], pos[$5.to_i]]
elsif /(\S*) (\S*) (\S*)/.match(rest)
vertices = [pos[$1.to_i], pos[$2.to_i], pos[$3.to_i]]
end
group.entities.add_face vertices
when "g"
# open a new group
/(\S*)/.match(rest)
group = Sketchup.active_model.entities.add_group
group.name = $1
puts "group(#{$1})"
end
}
Adam
Well given its one of your countrymen building the webtech, I wouldn't be surprised!
Adam
@jenujacob said:
adam! this is great! cant wait!
one small thing.. i hope u update those images in ur site with higher res ones... those images now have some serious AA problems.. it might turn off a lot of ppl!
Yes, I should explain on the website those are all just screenshots from a tour of the model - ie running at 30Hz. LightUp can generate 9000+ x 6000+ still images if its resolution you want.
Adam
Quick update.
Website is almost up and running - still working on some backend stuff, but have a look: http://www.light-up.co.uk
The plug-in still has some final things I need to do before I release a free, time-limited demo - you'll be able to download it from the website. Of course it will be Mac OSX (PPC and Intel) and PC Win32. The demo is just like the real product but stamps demo labels on stuff, is time limited and I'm expecting a 2-3x performance increase from optimizations for the final release.
So, bear with us, its almost here. Matter of weeks now - and yes, I know thats later than I stated!
Adam
Why don't you just send it in smaller junks with a simple handshake protocol? The receiver just accumulates pieces until its got the whole thing.
Adam
Hi,
I have done some similar work but all in pure Ruby as a proof-of-concept. Rather than decoding AVIs etc directly into OGL textures, my ruby just uses flick-book texture strips. I too don't see myself finishing this off anytime soon so I'm happy to throw this in the pot too!
Adam
Yeah, my solution was just as nasty. I add a reference to a global list and flush the list outside the observer context. Horrid.
BTW I understand Todd's explanation wrt recursive invokation but I found I had problems if I set_attribute in an InstanceObserver too which to me is pretty unreasonable.
Adam
It has to have an effect given each instance of observer has to be dispatched. I'd be wary of going crazy with them.
My 0.02 worth.
Adam
I came to conclusion the set_attribute stuff and observers really don't get along. They are, in my experience, at best very flakey when used together. I gave up setting attributes from within observers all together...quite annoying.
I'd love to hear of any toptips to make it work though..
Adam
[désolé pour l'usage de l'anglais]
Its a very small change to use the Sketchup Texture_writer to dump the actual textures too. If you just add an extra argument to export_material(material) to make it export_material(material, entity), then you can replace my original change with this (the change is after File.exists?):
# AMB added
elsif mat.texture
# check which extension it is
filepath = File.dirname(mat.texture.filename) + "/"
filename = File.basename(mat.texture.filename)
filename = filename.split(".")[0] if filename.split(".").length > 1
[".jpg",".png",".tif",".bmp",".gif",".tga"].each do |ext|
testfile = filepath + filename + ext
unless File.exists?(testfile)
tw = Sketchup.create_texture_writer
tw.load(entity, true)
tw.write(entity, true, testfile)
end
@stream.print "shader {",
"\n\tname \"#{name}\"",
"\n\ttype diffuse",
"\n\ttexture \"#{testfile}\"",
"\n}\n\n"
return name
end
######
Adam
Operator overloading in any language is a lot of rope to hang yourself with. And its always the guy who just discovered that language feature that goes postal with it.
On a related note, I got caught badly while writing some Ruby C extension last month whereby on Win32, ruby.h quietly #defines fopen() and fclose() to be something completely different! Just insane.
Adam
Should be possible because a Tool doesn't have to be of a particular class, it just has to implement an informal protocol. What that means is you can just send onLButtonDoubleClick (or onMButtonDoubleClick) to the Tool and it will do its thing.
Adam
I initially implemented skyboxes in pure Ruby in SU.
# skybox functionality
class MyViewObserver < Sketchup;;ViewObserver
def initialize(stub)
.. build a definition using 'stub' as filepath
skybox = Sketchup.active_model.definitions[dname]
@skybox = Sketchup.active_model.entities.add_instance skybox, Geom;;Transformation.new
@skybox.locked= true
end
def onViewChanged (view)
@skybox.locked= false
@skybox.move! view.camera.eye
@skybox.locked= true
end
def remove
@skybox.locked= false
Sketchup.active_model.entities.erase_entities @skybox
end
end
def add_skybox
$skybox = MyViewObserver.new("~projects/Ruby/skybox/space1")
Sketchup.active_model.active_view.add_observer($skybox)
end
ie Sketchup will move the skybox along with your camera. Works OK - only let down by SU crazily aggressive bounds on Z when it draws.
Adam
@alan fraser said:
Texture Maker will generate a cgi landscape and sky and export it in a variety of formats...including a skybox. Screenshot and result attached below.
Sky boxes are used extensively in games and work very well. They can be used well in SU, as Adam says, but only really from a very fixed viewpoint....that being the centre of the cube.
Games get around this by locking the skybox to the viewer. As you move through a first person perspective shoot-em-up the skybox moves with you, so always appears in the correct perspective and always infinitely distant. This obviously isn't the case in SU.
I realise this thread has drifted slightly away from Ruby, but there's a challenge for somebody.
Skyboxes can work well in SU, but generally only if you move a few feet...or catch a glimpse out of a window, not up and down streets. Of course you can make them really huge, so that any novement by the viewer is very slight in comparison...but then you get clipping problems.The simplest solution is simply to map a panoramic image around a cylinder. Here is a very old thread from the old forum, now transferred to Google Groups. So old, in fact, that it predates SU's ability to map around cylinders, so I had to do it by slicing the image into sections...but the resulting skps still work ok for most situations.