SketchyPhysics3 dev
-
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