SketchyPhysics3 dev
-
if any coder is interesting with updating SketchyPhysics3 to work with 2014 plz we need u here .i am noob BTW.
i did some analyze to the codes, and i did some changes:
1- change support file "plugins" to "Tools" in all "rb" files. now 2 toolbar appears, also the functions can be called.( Sketchy Physics toolbar - Sketchy Physics joint toolbar).
2- copy the file "SketchySolids.rb" from 'SketchyPhysics3' folder to 'Tools' folder. the 3rd toolbar appears and working great no error. (Sketchy Solids toolbar).
3- error with "module SketchyRender" inside 'Newton.rb' line :75 .if(PLATFORM=="i386-mswin32") changed to >>>>> if(RUBY_PLATFORM=="i386-mswin32")
the error passed\fixed.
now i found some problem i couldn't deal with :
1- i think there is problem with analyzing the "OS" and the "ruby version" .
for example ::
result for "RUBY_PLATFORM" in sketchup 7 is"i386-mswin32"
but in sketchup 2014 is "i386-mingw32"
**** i tried to change all "i386-mswin32" to "i386-mingw32" in all "rb" files, but nothing happened because the error no 3 :'126'.
2- i think this file should be upgraded : "win32api.so".
%(#FF4000)[3- there is problem when dealing with 'DLL' files , file "import.rb" inside 'dl' folder.
<RuntimeError: can't find the symbolinit'> line :126 .] %(#00BF00)[#the code for error 3 === " # example: # symbol "foo_value" # symbol "foo_func", "IIP"] %(#FF40BF)[def symbool(name, ty = nil) sym = nil @LIBS.each{|lib| begin if( ty ) sym = lib[name, ty] else sym = lib[name] end rescue next end } if( !sym ) raise(RuntimeError, "can't find the symbol
#{name}'")] # line: 126 , here is the error 3
%(#FF40BF)[end
return sym
end
"] -
The reason you see this error is because Sketchup is trying to load win32-api and dl that was written in Ruby 1.8.6. SU2014 is written in Ruby 2.0.0, and requires that all the .so files are recompiled under its version. To do that, you don't have to recompile 'em because SU2014 already comes with a Ruby library that include dl and win32api for Ruby 2.0.0. All you have to do is check the Ruby version and load the desired dl/win32api. If RUBY_VERSION.to_f > 1.8 {Use Ruby Dl} else {Use Dl in SketchyPhysics}.
I've tried doing these fixes that morning, but did a little more than I was supposed to, which ended up with me creating some another error I will do that again and see if I can fix it. If I do, I will post the code.
BTW, it's pretty nice of you trying to bring SketchyPhysics back. SP was hell of a tool.
In case you didn't know, I've started a project, MSPhysics, similar to SketchyPhysics. It's under the development phase. A stable release (1.0.0) might come soon, but who knows. I haven't made much progress since the pre-alpha release. As well, first MSPhysics version won't work on Macs, so having SketchyPhysics compatible would be a great backup. All I can say to you is good luck!
-
well i didnt know about ur plugin, msphysics wow look awesome, i tested it .its much better plugin . hope u finish it soon ,
i see that u r creating opensource that cool dude, im noob but if u need any hand just tell me .
i will try my best for SP, its the way i learn, i just brought back compospray to 2014, and its feel goood . -
this s the newest update :
1- some if statement use <<if PLATFORM=="i386-mingw32" >> that was working in su7 cuz its return same result as RUBY_PLATFORM -- so change all PLATFORM to RUBY_PLATFORM .
inspector dialog working now.
so for now i think 2 toolbar working fine. last one need lot of work.
as u can see here the method is called and part of it is workin but there is an error some where >next step analyzing the whole codes to know how this things works i think i will see in year
i tried a change but i cannt see any effect : i added the last api to folder
and inside "input.rb" i added :if RUBY_VERSION.to_f < 1.9 require File.join(File.dirname(__FILE__), 'ruby18/win32/api') elsif RUBY_VERSION.to_f < 2.0 require File.join(File.dirname(__FILE__), 'ruby19/win32/api') else require 'rbconfig' if RbConfig;;CONFIG['arch'] =~ /x64/i require File.join(File.dirname(__FILE__), 'ruby2_64/win32/api') else require File.join(File.dirname(__FILE__), 'ruby2_32/win32/api') end end
i found this code with api update > ^_^ even if i dont know what does it mean
-
i did new staff :
1- i found that 126 error was my false error, i was comparing files of su2014 and su7 . there is 2 files named "win32api.so" one inside "Tools" other one inside plugin folder and they has different size '20' '7'. i fixed it.
2-i replaced the "dl" folder with all content with ruby 2 "dl" folder. then i was able to fix problem with "Newton.rb" , "Importabled" changes to "Importer"
E.x >>> extend DL::Importabled >> to extend DL::Importerbut i found new error lol look like thiss endless ,
in old "import.rb" inside 'dl' there was a methode "callback" same as "extern"
and now after replacing the files this error comes up >
<NoMethodError: undefined method `callback'
COLLIDE_CALLBACK = (callback "void doCollideCallback(body*,body*,float,float,float,float)") # thiss the line
i need to know if this method is replaced with another one or removed totally? -
@mtriple said:
<NoMethodError: undefined method `callback'
I came across this error as well.
DL::Importer has a different way to handle callbacks than DL::Importable.
SketchyPhysics can work without this callback, but without it the onTouch, onTouching, and onUntouch events won't work. From my learning i think it should look like this:
<span class="syntaxdefault">if RUBY_VERSION</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_f </span><span class="syntaxkeyword">></span><span class="syntaxdefault"> 1.8<br /> ret </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_VOID<br /> par </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_VOIDP</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_VOIDP</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_FLOAT</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_FLOAT</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Fiddle</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">TYPE_FLOAT</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> COLLIDE_CALLBACK </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> bind_function</span><span class="syntaxkeyword">(;</span><span class="syntaxdefault">collide_callback</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> ret</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> par</span><span class="syntaxkeyword">){</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|*</span><span class="syntaxdefault">args</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> doCollideCallback</span><span class="syntaxkeyword">(*</span><span class="syntaxdefault">args</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br />else<br /></span><span class="syntaxdefault"> COLLIDE_CALLBACK </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">callback </span><span class="syntaxstring">"void doCollideCallback(body*,body*,float,float,float,float)"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end</span>
I haven't tested it cause I came across more errors
The proper way to check operating system is this way. It will work on all SU versions.
<span class="syntaxdefault">if RUBY_PLATFORM </span><span class="syntaxkeyword">=~</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/</span><span class="syntaxdefault">mswin</span><span class="syntaxkeyword">|</span><span class="syntaxdefault">mingw</span><span class="syntaxkeyword">/</span><span class="syntaxdefault">i<br /> </span><span class="syntaxcomment"># do for windows<br /></span><span class="syntaxkeyword">else<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># do for other platforms<br /></span><span class="syntaxdefault">end</span>
-
i added ur fix its good, now i found new one, but dont werry we are close .
"BOOL"
extern "BOOL SetCursorPos(int,int)" inside "input.rb line:25the problem is that "BOOL" is exist inside "types.rb" in "dl"
but there is method "parse_signature" inside "cparser.rb" in "dl" which is calles by "extern" inside "import.rb" in "dl" --- now this method "parse_signature" calls "parse_ctype" which has a array of types and "BOOL" is not exist there .
i passed this problem (i dont know if its right ) by changing "BOOL" to "char"extern "BOOL SetCursorPos(int,int)" >>>>> extern "char SetCursorPos(int,int)"
guess what im now able to create joint items also i used join connector::
but there is no action, i found error :
NoMethodError: undefined method `module_function' for JoyInput:Class>"input.rb" line:141
extern "int initInput()" # here i think this method is changed or it needs an arguments.
extern "int readJoystick(void*)"
extern "void freeInput()" -
if u can help me i need link or reference to learn about ruby and how it deals with api also with dll files .
btw so far idk what API is . lol all i know thats a protected file that has method we need to use.
i wanna start dev plugins.
btw if u need any sourcecode for plugins just tell me. ^_* -
@mtriple said:
if u can help me i need link or reference to learn about ruby and how it deals with api also with dll files .
btw so far idk what API is . lol all i know thats a protected file that has method we need to use.
i wanna start dev plugins.
btw if u need any sourcecode for plugins just tell me. ^_*API is Application Programming Interface. SketchUp API allows you to interact with all entities and a bunch of Sketchup Settings.
See here: http://www.sketchup.com/intl/en/developer/Ruby Docs:
Sketchup 6 and 7 use Ruby Core 1.8.0 : Outdated
Sketchup 8 and 2013 use Ruby Core 1.8.6 : http://ruby-doc.org/core-1.8.6/
Sketchup 2014 uses- Ruby Core 2.0.0 : http://ruby-doc.org/core-2.0.0/
- Ruby Standard Library 2.0.0 : http://ruby-doc.org/stdlib-2.0.0/
-
i think i did every thing i could,
here is last files, changes and last errors:pluginfiles : https://www.dropbox.com/s/wsna08ts859s3ss/sp.zip
1- i added "The proper way to check operating system" as u said
but will not work on sk7 or 8 or 2013 , because of plugins folder name "Tools"
if statement should be added for each: (find support file)2- the error that related to "JoyInput" class, i passed that error at loading by commenting "extern" lines . error type (method or symbol not exist)
- the errors line :
- i wanted to know where is the problem so i used 'ida' to analyze the dll file "WinInput.dll"
the methods was found and has the same type, so all these problem because of the method "extern"
3- new error and the last loading error appears, inside "sound.rb" line :22
extern "void* SDL_RWFromMem(void*,int)"
smae problem (method or symbol not exist), passed by commenting the line.4- now last run : no loading error was found :
but last 2 error still exist, (anyway the 4th toolbar appears)
while using the "play" command the same "JoyInput" class error shows up -
thx alot, i was looking through the code, i found that this "WinInput.dll" error is not exist, i dont know how this happen but :
"class JoyInput" in original file is "module JoyInput".
now its ok.
i compared all files. thiss the only change by mistake.thiss the codes line i changed ( the code that im not sure its valid change)
JointTool.rb :432
SketchyPhysicsTool.rb :1626 :1630 :1631 :1672
sound.rb :76 :74
and for "extern "void* SDL_RWFromMem(void*,int)"
commenting the line is only solution, i analyzed "SDL_mixer.dll" :
SDL_RWFromMem is not exist inside dll file.
i found thees methods "SDL_RWFromFile" "SDL_RWFromFP" only.
i think its a method related to MAC version. -
good news :: i found alot of errors . hehe
alot of name error E.X "NewtonServer.createCollision" >> "NewtonServer.CreateCollision"
C for c ,loooool
its look like ruby 1.8 wasnt case sensitive.now thiss the last unfixed errors :
1- "SketchyPhysicsTool.rb" line:1672
UI.messagebox("Error resetting the simulation:"+" : "+$!+" \n"+e.backtrace[0],MB_OK, "Error")
#<TypeError: no implicit conversion of NoMethodError into String> `+'2- "sound.rb" line:75 (in my code , its maybe different line in urs)
@midi=midiInterface()
#(no method )3- "sound.rb" line:77
SDL.SDL_Init(0x00000010)
#String doesn't compile: undefined methodSDL_Init' for #<MSketchyPhysics3::SPSounds:0xc381498>#<NoMethodError: undefined method
SDL_Init' for #MSketchyPhysics3::SPSounds:0xc381498>i passed this one by adding next code to the top of "class SPSounds" line:65 >>
also by changing "SDL.SDL_Init(0x00000010)" to "SDL_Init(0x00000010)"extend DL;;Importer dlload(Sketchup.find_support_file("SDL.dll","Tools/Sketchyphysics3/sdl/")) extern "int SDL_Init(int)"
4- the control panel appears when play method is called ( i feel good )
u can see in the pic "bodySetMagnet" error it has been fixed "b" to "B"
but this error ::
Error: #<NoMethodError: undefined method `to_ptr' for #String:0xe07b208>
i found that "to_ptr" is exist in both 1.8 and 1.9 but look at there defined:
inside "dl" - "struct.rb"
in 1.9 >>> define_method(:to_ptr){ @entity } #in an other method
in 1.8 >>> def to_ptr
return @ptr
end
so i think the invoking maybe deffer.also same type error "to_a" line:1220 "SketchyPhysicsTool.rb"
5- Error: #<NoMethodError: undefined method
animation' for #<Sketchup::View:0xc1d6520>> sketchyphysicstool.rb:1569:in
draw'
last plugin files :: https://www.dropbox.com/s/xp1fuzsanrsjomr/sp%20fix.zip
-
Hmm, well, it's not the end of the world. You shown that's it's not complicated to fix all the errors, especially thats you're only the begginer. I've started fixing bugs and inconsistencies today and already ~1/10th of the way done. Give me 10 days and I'll post SketchyPhysicsUnoffical.
Edit: 10 days wasn't enough; I thinks 15 would do it.
-
this topic is closed due:
Anton Synytsia just release :
SketchyPhysics 3.3 (Unofficial Release)
http://sketchucation.com/forums/viewtopic.php?f=61%26amp;t=58567
Advertisement