Not signed in (Sign In)

Discussion Tag Cloud

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorFüchschen
    • CommentTimeMay 9th 2014 edited
     
    Youtube Link

    this little scriptgenerator will create a fully controlable move up to 256 frames (because 256 frames is the limit of .3ds).
    the download-link will be shown in the youtube description (because i dont want to edit 5 posts in 5 different forums)
    It may looks like it already works perfectly, but i still have a lot to do.
    Im looking forward to release this programm this weekend, but i cant promise you anything :/
  1.  
    =O This is amazing! Yet another game-changing Innovation from you!
    •  
      CommentAuthorFüchschen
    • CommentTimeMay 9th 2014
     
    Just wait until i release my game engine for NL2 ;)
    Yes. I currently playing Pong in NL2 =D
    •  
      CommentAuthorride_op
    • CommentTimeMay 10th 2014
     
    Very cool! How did you accomplish this?

    -Ride_Op
    •  
      CommentAuthorPhyter
    • CommentTimeMay 10th 2014 edited
     
    I have no idea how he's playing Pong. The ride control panel perhaps? That's one of the few feedback interfaces that's available. :)

    As for the animation, I think it's accomplished via the setVisible() method if I'm not mistaken. The logical way this would be done is by creating a 3DS object with 256 quads, each quad being a frame of the animation. The quads are overlapping but only one quad is displayed at a time. When displayed and hidden in sequence, the animation appears to play. The technique is robust, as you can see, since the individual frames can be handled like any texture. If we really wanted to get crazy with this, we could create a mosaic where all frames of the animation existed on one single texture, so that we could create a single material to easily apply vertex deformations, shader core language, UV gen, etc.. My mind reels at the number of effects you could pull off with this addition. :D

    -Kevin
    •  
      CommentAuthorFüchschen
    • CommentTimeMay 15th 2014
     
    I dont think, i will finish this project, because this x-side scripting confuses me 2 much =D

    Maybe in this forum is someone, who has more experience in creating
    scriptgenerators.
    I'll stick to my dynamic classes ;)


    So here is the source code:
    (AutoIT)

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <WindowsConstants.au3>
    #include <FileConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <StringConstants.au3>

    #Region
    $pathToPicture="";
    $activPictures = "";
    $pictureArr = "";
    #EndRegion

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Movie type", 485, 213, 228, 124)
    $Group1 = GUICtrlCreateGroup("Character distance", 8, 24, 230, 137)
    $distanceMeter = GUICtrlCreateInput("", 152, 48, 65, 21)
    $Lable1 = GUICtrlCreateLabel("Distance to the character", 16, 48, 124, 17)
    $repeats = GUICtrlCreateInput("", 152, 80, 65, 21)
    $Label2 = GUICtrlCreateLabel("Amount of movie repeats", 16, 80, 121, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup("Coaster trigger", 240, 24, 230, 137)
    $Label3 = GUICtrlCreateLabel("Amount of movie repeats", 248, 80, 121, 17)
    $Input1 = GUICtrlCreateInput("", 384, 80, 65, 21)
    $Lable4 = GUICtrlCreateLabel("Track Trigger Name", 248, 48, 124, 17)
    $ttn = GUICtrlCreateInput("", 384, 48, 65, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Radio1 = GUICtrlCreateRadio("Activate?", 48, 168, 105, 17)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Radio2 = GUICtrlCreateRadio("Activate?", 312, 168, 113, 17)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Label1 = GUICtrlCreateLabel("Activation conditions", 152, 0, 170, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    GUISetState(@SW_HIDE,$Form2)
    #EndRegion ### END Koda GUI section ###

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("LimeWire", 285, 347, 192, 124)
    $MenuItem1 = GUICtrlCreateMenu("&File")
    $MenuItem2 = GUICtrlCreateMenuItem("Open", $MenuItem1)
    $MenuItem3 = GUICtrlCreateMenuItem("Save", $MenuItem1)
    $MenuItem5 = GUICtrlCreateMenu("&Help")
    $MenuItem4 = GUICtrlCreateMenuItem("Quick Help (F1)", $MenuItem5)
    $MenuItem6 = GUICtrlCreateMenuItem("Tutorial (CTRL+T)", $MenuItem5)
    $List1 = GUICtrlCreateList("", 8, 8, 137, 175)
    $Button1 = GUICtrlCreateButton("Open Pictures", 32, 192, 81, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Render", 176, 8, 89, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Create Script", 176, 48, 89, 25, $WS_GROUP)
    ;GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Button3, $GUI_DISABLE)
    GUISetState(@SW_SHOW,$Form1)
    Dim $Form1_AccelTable[6][2] = [["^f", $MenuItem1],["^o", $MenuItem2],["^s", $MenuItem3],["^h", $MenuItem5],["{F1}", $MenuItem4],["^t", $MenuItem6]]
    GUISetAccelerators($Form1_AccelTable)
    #EndRegion ### END Koda GUI section ###

    Func openPictures()
    Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files."
    Local $sFileOpenDialog = FileOpenDialog($sMessage, @WorkingDir & "\", "Images (*.jpg;*.jpeg;*.png;.gif)", $FD_FILEMUSTEXIST + $FD_MULTISELECT)
    If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.")
    FileChangeDir(@ScriptDir)
    Else
    FileChangeDir(@ScriptDir)
    $temp = StringSplit($sFileOpenDialog,"|")
    $pathToPicture = $temp[1]
    for $i=2 to $temp[0]
    $pictureArr = $temp
    Next
    GUICtrlSetData($List1, $sFileOpenDialog,"|")
    $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF)
    GUICtrlSetState($Button2, $GUI_ENABLE)
    GUICtrlSetState($Button1, $GUI_DISABLE)
    EndIf
    $activPictures = $pictureArr
    EndFunc ;==>Example

    Func saveFile()
    Local Const $sMessage = "Choose a filename."
    Local $sFileSaveDialog = FileSaveDialog($sMessage, @ScriptDir, "Create Folder ()", $FD_PATHMUSTEXIST)
    If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "No file was saved.")
    Else
    Local $sFileName = StringTrimLeft($sFileSaveDialog, StringInStr($sFileSaveDialog, "\", $STR_NOCASESENSE, -1))
    MsgBox($MB_SYSTEMMODAL, "", "You saved the following file:" & @CRLF & $sFileSaveDialog)
    EndIf

    dircreate($sFileSaveDialog)
    dircreate($sFileSaveDialog&"/obj")
    dircreate($sFileSaveDialog&"/skp")

    FileWrite ( $sFileSaveDialog &"/obj/canvas.obj", "# LimeWire Wavefront OBJ Exporter v0.1 - (c) 2014 flash-fox.de"&@CRLF&"mtllib canvas.mtl"&@CRLF)
    FileWrite ( $sFileSaveDialog &"/obj/canvas.mtl", "# LimeWire Wavefront OBJ Exporter v0.1 - (c) 2014 flash-fox.de"&@CRLF)
    for $j=0 to $activPictures[0]
    if ($j >= 256) Then
    MsgBox($MB_SYSTEMMODAL, "", "too many frames! ( >256 ) I saved the file up to this point.")
    Exit 0
    EndIf

    (Sorry: comments is 5013 characters too long. need to split the post)
    •  
      CommentAuthorFüchschen
    • CommentTimeMay 15th 2014
     

    FileWrite ( $sFileSaveDialog &"/obj/canvas.obj", generateObject($j,$j,$pathToPicture) )
    FileWrite ( $sFileSaveDialog &"/obj/canvas.mtl", generateMaterial($j, $j, $pathToPicture))
    FileMove($pictureArr[$j]&"/obj", $sFileSaveDialog,1)
    Next

    GUISetState(@SW_SHOW,$Form2)
    GUISetState(@SW_HIDE,$Form1)
    EndFunc ;==>Example

    Func generateObject($planeNum, $materialNumber, $SavePath)

    Local $planeA = @CRLF&"v 0.0000 -19.6850 19.6850"&@CRLF&"v 0.0000 -19.6850 -19.6850"&@CRLF&"v 0.0000 19.6850 -19.6850"&@CRLF&"v -0.0000 19.6850 19.6850"&@CRLF&"vn 1.0000 0.0000 0.0000"&@CRLF&"vt 0.0000 0.0000 0.0000"&@CRLF&"vt 1.0000 0.0000 0.0000"&@CRLF&"vt 1.0000 1.0000 0.0000"&@CRLF&"vt 0.0000 1.0000 0.0000"&@CRLF&"g frame_"
    Local $planeB = @CRLF&"usemtl M_"&$materialNumber&@CRLF&"s 1"&@CRLF&"f 1/1/1 2/2/1 3/3/1 4/4/1"
    Local $genObj = @CRLF & $planeA & $planeNum & @CRLF & $planeB
    return $genObj
    EndFunc

    Func generateMaterial($materialNum, $picture, $matPath)
    Local $header = @CRLF&"newmtl M_"&$materialNum&@CRLF
    Local $mat = @CRLF&"Ns 10.0000"&@CRLF&"Ni 1.5000"&@CRLF&"d 1.0000"&@CRLF&"Tr 0.0000"&@CRLF&"Tf 1.0000 1.0000 1.0000"&@CRLF&"illum 2"&@CRLF&"Ka 0.5880 0.5880 0.5880"&@CRLF&"Kd 0.5880 0.5880 0.5880"&@CRLF&"Ks 0.0000 0.0000 0.0000"&@CRLF&"Ke 0.0000 0.0000 0.0000"&@CRLF
    Local $ka = @CRLF&"map_Ka "&$matPath&"\"&$activPictures[$picture]&@CRLF
    Local $kd = @CRLF&"map_Kd "&$matPath&"\"&$activPictures[$picture]
    Local $genMat = $header & $mat & $ka & $kd
    Return $genMat
    EndFunc

    Func generateNlvm($option, $triggerName)
    GUISetState(@SW_SHOW,$Form2)
    GUISetState(@SW_HIDE,$Form1)
    if $option = 1 Then

    ElseIf $option = 2 Then

    ElseIf $option = 3 Then

    ElseIf $option = 4 Then

    Else

    EndIf
    Return
    EndFunc

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    openPictures()
    Case $Button2
    ;generateNlvm(1, 2)
    GUISetState(@SW_HIDE,$Form1)
    GUISetState(@SW_SHOW,$Form2)
    saveFile()
    Case $Radio1
    GUISetState(@SW_HIDE,$Form2)
    Case $Radio2
    Case $GUI_EVENT_CLOSE
    Exit

    EndSwitch
    WEnd



    generateObject($planeNum, $materialNumber, $SavePath):
    generates the Wavefront Object. The string produces a square and links it with the material lib

    generateMaterial($materialNum, $picture, $matPath):
    creates a material lib up to 256 textures (because 3ds max has a limit of 256 materials for .3ds files...
    You could increase the limit, if you convert it directly into the .3ds file format.

    generateNlvm($option, $triggerName):
    was planned to switch between different NLVM files.
    e.g.: one for a track trigger, one for a endless loop, ...

    (BTW: most of it already works if you start it with AutoIT. You just have to create the NLVM-File.)

    This is the main NLVM script.
    You have to attach this file (or the nl2script, that links to this file) to the SCO:

    package skp;
    import com.nolimitscoaster.*;

    import skp.de.flashfox.*;



    public class limewire extends Script{
    private SceneObject display;
    private SceneObjectElement frames[];
    private int frameCount = 124; /*FrameCount*/
    private int fps = 25;
    private static SceneObjectElement loadSOE(SceneObject sco, String name){SceneObjectElement elem = sco.getElementForName(name);if (elem == null){System.err.println(name + " not found");System.exit(-1);}return elem;}
    private float count=0;
    private int frame=0;

    private int start;
    //Methods
    stream Stream = new stream();
    //sound Sound = new sound();

    public bool onInit(){

    display = sim.getSceneObjectForEntityId(getParentEntityId());
    frames = new SceneObjectElement[frameCount];
    for(int i=0; i<frameCount; i++){
    frames[i] = loadSOE(display,"frame_"+i);
    frames[i].setVisible(false);
    //System.out.println(frames[i].getName());
    }
    //frames[0].setVisible(false);
    //frames[1].setVisible(false);
    return true;
    }
    public void onNextFrame(float tick){

    if(start < frameCount-1){
    start = Stream.loop(tick, frames, frameCount, fps);
    System.out.println(start);
    }

    }
    }
    •  
      CommentAuthorFüchschen
    • CommentTimeMay 15th 2014 edited
     
    And finally the IMPORT:
    (located in the folder:
    /de/flashfox

    package skp.de.flashfox;
    import com.nolimitscoaster.*;

    public class stream extends Script{
    private float getCount;
    private int getFrame;
    private bool endOfMovie;
    public void test(){
    System.out.println("loop");
    }

    public int loop(float getTick, SceneObjectElement getFrames[], int getFrameCount, int getFPS){
    double nextFrame = 1.0000000f/getFPS;
    getCount += getTick;
    if (getCount >= nextFrame){

    getFrame += 1;
    getFrames[1].setVisible(true);
    getCount = 0;
    System.out.println(getFrame);
    }
    if(getFrame>=getFrameCount){
    getFrame = 0;
    }else if(getFrame == 0){
    getFrames[getFrameCount-1].setVisible(false);
    getFrames[getFrame+1].setVisible(false);
    }else{
    getFrames[getFrame-1].setVisible(false);
    }
    getFrames[getFrame].setVisible(true);
    return getFrame;
    }
    public void sound(){

    }
    }


    Have fun scripting
    -foxy