void ImageFileBasicApp::fileDrop( FileDropEvent event ) { try { mTexture = gl::Texture::create( loadImage( loadFile( event.getFile( 0 ) ) ) ); } catch( Exception &exc ) { CI_LOG_EXCEPTION( "failed to load image: " << event.getFile( 0 ), exc ); } }
void fileDrop(FileDropEvent event) { if (event.getNumFiles() > 0) { console() << event.getFile(0); ImageSourceRef img = loadImage(event.getFile(0)); updateOfflineImage(img); } }
void SamplePlayerNodeTestApp::fileDrop( FileDropEvent event ) { const fs::path &filePath = event.getFile( 0 ); CI_LOG_V( "File dropped: " << filePath ); setSourceFile( loadFile( filePath ) ); mSamplePlayerNode->seek( 0 ); CI_LOG_V( "output samplerate: " << mSourceFile->getSampleRate() ); auto bufferPlayer = dynamic_pointer_cast<audio::BufferPlayerNode>( mSamplePlayerNode ); if( bufferPlayer ) { bufferPlayer->loadBuffer( mSourceFile ); mWaveformPlot.load( bufferPlayer->getBuffer(), getWindowBounds() ); } else { auto filePlayer = dynamic_pointer_cast<audio::FilePlayerNode>( mSamplePlayerNode ); CI_ASSERT_MSG( filePlayer, "expected sample player to be either BufferPlayerNode or FilePlayerNode" ); filePlayer->setSourceFile( mSourceFile ); } mLoopBeginSlider.mMax = mLoopEndSlider.mMax = (float)mSamplePlayerNode->getNumSeconds(); CI_LOG_V( "loaded and set new source buffer, channels: " << mSourceFile->getNumChannels() << ", frames: " << mSourceFile->getNumFrames() ); PRINT_GRAPH( audio::master() ); }
void ShaderToyApp::fileDrop( FileDropEvent event ) { // Send all file requests to the loading thread. size_t count = event.getNumFiles(); for( size_t i = 0; i < count && mRequests->isNotFull(); ++i ) mRequests->pushFront( event.getFile( i ) ); }
void DelaunayMeshMaker::fileDrop( FileDropEvent event ){ try { mSurface = loadImage( event.getFile( 0 ) ); int width = mSurface.getWidth(); int height = mSurface.getHeight(); app::setWindowSize( width, height ); mFbo = gl::Fbo( width, height, false ); mBorderPoints.clear(); mBorderPoints.push_back( Vec2f::zero() ); mBorderPoints.push_back( Vec2f( (float)width, 0 ) ); mBorderPoints.push_back( Vec2f( (float)width ,(float)height ) ); mBorderPoints.push_back( Vec2f( 0 ,(float)height ) ); mSteinerPoints.clear(); mMesh.clear(); tesselate(); } catch( ... ) { console() << "unable to load the texture file!" << std::endl; }; }
void ciApp::fileDrop(FileDropEvent event) { player.reset(); player = qtime::MovieGlHap::create(event.getFile(0)); player->setLoop(); player->play(); }
void AudioObjApp::fileDrop( FileDropEvent event ) { fs::path filepath = event.getFile(0); if ( filepath.extension() == ".obj" ) { loadObject( filepath ); } }
void ImageFileBasicApp::fileDrop( FileDropEvent event ) { try { mTexture = gl::Texture::create( loadImage( event.getFile( 0 ) ) ); } catch( ci::Exception &exc ) { console() << "unable to load the texture file, what: " << exc.what() << endl; } }
void ImageFileBasicApp::fileDrop( FileDropEvent event ) { try { mTexture = gl::Texture( loadImage( event.getFile( 0 ) ) ); } catch( ... ) { console() << "unable to load the texture file!" << std::endl; }; }
void ArmyDemoApp::fileDrop( FileDropEvent event ) { try { mSkeletalMesh = model::SkeletalMesh::create( model::AssimpLoader( loadFile( event.getFile(0) ) ) ); } catch( ... ) { console() << "unable to load the asset!" << std::endl; }; }
void ImageRetargetingApp::fileDrop( FileDropEvent event ) { try { initTextures(event.getFile(0)); resetAllWindowsOriginalSize(); } catch( ... ) { console() << "unable to load the texture file!" << std::endl; }; }
void GeometryApp::fileDrop( FileDropEvent event ) { try { gl::Texture::Format fmt; fmt.setAutoInternalFormat(); fmt.setWrap( GL_REPEAT, GL_REPEAT ); mTexture = gl::Texture2d::create( loadImage( event.getFile( 0 ) ), fmt ); } catch( const std::exception &exc ) { } }
void StarsApp::fileDrop( FileDropEvent event ) { for(size_t i=0;i<event.getNumFiles();++i) { fs::path file = event.getFile(i); // skip if not a file if( !fs::is_regular_file( file ) ) continue; if( std::find( mMusicExtensions.begin(), mMusicExtensions.end(), file.extension() ) != mMusicExtensions.end() ) playMusic(file); } }
void cinderFFmpegApp::fileDrop( FileDropEvent event ) { for(int i=0; i<event.getFiles().size(); i++) { std::shared_ptr<_2RealFFmpegWrapper::FFmpegWrapper> fileToLoad = std::shared_ptr<_2RealFFmpegWrapper::FFmpegWrapper>(new _2RealFFmpegWrapper::FFmpegWrapper()); if(fileToLoad->open(event.getFile(i).string())) { m_Players.push_back(fileToLoad); m_VideoTextures.push_back(gl::Texture()); m_Players.back()->play(); } } }
void PostProcessingApp::fileDrop( FileDropEvent event ) { // use the last of the dropped files mFile = event.getFile( event.getNumFiles() - 1 ); try { // try loading image file mImage = gl::Texture( loadImage( mFile ) ); } catch(...) { // otherwise, try loading QuickTime video play( mFile ); } }
void PaintingBeingsApp::fileDrop(FileDropEvent event) { if (_image.loadWithImagePath(event.getFile(0))) { updateInterface(true); _algoGen.setup(_image.getMiniatureSurface()); _imageBeing.setup(_image.getMiniatureSize()); resetCamera(); _launchAlgoGen = true; _showImageBeing = true; setPlay(); } else app::console() << "Erreur lors du chargement de l'image" << std::endl; }
void Genetic_AlgorithmApp::fileDrop(FileDropEvent event) { if (m_captureMode) return; m_imageLoaded.clear(); unsigned int fileCount = event.getNumFiles(); fs::path path; if (fileCount > 0) { for (unsigned int i = 0; i < fileCount; ++i) { try { path = event.getFile(i); m_imageLoaded.push_back(cinder::loadImage(path)); } catch (ci::ImageIoException&) { console() << "Format non supporté pour l'image : " << path.filename() << std::endl; } catch (std::exception&) { console() << "Error occur" << std::endl; } } m_currentImage = m_imageLoaded.front(); m_currentImageLoadedIndex = 0; } setupIHM(); }
void ReymentaHapPlayerApp::fileDrop(FileDropEvent event) { loadMovieFile(event.getFile(0)); }
void MeshViewApp::fileDrop(FileDropEvent event) { loadConfig(event.getFile(0).string()); setupCamera(); }
void TextRenderingApp::fileDrop( FileDropEvent event ) { if( event.getNumFiles() == 1) { // you dropped 1 file, let's try to load it as a SDFF font file fs::path file = event.getFile(0); if(file.extension() == ".sdff") { try { // create a new font and read the file ph::text::FontRef font( new ph::text::Font() ); font->read( loadFile(file) ); // add font to font manager fonts().addFont( font ); // set the text font mTextBox.setFont( font ); } catch( const std::exception &e ) { console() << e.what() << std::endl; } } else { // try to render the file as a text mTextBox.setText( loadString( loadFile(file) ) ); } } else if( event.getNumFiles() == 2 ) { // you dropped 2 files, let's try to create a new SDFF font file fs::path fileA = event.getFile(0); fs::path fileB = event.getFile(1); if(fileA.extension() == ".txt" && fileB.extension() == ".png") { try { // create a new font from an image and a metrics file ph::text::FontRef font( new ph::text::Font() ); font->create( loadFile(fileB), loadFile(fileA) ); // create a compact SDFF file font->write( writeFile( getAssetPath("") / "fonts" / (font->getFamily() + ".sdff") ) ); // add font to font manager fonts().addFont( font ); // set the text font mTextBox.setFont( font ); } catch( const std::exception &e ) { console() << e.what() << std::endl; } } else if(fileB.extension() == ".txt" && fileA.extension() == ".png") { try { // create a new font from an image and a metrics file ph::text::FontRef font( new ph::text::Font() ); font->create( loadFile(fileA), loadFile(fileB) ); // create a compact SDFF file font->write( writeFile( getAssetPath("") / "fonts" / (font->getFamily() + ".sdff") ) ); // add font to font manager fonts().addFont( font ); // set the text font mTextBox.setFont( font ); } catch( const std::exception &e ) { console() << e.what() << std::endl; } } } updateWindowTitle(); }
void SimpleViewerApp::fileDrop( FileDropEvent event ) { load( event.getFile( 0 ) ); }
void QuickTimeSampleApp::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void QuickTimePlayer::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void ardroneApp::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void _TBOX_PREFIX_App::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void QTimeIterApp::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void SphericalStereoApp::fileDrop( FileDropEvent event ) { mPanos.insert( mPanos.begin() + mPanoIndex, Pano{ event.getFile( 0 ) } ); }
void Grove::fileDrop( FileDropEvent evt ) { fs::path path= evt.getFile( 0 ); loadScriptFile(path.string()); }
void EnhanceApp::fileDrop( FileDropEvent event ) { loadMovieFile( event.getFile( 0 ) ); }
void ReymentaServerApp::fileDrop(FileDropEvent event) { int index; string ext = ""; // use the last of the dropped files const fs::path &mPath = event.getFile(event.getNumFiles() - 1); string mFile = mPath.string(); int dotIndex = mFile.find_last_of("."); int slashIndex = mFile.find_last_of("\\"); if (dotIndex != std::string::npos && dotIndex > slashIndex) ext = mFile.substr(mFile.find_last_of(".") + 1); index = (int)(event.getX() / (margin + mParameterBag->mPreviewFboWidth + inBetween));// +1; //mBatchass->log(mFile + " dropped, currentSelectedIndex:" + toString(mParameterBag->currentSelectedIndex) + " x: " + toString(event.getX()) + " PreviewFboWidth: " + toString(mParameterBag->mPreviewFboWidth)); if (ext == "wav" || ext == "mp3") { //mAudio->loadWaveFile(mFile); } else if (ext == "png" || ext == "jpg") { if (index < 1) index = 1; if (index > 3) index = 3; //mTextures->loadImageFile(mParameterBag->currentSelectedIndex, mFile); mBatchass->getTexturesRef()->loadImageFile(index, mFile); } else if (ext == "glsl") { if (index < 4) index = 4; int rtn = mBatchass->getShadersRef()->loadPixelFragmentShaderAtIndex(mFile, index); if (rtn > -1 && rtn < mBatchass->getShadersRef()->getCount()) { mParameterBag->controlValues[22] = 1.0f; // TODO send content via websockets /*fs::path fr = mFile; string name = "unknown"; if (mFile.find_last_of("\\") != std::string::npos) name = mFile.substr(mFile.find_last_of("\\") + 1); if (fs::exists(fr)) { std::string fs = loadString(loadFile(mFile)); if (mParameterBag->mOSCEnabled) mOSC->sendOSCStringMessage("/fs", 0, fs, name); }*/ // save thumb //timeline().apply(&mTimer, 1.0f, 1.0f).finishFn([&]{ saveThumb(); }); } } else if (ext == "mov" || ext == "mp4") { /* if (index < 1) index = 1; if (index > 3) index = 3; mBatchass->getTexturesRef()->loadMovieFile(index, mFile);*/ } else if (ext == "fs") { //mShaders->incrementPreviewIndex(); mBatchass->getShadersRef()->loadFragmentShader(mPath); } else if (ext == "xml") { mBatchass->getWarpsRef()->loadWarps(mFile); } else if (ext == "patchjson") { // try loading patch try { JsonTree patchjson; try { patchjson = JsonTree(loadFile(mFile)); mParameterBag->mCurrentFilePath = mFile; } catch (cinder::JsonTree::Exception exception) { CI_LOG_V("patchjsonparser exception " + mFile + ": " + exception.what()); } //Assets int i = 1; // 0 is audio JsonTree jsons = patchjson.getChild("assets"); for (JsonTree::ConstIter jsonElement = jsons.begin(); jsonElement != jsons.end(); ++jsonElement) { string jsonFileName = jsonElement->getChild("filename").getValue<string>(); int channel = jsonElement->getChild("channel").getValue<int>(); if (channel < mBatchass->getTexturesRef()->getTextureCount()) { CI_LOG_V("asset filename: " + jsonFileName); mBatchass->getTexturesRef()->setTexture(channel, jsonFileName); } i++; } } catch (...) { CI_LOG_V("patchjson parsing error: " + mFile); } } else if (ext == "txt") { // try loading shader parts if (mBatchass->getShadersRef()->loadTextFile(mFile)) { } } else if (ext == "") { // try loading image sequence from dir if (index < 1) index = 1; if (index > 3) index = 3; mBatchass->getTexturesRef()->createFromDir(mFile + "/", index); // or create thumbs from shaders mBatchass->getShadersRef()->createThumbsFromDir(mFile + "/"); } }