sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SketchyPhysics3 dev

    Scheduled Pinned Locked Moved SketchyPhysics
    14 Posts 2 Posters 8.8k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mtripleM Offline
      mtriple
      last edited by

      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 .

      compospray workin 2014

      1 Reply Last reply Reply Quote 0
      • mtripleM Offline
        mtriple
        last edited by

        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.

        http://i375.photobucket.com/albums/oo199/mtriple1/Untitled_zps7e5f7a21.jpg


        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 >

        http://i375.photobucket.com/albums/oo199/mtriple1/qUntitled_zps1b23a241.jpg

        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

        compospray workin 2014

        1 Reply Last reply Reply Quote 0
        • mtripleM Offline
          mtriple
          last edited by

          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::Importer

          but 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?

          compospray workin 2014

          1 Reply Last reply Reply Quote 0
          • A Offline
            Anton_S
            last edited by

            @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>
            
            1 Reply Last reply Reply Quote 0
            • mtripleM Offline
              mtriple
              last edited by

              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:25

              the 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::

              http://i375.photobucket.com/albums/oo199/mtriple1/Untitled_zps7d7666d7.jpg

              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()"

              compospray workin 2014

              1 Reply Last reply Reply Quote 0
              • mtripleM Offline
                mtriple
                last edited by

                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. ^_*

                compospray workin 2014

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Anton_S
                  last edited by

                  @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/
                  1 Reply Last reply Reply Quote 0
                  • mtripleM Offline
                    mtriple
                    last edited by

                    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)

                    http://i375.photobucket.com/albums/oo199/mtriple1/1_zps100bf133.jpg

                    • the errors line :

                    http://i375.photobucket.com/albums/oo199/mtriple1/2_zpsc9081d71.jpg

                    • 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"

                    http://i375.photobucket.com/albums/oo199/mtriple1/3_zpsa3c8c1b0.jpg

                    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.

                    http://i375.photobucket.com/albums/oo199/mtriple1/4_zpscd21dbeb.jpg

                    4- now last run : no loading error was found :

                    http://i375.photobucket.com/albums/oo199/mtriple1/5_zps61ca76f7.jpg

                    but last 2 error still exist, (anyway the 4th toolbar appears)
                    while using the "play" command the same "JoyInput" class error shows up

                    http://i375.photobucket.com/albums/oo199/mtriple1/6_zps8042c968.jpg

                    compospray workin 2014

                    1 Reply Last reply Reply Quote 0
                    • mtripleM Offline
                      mtriple
                      last edited by

                      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.

                      compospray workin 2014

                      1 Reply Last reply Reply Quote 0
                      • mtripleM Offline
                        mtriple
                        last edited by

                        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 method SDL_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 )

                        http://i375.photobucket.com/albums/oo199/mtriple1/Untitled_zps51d94a19.jpg

                        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

                        compospray workin 2014

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          Anton_S
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 0
                          • mtripleM Offline
                            mtriple
                            last edited by

                            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

                            compospray workin 2014

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement