I still haven't isolated the problem. The script works fine on my Snow Leopard laptop but doesn't work on my Lion machine. I've tried different models, different sets of images, etc... It will work sometimes on Lion, but eventually it will crash if I try to more directories of textures (it seems to crash around 20 textures). Since it works fine on Snow Leopard, and this is just a personal script, I'm just going to stick with that for now. (I've also noticed that other, heavy 2D exporting scripts seem to do better on Snow Leopard). Thanks for all of your help.
Latest posts made by cstockman
-
RE: Loading PNG Textures in Ruby plugin and SketchUp freezes
-
RE: Loading PNG Textures in Ruby plugin and SketchUp freezes
Thanks for the replies.
Chris, thanks for moving the post to the Developer forum. This is my first post.
TIG, size is set to 35 elsewhere; I was trying to just simplify the code. Thanks for the tip on basename. I'm somewhat new to Ruby.
Some interesting developments:
The script seems to work on a SketchUp installation on Snow Leopard. I reinstalled SketchUp on my Lion machine, and I was able to get the script to work once using a different directory of textures, but now it's crashing every time again (not freezing this time, just crashing). I'll continue to investigate and post findings.
-
Loading PNG Textures in Ruby plugin and SketchUp freezes
I have a Ruby plugin that attempts to load textures from a directory. The code looks like this:
#jpgs is an array of filenames (with path included). They are actually pngs mats = [] jpgs.each do |j| name = File.split(j)[1] mat = Sketchup.active_model.materials.add(name) mat.texture = j mat.texture.size = size mats << mat end
This code consistently freezes after I load 5 (of 20, in the test case) textures. Specifically, it freezes at the resizing step. If I comment out this step, it will get through 8 textures before freezing.
These texture files are pretty small (~ 8kb), and I have plenty of ram (12GB) on my iMac.
Does anyone have an idea as to what might be happening?
(Probably unrelated, but I also had a problem with a plugin that froze after I called Sketchup.active_model.active_view.camera.set more than ten times in a row. I got around this by breaking the camera_set transformations into loops of five and putting those into a larger loop. I have no idea why this worked. Sketchup freezing is a mystery to me, and I have a difficult time debugging it).
Thanks for your time.