Home

C++ SDK USER`S MANUAL 1.0

image

Contents

1. Applications RealFlow sdk examples graviton lib lt Multiple values gt lt Multiple values gt D_MACOSX Applications RealFlow 5 sdk examples graviton That s all Setting Show to Settings Defined at This Leve will reveal all the changes you have made plus some differences in optimization settings between Debug and Release configurations Close the dialog and go back to the main project window Building and deploying the plugin The remaining steps are exactly the same as in Creating a plugin for Mac OS X Just click on Build and copy the resulting my_own_graviton dylib to the plugins daemons folder in your RealFlow 5 installation folder Next Limit Technologies 2010 NEXT LIMIT TECHNOLOGIES Copyright 2010 Next Limit SL RealFlow a registered trademark of Next Limit SL All trademarks included in this catalogue belong to their respective owners All images in this book have been reproduced with the knowledge and prior consent of the artists concerned and no responsibility is accepted by producer publisher or printer for any infringement of copyright or otherwise arising from the contents of this publication Every effort has been made to ensure that credits accurately comply with information supplied
2. You can get set values of these properties the same way that you do with all the other attributes of a RealFlow object You can get a good feel for how you can create and use these attributes in any of the plug in examples provided with the RealFlow package Next Limit Technologies 2010 Adding Property to Plugin Initialize plugin Virtual void initialize add properties etc PlgDescriptor plgDesc Ppty f Strength Ppty createPpty FStrength 2 0f plobese addPprty fstrengthn Ppty fDir Ppty createPpty FDir Vector 1 0 10 0 0 73 plgDesc gt addPpty DIr As you can see basically you create a Property of the type you want by giving it a name and initial value Then you can add it to the PlgDescriptor parameter You can add as many properties as you like Getting amp Setting There is no difference to the standard attributes In the piece of code below you can see some instructions that get set attributes Some of these come from the standard ones and some from the user created ones Their use is exactly the same as you can see in the piece of code below virtual void applyForceToEmitter Daemon thisPlg Emitter emitter int nThread Emitter iterator iter float fStrength FStrength Vector fDir thisPlg gt getParameter lt float gt thisPlg gt getParameter lt Vector gt POLE E bool visible thisPlg gt getParameter lt bool gt visibl
3. Application Wizard Overview These are the current project settings Application Settings Console application Click Finish from any window to accept the current settings After you create the project see the project s readme txt file for information about the project features and files that are generated C SDK User s manual 1 0 36 In Welcome to the Win32 Application Wizard window e Press Next Win3 Application Wizard my_own_graviton Application Settings Overview Application type Add common header files for Application Settings Empty project In Application Settings window choose e Application type DLL e Choose in Additional options Empty Project e Press Finish Next Limit Technologies 2010 amp my_own_graviton Microsoft Visual Studio Test Window Help p o l TA sp Debug Win32 HR EA EA ees a aT at meam Solution Explorer my_own_graviton Start Page BLAA A Solution my_own_graviton 1 project ea Header Files Resource Files E Source Files Microsoft Visual Studio 2008 Recent Projects Get News from Microsoft almy_own_graviton my_own_graviton EA RealFlow_vs2008 Enl_app_framework_vs2008 EH AlILRF Proj GE surface_tension_debug Download the latest information for deve Click here to enable an RSS feed that provides r about new technologies product tips and tricks live Feed also includes informa
4. C scripts E 5 sdk E 2 examples a cmd show _msg_n_times gerstner_wave E graviton O object_ppties 5 surface tension 5 include i lib F 01 Directory structure in your hard disk Next Limit Technologies 2010 C SDK User s manual 1 0 14 Once you have installed RealFlow the system variable RF5PATH must have a value Something like W Program Files Next Limit Rea lFlow 5 This of course will be different in your system depending on where RealFlow has been installed Make sure that this system environment exists and that it points to your RealFlow directory Setting up Development Environment Please refer to the Appendix A to get the details about configuring a development environment from scratch In the next sections we will use the examples provided with RealFlow in which the development environment is already set up Next Limit Technologies 2010 C SDK User s manual 1 0 115 BUILDING A PLUG IN It could be a bit complex to have to set up everything that s needed in a development environment to build plug ins So to ease this task we provide examples for all possible types of plug in These examples are ready to be compiled built and deployed easily in Windows through the Visual Studio C development environment If you want to see the details of the settings used in the environment please go to the Appendix A where details are given We will use one of the examples t
5. Simulation Events Pipeline This will be a brief introduction to the use of the new Simulation Events Pipeline Let s first have a look at the new window Simulations Events Go to the menu Menu Bar gt Layout gt Simulation Events or just press Ctrl F2 The following screen will appear Sec TF RealFlow Simulation Events This is what we call a pipeline of events It is divided in two windows In the bottom half you have what is basically a copy of the old Events Script window now called Master It works in the same way as in RealFlow 4 You can switch it off through the active option in the bottom right corner of the window Next Limit Technologies 2010 The top half of the window works in a similar fashion to the old Events Script window There you had a script window where you could define some methods that were called at specific times in the simulation pipeline So you had for instance a method called onSimulationBegin that was called at the beginning of the simulation We have further developed further this concept into a more modular events manager Now at the same specific times in the simulation pipeline you can choose to run any number of scripts or event plug ins To add a script select the point at which you want it to be called and pressing the right mouse button select the script type from the menu that pops up as is shown in the picture EF RealFlow Simulation Event
6. Wew Group from the Project menu and set the group name to something like RFSDK Library Right click on the group you just created and select Add gt Existing Files A dialog will pop up asking for the files to add Navigate to your RealFlow installation commonly Applications RealFlow 5 and select the file named librfsdk dylib on sdk lib subfolder Right after your selection Xcode will show another dialog asking the way the file must be imported Just make sure Copy items into destination group s folder is not checked and close the dialog by clicking on Add Copy items into destination group s folder if needed Reference Type Default be Text Encoding Unicode UTF 8 4 Recursively create groups for any added folders Create Folder References for any added folders Adding source code You can create a new group and call it something like Source In that group you can add existing source code files usually cpp and h or create new source code files If you decide to create new files right click on the group and select Add gt New file A dialog will show up asking you what type of file you want to create Select C File from the C and C section You will be prompted for the file name and location and an optional header file Next Limit Technologies 2010 Choose a template for your new file W iPhone OS k b A Cocoa Touch Cl
7. apply these steps to all the other types of plug ins in a similar fashion 8 01 Copying From Example The best way to start developing a new daemon is from the Graviton example that can be found in the directory examples graviton of your RealFlow installation Make a copy of the examples graviton folder so you always have a pristine example template that you can use to create new plugins Name the new folder my_own_graviton_own as shown below sdkiexamples Mame Size Type Date Modified cmd show _msq_n_times File Folder 1 29 2010 5 50 PM 2 oerstner_wave File Folder 1 29 2010 5 50 PM Other Places z graviton File Folder 1 29 2010 5 50 PM 9 graviton test File Folder 452010 5 51 PM iy sdk jobject_ppties File Folder 1 29 2010 5 50 PM 5 My Documents release examples File Folder 12912010 5 50 PM C surface tension File Folder 1 29 2010 5 50 PM i Shared Documents Go into the folder my_own_graviton and double click the file graviton vcproj The Visual Studio Environment should open You should see something like the window below Next Limit Technologies 2010 8 graviton Microsoft Visual Studio File Edit view VAssist Project Build Debug Tools Test Window Help Bi ol E IE 3 pos bod 59H aT at 2 Ts FPF E Ay o Cy Le Ch h Debug_Dil gt Win32 Solution Explorer graviton a Solution graviton 1 project E 4 E7 8 02 Change Name project amp source fi
8. precise times in the simulation pipeline You can add this type of plug in to the new Simulation Events window This window replaces the old Events Script window C SDK User s manual 1 0 7 Next Limit Technologies 2010 C SDK User s manual 1 0 8 o PLUG IN TYPES Let s have a brief description of the methods that the developer needs to implement when creating a new Plug in 5 01 All Plug ins getNamelId virtual std string getNamelId const 0 Name that identifies this plug in It is recommended to choose a name that will not likely clash with other plug ins For instance you could name your own Graviton daemon like MyCompany_Graviton where MyCompany stands for the name of your company getClassId virtual int getClassId const 0 This is a unique worldwide ID for your plug in Using the tool provided with RealFlow you will generate a unique worldwide number for your plug in And this method should return that number Get plug in copyright policy virtual std string getCopyRight const 0 This should return a line with information about the copyright holder of this plug in This information will be shown in the User Plug ins manager window Get plug in long description virtual std string getLongDescription const 0 Next Limit Technologies 2010 This should return a line with a long description of what this plug in does Get plug in short descriptio
9. the surface_tension string with the name for your plug in If your plug in is made of several modules you might need to make several modifications to this makefile please refer to the makefile documentation if you want to modify this one Once you have modified the makefile the procedure to compile and install is easy 10 To make sure everything is clean just type realflow GRANJA3 make clean C SDK User s manual 1 0 31 11 Now compile and link realflow GRANJA3 make 12 Now just copy the plugin to the appropriate folder realflow GRANJA3 make install Next Limit Technologies 2010 C SDK User s manual 1 0 32 11 GENERALITIES 11 01 Scene Object There is a single Object in the C SDK that represents the current scene in RealFlow To get it you need to use the line Scene amp scene AppManager instance gt getCurrentScene Once you have a scene object you can call the methods of the scene as defined in the API For instance to add a new cube object to the scene you would use Object obj scene addCube 11 02 Properties You can add properties of different types to all the plug ins except the Event Command ones You add these properties in the method initialize that gets called when a plug in is instantiated All the instances of a Plug in type share the same properties Of course each instance has its own values And those values are saved with the scene
10. This PB Emitter ob int timesBeingCalled int LlocaLlID static anc globalLocaliIiD Degrees float angleBody float angleEmitter be int MyOwnGravitonDaemonSDK globalLocalID 0 PETTITT ITE TIE PL ACE TTI ET IEE ETI ET I TITEL E PI ETT eee FIPEL PTI ITT EES RF SDK DECLARE DAEMON PLUGIN MyOwnGravitonDaemonsSDK REO a pela PEPE CECE TOR EPS Ree Pe Cees eae eee a sea VELLI PET eae 8 05 Target Configuration Have a look at the previous section to choose the right configuration C SDK User s manual 1 0 23 8 06 Compiling amp Linking Go to the menu bar and choose Build Solution There should be no errors and the ouput tab should show 0 errors as shown below The plug in will be compiled and linked It generates a my_own_graviton dll or a my_own_graviton _x64 dll file depending on the platform you chose in the previous step The generated DII can be found in the directory RF5PATH sdk examples my_own_ graviton x64 Release or RFS5PATH sdk examples my_own_graviton Win32 Release if the platform is Win32 8 07 Deploying RealFlow has a directory of plug ins called RF5PATH plugins where there is a subdirectory for each type of plug in Each one of these subdirectories will be scanned recursively and all the plug ins dll found for the associated type will be loaded In our case we just need to copy the generated my_own_graviton_x64 dll or my_own_ grav
11. User s manual 1 0 41 Linker e General Tab e Output File OutDir ProjectName dll e Enable Incremental Linking No INCREMENTAL NO e Additional Library Directory RF5PATH sdk lib e Input e Additional Dependencies rfsdk lib e System e System Windows SUBSYSTEM WINDOWS e Optimization e References Eliminate Unreferenced Data OPT REF e Enable COMDAT Folding Remove Redundant COMDATs OPT ICF e Advanced e Target Machine Machinex86 MACHINE X86 Compiler amp Linker Settings Debug for x64 C Folder e General Tab e Additional Include Directories RF5PATH sdk include e Debug Information Format Program Database Zi e Warning Level Level 3 W3 or Level 4 W4 e Optimization e Optimization Disabled Od e Enable Intrinsic Functions No e Preproccesor e Preprocessor Definitions NDEBUG WIN32 _ WINDOWS _USRDLL e Code Generation e Runtime Library Multi threaded DLL MD e Basic Runtime Checks Both RTC1 equiv to RTCsu Helps to catch some runtime errors Linker e General Tab e Output File OutDir ProjectName _DL dll e Enable Incremental Linking No INCREMENTAL NO e Additional Library Directory RF5PATH sdk lib Next Limit Technologies 2010 e Input e Additional Dependencies rfsdk lib e System e System Windows SUBSYSTEM WINDOWS e Optimization e References Default e Enable COMDAT Folding Default Because this is a Debug mode The opt
12. all the steps to convert an Xcode empty project into a RealFlow plug in which is ready to compile and deploy Xcode Xcode is freely distributed as a bundle on every Mac OS X install disk Please refer to the Xcode Installation Guide at Pe er Eee A es eens ee ICU IACOV VOCIS Next Limit Technologies 2010 If you are registered as an Apple Developer you can get access to extra updated Xcode versions Creating a new project The first thing you have to do is open Xcode and select New Project in the File menu Depending on your Xcode version the amount of project types may vary drastically However there is always the option of creating an Empty Project from the Other section As project name you can use the same as in the Windows section my_own_graviton Choose any location for it OOL Choose a template for your new p P iPhone OS Application Navigation based Applicatic External Build System Window based Application 8 User Templates MacFUSE aa Mac OS X Application Audio Units Automator Action Bundle Command Line Utility Dynamic Library Description This is an empty project with no files targets or build styles Framework Java Kernel Extension Standard Apple Plug ins tatic Library C SDK User s manual 1 0 44 Adding RealFlow C SDK dynamic library Once the project has been created you will be brought to the main project window Click on
13. amelId const return MyOwnGraviton be getCopyRight yirtua al stdiistring GecCopyRioght const Next Limit Technologies 2010 return std string Copyright C 2008 Next Limit Technologies All rights reserved getCopyRight virtual std string getLongDescription const return std string Adds a constant force in a certain direction J getCopyRight virtual std string getShortDescription const return std string Adds Constant Force Initialize plugin add properties etc virtual void initialize PlgDescriptor plgDesc Ppty f Strength Ppty createPpty FStrength 2 0f plgDesc gt addPpty Poty f Dir Ppty 0 0 plgDesc gt addPpty Ppty fPerp Ppty plgDesc gt addPpty Ppty angleIncStep L300 J3 plgDesc gt addPpty virtual void applyForceToEmitter Emitter emitter fStrength createPpty FDir Vector 1 0 1 0 Dir Jz createPpty FPerp 1 0f fPerp Poty createPpoty AnglelncStep angleIncStep Daemon thisPlo PR C SDK User s manual 1 0 PB EMLtter 21teravor iter applyForceToEmitter thisPlg emitter 0 iter Function applyForceToEmitter This function is called by the simulation engine when external forces should be applied to the particles in the emitter Virtual void applyrorcelTommitter Daem
14. asses Ch Code signing C File CGTD Header File Resources User Interfaces K Mac OS X AppleScript Carbon Description A C file with an optional header file 1 From now on the description will continue as if you had added a my_own_graviton cpp file with the same content as in the Building your own Plug in section Creating the plugin target At the moment all your project contains is a source code file and a reference to the RealFlow C SDK dynamic library You need to create a dynamic library that will represent your plug in so click on New target from the Project menu Choose a template for your new target a iPhone OS Cocoa Touch BA macosx namic Library Kernel Extension Carbon Ruby Static Library a Other Shell Tool Object File Cocoa Description Target for building a dynamic library that uses BSD APIs C SDK Users manual 1 0 45 From all the Dynamic Library choices all you need is the cleanest one so you can set up your own flags and dependencies Select the Dynamic Library target from the BSD section After typing a name for your target it will appear on the Groups amp Files section of the project window Right click on it and select Get Jnfo to show a window with the target settings Activate the Bui d tab and set A Configurations as Configuration and Settings Defined at This Leve on Show You can r
15. class GravitonDaemonSDK using namespace std using namespace nextlimit i rf_sdk class GravitonDaemonSDK public Daemon LgSch i Next Limit Technologies 2010 C SDK User s manual 1 0 27 9 05 Deploying The final step to make your plugin work is to copy it into the right RealFlow plug in folder just like for Windows Right click on graviton dylib and select Reveal in Finder This will open a Finder window with the plug in file selected Just drag it to the subfolder plugins daemons of your RealFlow 5 installation and open RealFlow to check if it works in the same way as in the Windows instructions RealFlow 5 gt layouts gt Libs v plugins gt i cmds v daemons graviton dylib Next Limit Technologies 2010 C SDK User s manual 1 0 28 10 CREATING PLUG INS FOR LINUX The best option for creating your own plug in in Linux is to use the makefiles provided with the examples There is one example for every flavor of plug in you can create so you just need to find out what type of plug in you want to create and then use the example provided 10 01 Creating a Command Plug in There is one example in the folder RF_INSTALL_FOLDER sdk examples cmd_show_msg_n_times The makefile in that folder looks as follows Next Limit Technologies 2010 cond _show_msg n_times makefile a c 2010 Next Limit Technologies CC gcc CFLAGS
16. ct_ppties so plugins objects clean rm f object_ppties o object_ppties so To create your own command plug in just replace the object_ppties string with the name for your plug in If your plug in is made of several modules you might need to make several modifications to this makefile please refer to the makefile documentation if you want to modify this one Once you have modified the makefile the procedure to compile and install is easy 7 To make sure everything is clean just type realflow GRANJA3 make clean 8 Now compile and link realflow GRANJA3 make 9 Now just copy the plug in to the appropriate folder realflow GRANJA3 make install Now you should be able to launch RealFlow and use the plug in Next Limit Technologies 2010 10 04 Creating a ParticleSolver Plug in There is one example in the folder RF_INSTALL_FOLDER sdk examples surface_tension The makefile in that folder looks as follows surface tension makefile c 2010 Next Limit Technologies CC gcc CFLAGS pipe fPIC 03 D_LINUX w c INCLUDE I include I include private_sdk surface_tension so surface_tension o CC fPIC shared o lt surface _tension o src surface_tension cpp CC CFLAGS INCLUDE c lt o install cp f surface_tension so plugins particles clean rm f surface tension o surface_tension so To create your own command plug in just replace
17. ction vector curpart iter next Vector forceDirWrld thisPlg gt toWorld finalForce curpart setExternalForce forceDirWrld Force proportional to mass float massObj ob j gt getParameter lt float gt mass forceDirWrld scale massObj Se Se obj gt setForce forceDirWwrld Function applyForceToBody This function is called by the simulation engine Example of the use of Local Vars when external forces should be applied to the body timesBeingCalledtt virtual void applyForceToBody Scene amp scene AppManager instance Daemon thisPlg Object obj gt getCurrentScene std stringstream msg msg lt lt ID lt lt localID lt lt gt applyForceToBody float fstrength thisPlg gt getParameter lt float gt Callos lt lt Eotrength timesBeingCalled Vector fDir thisPlg gt getParameter lt Vector gt scene message msg str SEDLI J3 float angleIncStep thisPlg gt getParameter lt float gt AngleIncStep a a a float fPerp thisPlg gt getParameter lt float gt FPerp Function removeParticles This function is called by the simulation engine fDir normalize when it is safe to remove particles fDir scale fstrength fl SS Sa ee Vector fDirNorm fDir fDirNorm normalize Next Limit Technologies 2010 virtual void removeParticles Daemon plo
18. e is thisPlg gt setParameter thisPlg gt setParameter FPocrengch Strengrh 0 2 J3 visible visible C SDK User s manual 1 0 33 11 03 Local Variables For each RealFlow object Daemon Emitter ParticleSolver Fluid Wave that you add to the scene and that comes from a plug in there is a unique instance of the plug in associated to it What this means is that you can define local variables in the plug in class that will be visible only to your particular instance That local variable will exist as long as the associated RealFlow object stays in the scene Bear in mind that these local variables will not be saved with the scene and that their values will be lost once that the objects are removed from the scene They usually get initialized in the constructor of the Plug in class They can be modified in any of the methods of the plug ins See an example of its use in the Graviton example 11 04 Global Variables Have a look at the Python manual to see which uses you can give to global Variables In essence these are variables that hold their values as long as you stay in the same scene If you load reload a scene or choose to create a new scene then all the global variables will get deleted When you load or when you create a scene or when you start RealFlow you have no global variables You can create global variables from any of the methods of the plug ins even from the Initialize method of th
19. e Library Dependency Inputs navanced Use UNICODE Response Files Command Line release_x64 Property Pages TIR E ON AiR IN H Flathorm MS n t n bl ful i Lonbiguration Manager OutDir ProjectName 64 dll Mok Set No INCREMENT AL NO Yes NOLOGO Mo Mo Mo RF5PATH sdk lib Yes Mo Yes Configuration Manager E Common Properties Additional Dependencies General Ignore All Default Libraries H User Macros Ignore Specific Library BE Ly ca Module Definition File aes Add Module to Assembly iz General Embed Managed Resource File g Input Force Symbol References ue Ee Delay Loaded DLLs i IRE Assembly Link Resource H System H Optimization release_x64 Property Pages risdk_x64 lib Mo f common Properties References General Enable COMDAT Falding H User Macros Optimize For Windows9s E ChC Function Order E Linker Profile Guided Database General Link Time Code Generation Input Manifest File H Debugging H System E ptimization i Fmherdded TMl Contiguration Manager Eliminate Unreferenced Data OPT REF Remove Redundant COMDATSs OPT ICF Default iTargetDitiTargetMame pgd Default Next Limit Technologies 2010 release_x64 Property Pages fe Common Properties Entry Point General Mo Entry Point No User Macros Set Checksum Mo E c Base Address E Linke
20. e id being returned that is the one assigned to the graviton plug in for the one that you just obtained e Change the name used in the macro RF_SDK_DECLARE_DAEMON_PLUGIN from GravitonDaemonSDK to MyOwnGravitonDaemonSDK This macro creates a few functions that RealFlow needs to recognize the new class as a plug in There is a macro for each type of plug in You can see them being used in the example plug ins These are the minimum changes you will need to make to create your very own plug in Of course this plug in will have exactly the same functionality as the graviton one because we have not changed anything related to the behavior of this plug in 8 04 Change behavior We will now change some of the properties and the methods applyForceToEmitter and applyForceToBody to generate a different behavior This simply generates a force that changes over time in a way controlled by the old parameters and the new ones you have added Just play with the parameters to see that it does in fact do something different to the Graviton Daemon See below the code of the new plug in you need to copy Of course feel free to modify it as much as you want Next Limit Technologies 2010 T ETE PIII TT ATPL I TTPO PI TET TT PIT Pea a a eee ise ee eer a a ceges Copyright C 2008 Next Limit Technologies All rights reserved This file is just part of the C SDK examples provided with RealFlow c This file is pr
21. e menu bar and choose Build Solution There should be no errors and the ouput tab should show 0 errors as shown below The plug in will be compiled and linked It generates a graviton dll or a graviton_x64 dll file depending on the platform you chose in the previous step Output on x Show output From Build Sp ste a 1 gt Compiling l gt graviton cpp 1l gt Linking l gt Creating library H Program Files Next Limit RealFlow 5 sdk examples graviton_text x64 Release graviton_x64 lib and object H Program Files Next Limit RealFlow 5 sdk examples graviton_text x64 Release gqraviton_x64 exp l gt Generating code 1l gt Finished generating code 1l gt Embedding manifest 1l gt Build log was saved at file H Program Files Next Limit RealFlow Sisdk examples qraviton text x64 Release BuildLog htm l gt graviton 0 error s 0 warning s Build 1 succeeded 0 failed O up to date 0 skipped Find Results 2 5 Find Results 1 S Output i YVA Find References Results a AE The generated DII can be found in the directory S RF5PATH sdk examples graviton_text x64 Release or RF5PATH sdk examples graviton_text Win32 Release if the platform is Win32 1 04 Deploying RealFlow has a directory of plug ins called RF5PATH p ugins where there is a subdirectory for each type of plug in Each one of these subdirectories will be scanned recursively and all the plug ins dll found f
22. e plug ins All these variables will be accessible through the whole life of the session i e until you change scene in RealFlow for any reason All the methods related to global variables are part of the Scene object So the first thing that is needed is to get a reference to the scene object and then call the method you want This is shown in these basic examples for all the methods to manage global variables e Create Global Variable Scene amp scene AppManager instance gt getCurrentScene Vector amp vec scene createGlobalVariableValue lt Vector gt VectorGlobal Next Limit Technologies 2010 e Get Global Variable Scene amp scene vec Jj AppManager instance gt getCurrentScene scene getGlobalVariableValue lt Vector gt VectorGlobal e Set Global Variable Scene amp scene AppManager instance gt getCurrentScene scene setGlobalVariableValue VectorGlobal Vector 1 0 2 0 3 0 Ve e Remove all Global Variables Scene amp scene AppManager instance gt getCurrentScene scene removeAllGlobalVariables e Check existence of a Global Variable Scene amp scene AppManager instance gt getCurrentScene if scene existsGlobalVariable VectorGlobal DO SOMETHING Observe that some of these methods require that you provide the C type of the variable that you are accessing C SDK User s manual 1 0 34 Next Li
23. ebug release options for the moment Normally you just want to deploy in Release mode but if something fails then you can use the Debug mode to trace your plug in to find and fix bugs in your code Next Limit Technologies 2010 Setting Compilation and Linking Options El Debug_Dil win3z Debug_Dil x64 E Release Wind Release x64 Choose the Property Manager tab This should be just beside your So ution Exp orer tab If it is not visible go to the View menu and choose Property Manager submenu Then it Should appear If it is floating you can embed it just beside the Solution Explorer tab for easy access Expand the my_own_graviton folder to show the above picture Each folder represents a possible configuration to build your plug in As we said before there are 4 possible ways to build a plug in The combinations of the target platform Win32 or X64 plus the mode Release or Debug Generally speaking you should use the Debug mode while you are developing your plug in and switch to Release once you have finished developing Bear in mind that the Debug mode is to help the developer in finding errors but it is not intended to be used at deployment time Debug mode could create huge issues with the performance of the plug in also it exposes information about your plug in that you would usually prefer not to open to everybody using it To be able to choose options for com
24. ele E Den Wtion al ri 5 Leve Project Format Xcode 2 4 compatible i Build l Add Build Setting Condition aandron radiate Add User Defined Setting Place Build Products In f i i gE ee Choose The next step is to set the header and library search paths to point to the RealFlow C SDK location Users reaifiow myplugins my_own_graviton buila Place Intermediate Build Files In Scroll through the settings to the Search Paths section Default intermediates location Build products location i Set the following values Custom location Choose Users reaifiow myplugins my_own_graviton built e Header Search Paths Build independent targets in parallel s RFSDKPATH include In order to use this feature this project and projects it depends on must have correct dependencies defined for all their targets o RFSDKPATH include private_sdk e Library Search Paths Base SDK for All Configurations Mac OS X 10 5 x RFSDKPATH lib SCM Repository None H Hana Seach tee Library Search Paths IE EE NET Now switch to the Build tab Creel gt aches Cancel E Make sure Configuration is set to A Configurations You can leave Show with the A mm Settings value Header Search Paths represent the locations where header files h included in your source code will be searched on at compiling time Library Search Paths represent the locations where third party
25. emove everything except the Product Name This way all the settings will have the default value inherited from the global settings of the project We will check them in the next step talg my_own_g raviton into at Y Comments General Build Rules o i f Configuration All Configurations BR Qy Search in Build Setting Show Settings Defined at Thi Z Setting Vv Packaging Product Name Value my_own_graviton Tweaking project settings This is the most important step Click on Edit Project Settings from the Project menu On the General tab set Base SDK for All Configurations to Mac OS X 10 5 RealFlow is only compatible with Mac OS X version 10 5 or higher Here there is a screenshot to get a reference for all the settings from this tab Next Limit Technologies 2010 C SDK User s manual 1 0 46 AOE Project my_own_graviton Info Click on the gear button located on the bottom left corner to Add a User Defined Setting Set its name to RFSDKPATH and make it point to the sdk folder of your RealFlow General Build Configurations Comments installation It should be something like Applications RealFlow 5 sdk Double quotes Name my_own_graviton must be present to avoid problems with paths containing whitespaces Path Users realflow myplugins my_own_graviton ih EZ Root Edit Definition at This Leve D
26. eral files related to Visual Studio and just one Xcode project graviton xcodeproj Opening that file will launch Xcode The version we are using to illustrate the guide is 3 1 3 on Mac OS X 10 5 8 Newer versions like the one distributed with Snow Leopard may differ Slightly However main views and configuration panels are almost identical PS graviton E5 Groups amp Files 4 graviton cpp pea graviton dylib librfsdk dylib gt Lal Source gt Libs gt 0 Products gt Targets gt 4 Executables gt fa Errors and Warnings Y Q Find Results gt LJ Bookmarks gt E SCM Project Symbols gt jj Implementation Files No Editor gt iy NIB Files If you expand the three groups Source Libs and Products will see the source code file graviton cpp RealFlow C SDK dynamic library librfsdk dylib and the dynamic library created for the plug in graviton dylib C SDK User s manual 1 0 125 9 03 Check library paths In this case librfsdk dylib is successfully located by Xcode Otherwise its name would have appeared on red just like graviton dylib which has not been compiled yet To check the path where librfsdk dylib is being searched right click on it and select Get Info You can select a different location by clicking on Choose Comments Targets librfsdk dylib RFSdk lib librfsdk dylib Name Path No
27. g 30 10 04 Creating a particleSolver plug in Pag 31 11 GENERALITIES 11 01 Scene Object Pag 32 11 02 Properties Pag 32 11 03 Local Variables Pag 33 11 04 Global Variables Pag 33 12 APPENDIXES 12 01 Setting Up Visual Studio from Scratch Pag 35 12 02 Simulation Events Pipeline Pag 42 12 03 Setting Up Xcode from Scratch Pag 43 C SDK User s manual 1 0 3 1 INTRODUCTION C SDK is the new programming interface in RealFlow In version 4 0 our users could enjoy using the Python language to develop scripts to be run inside RealFlow This new SDK brings all the functionality of the Python interface combined with the speed of the C language to deliver a powerful environment that allows the development of really fast plug ins Plug ins that would run at almost the same speed as their counterparts in RealFlow The Python SDK has been improved to allow more access to the RealFlow Engine And the C counterpart has the same functionality though much faster Next Limit Technologies 2010 C SDK User s manual 1 0 4 2 RELATIONSHIP WITH THE PYTHON SDK The Python API and the SDK API are basically the same with some small differences due to the idiosyncrasy of the two languages For instance e Python uses a List object whereas the C SDK uses a std vector Object e Some methods in Python return a variable that could be of several different types the C SDK has to return a wrapper cla
28. gi REALFLOW CH SDK USER S MANUAL 1 0 NEXT LIMIT TECHNOLOGIES 1 INTRODUCTION Introduction Pag 3 2 RELATIONSHIP WITH THE PYTHON SDK Relationship with the Python SDK Pag 4 3 LIMITATIONS Limitations Pag 5 4 INTRODUCTION TO THE DIFFERENT PLUGINS Introduction to the different Plugins Pag 6 5 PLUGIN TYPES 5 01 All Plug ins Pag 8 5 02 Daemon Pag 9 5 03 Object Pag 11 5 04 Particle Solver Pag 11 5 05 Waves Pag 12 5 06 Commands Pag 12 5 07 Events Pag 12 6 SETTING PROGRAMMING ENVIRONMENT 6 01 Setting Programming Enviroment Pag 13 7 BUILDING A PLUG IN 7 01 Copy example Graviton Pag 15 7 02 Target Configuration Pag 16 7 03 Compiling amp Linking Pag 16 7 04 Deploying Pag 16 7 05 Testing the Plug in Pag 17 8 BUILDING YOUR OWN PLUGIN 8 01 Copying From Example Pag 18 8 02 Change Name project amp source file Pag 19 8 03 Creating your own plugin class Pag 19 8 04 Change behavior Pag 19 8 05 Target Configuration Pag 23 8 06 Compiling amp Linking Pag 23 8 07 Deploying Pag 23 8 08 Testing the Plug in Pag 23 9 CREATING A PLUG IN FOR MAC OS X 9 01 locate your realflow installation Pag 24 9 02 Duplicate the graviton example Pag 25 9 03 Check library paths Pag 25 9 04 Compiling amp linking Pag 26 9 05 Deploying Pag 27 10 CREATING PLUG INS FOR LINUX 10 01 Creating a Command Plug in Pag 28 10 02 Creating a Daemon plug in Pag 29 10 03 Creating a object plugin Pa
29. gine that allows the development of instability in the system by the added code leading to the possibility of crashes related to bugs in the C code developed by the user The RealFlow team has tried to prevent as many crashes as possible We have tried hard to catch errors produced in the plug in code and instead of crashing the whole application just inform the user that an error occurred But this is not possible in all the cases So we recommend that plug in developers complete thorough testing of their plug ins before releasing them to the general public Next Limit Technologies 2010 C SDK User s manual 1 0 6 4 INTRODUCTION TO THEDIFFERENT PLUG INS The way of enhancing RealFlow with the C SDK is by means of plug ins A plug in can represent different objects in RealFlow For instance you could develop a new Daemon plug in to remove particles that match certain conditions such as velocity higher than a certain number pressure in certain range and so on This new Daemon will then appears in the menu of daemons You just have to select it and add it to the scene It will behave the same way as any other Daemon You can add any number of these new daemons to the scene There are 5 types of plug ins that you can add Daemon plug in Object plug in ParticleSolver plug in Wave plug in Command plug in Event plug in Lets have a quick look to them Daemon plug in When you program a new daemon plug in
30. he simulation resumes It does nothing by default This is called by the simulation engine when external forces should be applied to a Mist It does nothing by default 1 E E ee ee ee eee 7 Punction cnsinvlarcionstop E ae ee ae a ee a ge Be This function is called by the simulation engine ie Function applyForceToGridFluid J when the simulation Slope This function is called by the simulation engine acetate eR Saas ewe SS eae Sess when external forces should be applied to the grid flaid virtual void onSimulationStop nl rf sdk Daemon plgThis Fon ee SS Re Se Se Sime ee mS a ee ene aire ers virtual void applyForceToGridFluid Hltsre sdk Dacmon plgiiis Hlief Saks Grigpomain obj J7 Next Limit Technologies 2010 E This is called by the simulation engine when the simulation stops It does nothing by default Function onSimulationFrame This function is called by the simulation engine when the simulation starts the computation of the next frame Vilttual void onsimulationrrame nlir sdk Daemon ploris const unsigned int amp frame This is called by the simulation engine when the simulation of a frame starts It does nothing by default Function removeParticles This function is called by the simulation engine when it is safe to remove particles virtual void removeParticles Daemon plgThis PB BMELCSer gt Ob 07 It is called by the simulation engine when it i
31. i threaded DLL MD C SDK User s manual 1 0 39 Release_x64 Property Pages Additional Include Directories Configuratic RFSPATH sdk include Program Database i poate eters f Common Properties A General User Macros Resolve using References Debug Information Format Suppress Startup Banner Warning Level Detect 64 bit Portability Issues Preprocessor Treat Warnings 4s Errors Mo Come Generation Use UNICODE Response Files Yes Language Precompiled Headers Output Files Browse Information Release_x64 Property Pages Common Properties A Preprocessor Definitions General F Ignore Standard Include Path User Macros Generate Preprocessed File g Cit Keep Comments i General ho Cokic i aes Linking Settings Release for x64 e Linker e General Tab e Output File OutDir ProjectName _x64 dll This chooses the name of the plugin dll You can choose whatever name you prefer it s good practice to identify the x64 version in a clear way The same goes for the Debug mode You will see later on that we recommend that you append a D to the dll name e Enable Incremental Linking No INCREMENTAL NO This just increases the speed of linking for projects with multiple files In this case because plugins tend to be small there is no need for this Next Limit Technologies 2010 e Additional Library Directory RF5PATH sdk lib Path to the sdk lib
32. icles Each of these calls will get the number of thread associated as the nThread parameter The method will also get the default partition associated to that thread as an iterator over the partition integrate virtual void integrate ri sdkirParcicleSolver particlesolver ri sdkirEmLiCCer emi tter int nThread RFEmitter IC 1ter float dt This method gets called by the simulation engine when the final position of the particles Next Limit Technologies 2010 must be calculated the integration time dt that RealFlow is using is passed to the function The same considerations about the way of calculation and use of partitions that have been explained in the above method can be directly applied to this calculation getIntegrationTime virtual float getIntegrationTime ri scdki Particlesolver particlesolver The simulation engine will call this method to obtain the length of time of your integration step It will use this to calculate the amount of calls it needs to do to your integration calculations during the calculation of a frame 5 05 Waves virtual void updateWave rE sdk Wave ploThas std vector lt Vertex gt amp vertices const std vector lt Vector gt amp initPosVrtxs This method gets called by the simulation engine when is time to update this wave The method gets the initial position of all the vertices of the wave mesh And it should return a 3D displacement of all these vertexes in the pa
33. imizations need to be off in order to be able to trace the whole code e Advanced e Target Machine Machinex86 MACHINE X86 Now you have a Visual Studio environment ready to start programming For convenience we recommend that you create a folder for your source code Lets create one and call it 1 Src The easiest way to create a new plug in is from a previously existing plug in using this previous one as a template for the new one If for instance you are going to create a new Daemon plug in you can use a starting point the file graviton cpp from the graviton example in the examples folder RF5PATH sdk examples graviton So you will have the next file structure in the my_own_graviton plug in Solution Explorer aleae s ed Solution my own _graviton 1 project El EA my_own_graviton B E src i i my_own_graviton cpp l 5 my own graviton cpp Global Scope 1 RPP PFET Y Pea es OWN graviton cpp zi EE EA Debug_wWin32 vsprops e ff Copyris G Debug_x64 vsprops 4 Be i Ea Release Wind2 vsprops D dd This f i E Release x64 vsprops 6 fit 7 Vf This 5i Zd WARRAN 9 E 10 Pee eee eee 12 include Now go inside the code and start changing the plug in See below the transformed code once the original code has been stripped away and only the skeleton of a Daemon plug in has been left in place C SDK User s manual 1 0 42 12 02
34. iton dll to the folder RF5PATH plugins daemons That s all Now you are ready to use your new plug in Just launch RealFlow You Should now see under the Daemons plugi ns menu your graviton plug in with the name MyOwnGraviton Select it to experiment with it 3 08 Testing the Plug in Go to the plug ins submenu of the Daemons menu and choose the MyOwnGraviton Daemon Next Limit Technologies 2010 C SDK User s manual 1 0 24 9 CREATING A PLUG IN FOR MAC OS X So far you have learnt how to create your own plug ins for Windows RealFlow SDK is available for every platform it is distributed for Windows Mac and Linux The steps to create a new plug in on Mac OS X are very similar to those we have followed on Windows 9 01 Locate your RealFlow installation The most common place to install RealFlow is in the Applications folder RealFlow 5 for Mac features the following folder tree RKealFiow 5 gt layouts Libs gt amp plugins i RealFlow gt ual Scripts v sdk v examples O cmd_show_msg_n_times O gerstner_wave graviton object_ppties GB surface_tension include id private_sdk G rf_sdk lib librfsdk dylib ay Yevir vier x Next Limit Technologies 2010 9 02 Duplicate the Graviton example Just as we did on Windows let s duplicate the graviton folder and rename it something like graviton_text If you navigate into this new folder you will find sev
35. le It is not strictly necessary to identify your plug in but it helps Change the name of the solution from graviton to my_own_graviton Change the name of the project graviton to my_own_graviton And the same for the source file graviton cpp to my_own_graviton cpp You should end up as shown below a my_own_g raviton Microsoft Visual Studio Tools Test Window Help e dels ES Se hha P gt Release od Solution Ty _own_graviton 1 project Si EA my_own_grayviton OE property sheets 5 Release z src Buni Crt HEE ny own graviton cpp C SDK User s manual 1 0 119 8 03 Creating your own plugin class In this section we are going to modify the class graviton into a slightly different one and in this way create a new plug in Open the cpp file my_own_graviton cpp e Change the name of the class GravitonDaemonSDK to MyOwnGravitonDaemonSDK e Change the name that will be shown inside RealFlow for this plug in Go to the method getNameld and change the name being returned to MyOwnGraviton e You will need a new classID for this plug in Every plug in has a unique ID which is used to identify the plug in To obtain a new id you need to run RealFlow and go to the Tools menu and choose Generate Uuid This will give you back an unique ID Now go back to the code and in the method getClassId substitute th
36. le modes of compilation Release and Debug e The platform target It must match the RealFlow one where you are going to deploy the plug in When RealFlow is installed you can choose either to install the Win32 or the x64 version e Mode Type Generally speaking you will use the Debug mode while you are developing your plug in and switch to Release once you have finished developing Bear in mind that the Debug mode is to help the developer in finding errors but it is not intended to be used at deployment time Debug mode could create huge issues with the performance of the plug in also it exposes information about your plug in that you usually would prefer not to open to everybody using it You can choose these different target configurations in the menu bar as is shown on the picture If your RealFlow version is Win32 or x64 choose Win32 or X64 from the menu bar respectively And choose Release mode E my own graviton Microsoft Visual Studio File Edit view WoOssistx Project Build a Se at A ca Debug Tools Test b Ge AL a aa Tat IX Solution Explorer Solution my own gra alae a amp ad Solution my own graviton 1 project i fag my_own graviton Gi ey sre cH ny own graviton cpp my_own_graviton cpp my_own_graviton cpp SD cilmyplugins my_ Global Sepet O L AREE EIET zij oe C SDK User s manual 1 0 16 7 08 Compiling amp Linking Go to th
37. libraries dylib or a will be searched on at linking time Next Limit Technologies 2010 You are just a few more settings away from being able to create your plug in Locate the C C Compiler Version under Compiler Version section This setting must be set to GCC 4 2 At the very top there is an Architectures section Architectures can be set at most to i386 x86_64 ppc Any other architecture will fail to compile because RealFlow C SDK is only compiled for those Base SDK must be set to Mac OS X 10 5 Finally under GCC 4 2 Language section there is an Other C Flags setting Set it to D_MACOSX C SDK User s manual 1 0 47 General Build Configurations Comments 1 in Build Setting Configuration All Configurations H Qv Searc Show Settings Defined at Thi H Setting Value Architectures Architectures lt Multiple values gt e Base SDK Mac OS X 10 5 Build Active Architecture Only B Build Options Debug Information Format lt Multiple values gt YCompiler Version C C Compiler Version GCC 4 2 m Y Deployment Strip Debug Symbols During Copy l Search Paths Header Search Paths Library Search Paths YGCC 4 2 Code Generation Generate Debug Symbols l Level of Debug Symbols Optimization Level YGCC 4 2 Language Other C Flags Vv User Defined RFSDKPATH Applications RealFlow 5 sdk examples graviton
38. mit Technologies 2010 C SDK User s manual 1 0 35 12 APPENDIXES 12 01 Setting Up Visual Studio from Scratch Here we give detailed instructions for how to set up Visual Studio from scratch This may be useful for advanced users that want to have more control over their development environment and also to help understand all the settings that have been chosen to build a plug in This is actually very useful if an user wants to generate a plug in for the different platforms in which RealFlow runs Windows Mac and Linux On this guide we describe how to configure Visual Studio to compile a plug in The steps necessary for other development environments will be quite similar and it should not be difficult to adapt them Setting Project inVisual Studio e Open Visual Studio choose to create a new project The following window will appear Next Limit Technologies 2010 Project types merran E Templates El visual C foe ATL CLR EA win32 Console Application i General Lo MFC My Templates z Smart Device isual Studio installed templates wind2 Project 3 Search Online Templates E Other Languages El Other Project Types El Test Projects 4 project For creating 4 Wind console application Location e Fill in the name field with my_own_graviton or any other name e Choose a location for your project e Press ok Win3 Application Wizard my _own_eraviton Welcome to the Win3
39. n virtual std string getShortDescription const 0 This should return a line with a short description of what this plug in does This will appear in the User Plug ins manager window Is multithreading Virtual bool 1sMT void const return NL true j This tells the RealFlow engine that this Plug in is multithreading That means that RealFlow will call the right method for those methods that have a dual implementation like single threading and multi threading If isMT returns false then the single thread version will be called By default all plug ins are considered multi threaded 5 02 Daemon rae Fld EE ge ee T Ley iy 177 TE ron Led Te ce virtual void applyForceToEmitter Daemon thisPlg PB Emitter emitter PB applyForceToEmitter This function is called by the simulation engine when external forces should be applied to the particles in the emitter Sdk Daemon Owner of this param in out Daemon pigiThis PLl ug in param in out emitter Sdk Emitter which particles will be affected by external forces param in iter Iterator over the Emitter s Particles C SDK User s manual 1 0 9 Emitter iterator iter applyForceToEmitter plgThis Single Threaded version It is called by the simulation engine when external forces should be applied to the particles in the particle based emitter For you convenience you get an iterator that help
40. o show all the steps necessary to build and deploy a plug in In this case the graviton example will be used Imp You need to have the Visual Studio for C installed in your computer 7 01 Copy example Graviton We ll make a copy of the examples so we always have a pristine example template that we can use to create new plug ins Just go to the RealFlow installation directory and make a copy of the folder graviton into a folder called graviton_test as shown below File Edit View Favorites Tools Help tect T gt Pi po Search ea Folders Eak Address i Program FilesiNext LimitiRealFlaw Sisdkiexamples Mame Size Type Date Modified File and Folder Tasks cmd show _msq_n_times File Folder 1 29 2010 5 50 PM 2 oerstner_wave File Folder 1 29 2010 5 50 PM Other Places graviton File Folder 1 29 2010 5 50 PM graviton test File Folder H5 2010 5 51 PM iy sdk jobject_ppties File Folder 1 29 2010 5 50 PM 5 My Documents jrelease_examples File Folder 12912010 5 50 PM Sy Shared Documents 3 surFace_tension File Folder 1 29 2010 5 50 PM Next Limit Technologies 2010 Go into the folder graviton_test and double click the file graviton vcproj The Visual Sudio Enviroment should open You should see something like the window below 02 Target Configuration The plug in can be build for 4 different configurations These result from the combination of two possible platform targets Win32 and X64 and two possib
41. ome potential errors due to repeated path names This is all you need to check to make sure RealFlow plug ins can be compiled on your Mac OS X machine C SDK User s manual 1 0 26 9 04 Compiling amp Linking Now you can go back to the main window of the project and select a configuration that fits your current needs The Active Architecture value is pointless for the plug in since RealFlow will load it on runtime and therefore use the same architecture it is being run on Regarding target architectures RealFlow 5 for Mac is distributed as Intel 32 64 bit and PowerPC 32 bit universal binaries Your plug in only needs to be compiled for the same architecture it is going to be used on However in case you plan to distribute it you should probably compile it for as many architectures as possible Now just click on Build and wait until the plug in is created It should not take too long 40 51 Dahua 1i2k8h v Groups amp Files Il E fe graviton cpp 784K amp graviton dylib amp librfsdk dylib YO Source fe graviton cpp YO Libs 6 librfsdk dylib v Products E graviton dylib Y Targets gt graviton gt 4 Executables gt 2 Errors and Warnings v 4 Find Results 29 gt F Bookmarks 30 gt E SCM 31 Project Symbols 32 ttt ULEI E ULLEL EE LL L ELLEI EE L ELE E EPE LEE EEE L t L E t EL it EE i ttii gt ij implementation Files gt BNIB Files aoao 4 graviton cpp 39 4 M
42. on o CC fPIC shared o lt graviton o src graviton cpp CC CFLAGS INCLUDE c lt o install cp f graviton so plugins daemons clean rm f graviton o graviton so Next Limit Technologies 2010 To create your own command plug in just replace the graviton string with the name of your plug in If your plug in is made of several modules you might need to make several modifications to this makefile please refer to the makefile documentation if you want to modify this one Once you have modified the makefile the procedure to compile and install is easy 4 To make sure everything is clean just type realflow GRANJA3 make clean 5 Now compile and link realflow GRANJA3 make 6 Now just copy the plug in to the appropriate folder realflow GRANJA3 make install Now you should be able to launch RealFlow and use the plug in 10 03 Creating a Object Plugin There is one example in the folder RF INSTALL FOLDER sdk examples object ppties The makefile in that folder looks as follows C SDK User s manual 1 0 30 object_ppties makefile c 2010 Next Limit Technologies CC gcc CFLAGS pipe fPIC 03 D_LINUX w c INCLUDE I include I include private_sdk object_ppties so object_ppties o CC fPIC shared o lt object_ppties o src object_ppties cpp CC CFLAGS INCLUDE c lt o install cp f obje
43. on thisPlo PB Emitter emitter ine Olneead PB EMEtCeritaterator iter float fstrength thisPlg gt getParameter lt float gt FStrength J3 Vector fDir thisPlg gt getParameter lt Vector gt SEDL float angleIncStep thisPlg gt getParameter lt float gt AngleiIncStep float fPerp thisPlo gt oqetParameter lt iloat gt FPerp fDir normalize fDir scale fstrength Vector fDirNorm fDir fDirNorm normalize Vector orthoGonal Vector cross Dir Vector 0 f Perp angleEmitter angleEFmitter angleIncStep orthoGonal rotateAroundAxis fDirNorm angleEmitter Final force applied Vector finalForce Dir orthoGonal 21 Ly U E Next Limit Technologies 2010 C SDK User s manual 1 0 22 apply the daemon transformation to gravity direction Vector orthoGonal Vector cross f Dir Vector 0 1 O vector f Perp unit direction vector Vector forceDirWrld thisPlg gt toWorld finalForce angleBody angleBody angleIncStep assume all particles have the same mass orthoGonal rotateAroundAxis f DirNorm angleBody Particle curpart emitter gt getFirstParticle float massParticle curpart getMass Final force applied Vector finalForce fDir orthoGonal forceDirWrld scale massParticle apply the daemon transformation to gravity direction while iter hasNext vector unit dire
44. or the associated type will be loaded In this case we just need to copy the generated graviton_x64 dll or graviton dll to the folder S RF5PATH plugins daemons Next Limit Technologies 2010 05 Testing the Plug in This plug in is similar to the standard Gravity daemon already part of RealFlow Launch RealFlow add an object for instance a cube click on the Daemon menu and when it pops up go to the plug in menu You should see the graviton daemon select it to add it to the scene Mode Params i rea I ne i T oor plane Scripted Filter The picture above shows the properties of the Graviton plug in Play with them to affect the previously added cube Remember that the cube needs to have the Dynamics properties set to Rigid Body in order for the daemon to have any effect on it Congratulations You have added a new plug in to RealFlow C SDK User s manual 1 0 117 Next Limit Technologies 2010 C SDK User s manual 1 0 18 8 BUILDING YOUR OWN PLUGIN Once you know how to build one of the example plug ins then you are ready to build your own plug in The easiest way to do this is to use one of the examples as a template for the new plug in From there you can make the necessary changes to create your own plug in The steps that are needed to accomplish this are described in detail below We will show how to build your own plug in in this case a new Daemon plug in You can
45. ovided AS IS with NO WARRANTY OF ANY KIND INCLUDING THE WARRANTY OF DESIGN MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE NELPLPIPE TICE IT EPI SEIT a EP Ie PI Pe ea ie PETTITT ATA IT ETI CTL ITT ea ae finclude lt iostream gt Finclude lt sstrean gt include lt string gt include lt rf sdk sdk appmanager h gt tinclude lt r sdk sdk scene h gt finclude lt ri sdk sdk vector h gt include lt rf sdk sdk daemon h gt TiInclude lt ri 8ck Sck p gt particle h gt finclude lt rf sdk sdk pb emitr er h gt tinclude rf sdk sdk ppry h gt tinclude lt rf sdk sdk plgdescriptor k gt include lt rf sdk daemons daemonplgsdk h gt rinclude rir sdk sak rrsdklibdaste h gt include lt rf sdk sdk sdkversion h gt REPEL P II CT TERT ETI TEC I EIT TET EP EPEC TIE ET PT Ee Tae ee Siili using namespace std using namespace nextlimitiirf sdk C SDK User s manual 1 0 20 PELIETEEOITITTT ITI PITT IT PACTS TAT Ta TTI PAT ae PILISI class MyOwnGravitonDaemonSDK public DaemonPlgSdk public i Constructor MyOwnGravitonDaemonSDkK Gives an unigue local Id localID MyOwnGravitonDaemonSDK globalLocalID timesBeingCalled 0 angleBody 0 0f angleEmitter 0 0f Destructor virtual MyOwnGravitonDaemonSDK J 7 Qlass ic Virtual NL INT32 getClassiat Const return id obtained in realflow re Get plugin name virtual std string getN
46. pilation Settings Release for x64 To set settings right click over one of the recently added property sheets and click Open In the window that opens you can see several folders that configure many options related to compilation linking libraries paths and so on which are needed to build an application Don t worry about the quantity in most cases you will not need to change many of them Most of them come with the right value already set Set the values as shown below e C Folder e General Tab e Additional Include Directories RF5PATH sdk include Directory with the library headers e Debug Information Format Program Database Zi Debug information type generated by the compiler e Warning Level Level 3 W3 or Level 4 W4 Related to the detail of warnings you get while compiling Warnings indicate that there could be some problems with the code It will compile but it may be not correct e Optimization e Optimization Maximize Speed O2 e Enable Intrinsic Functions Yes Oi These options are related to the performance of the code generated Please refer to the Visual Studio compiler for more information In general you should not need to change them e Preproccesor e Preprocessor Definitions NDEBUG WIN32 _ WINDOWS _USRDLL Compilation variables These need to be defined only for the Windows version In a Linux or Mac environment they should be not defined e Code Generation e Runtime Library Mult
47. pilation you need to add what is called a property sheet to each configuration This is just a convenient way to group options To do so just right click over each folder and choose Add New Project Property Sheet as shown below E Add New Project Property Sheet IE Add Existing Property Sheet E Unico B Release i he C 2 E ra Remove E Unico Rename C SDK User s manual 1 0 38 Just for convenience give each property sheet a similar name to the configuration that it belongs to As shown below es Templates isual Studio installed templates Property Sheet vsprops My Templates oy Search Online Templates Creates a Visual C project property sheet File Mame Debug x64 Location clmypluginsmy own graviton So you should end up with something like Property Manager my own graviton ail Bla id pa i eee el ea my_own _graviton Sy Debug Win3z Ek Debug_Wing2 ES Core Windows Libraries ES Windows Dynamic Link Library hE Unicode Support oe Pe Ek Debug_x 4 H EE Core Windows Libraries ES Windows Dynamic Link Library EE Unicode Support Release windz E Release_Wing2 HEE Core Windows Libraries RS orem DEE a rt Is Ssa In the next section the different settings that are needed to build plugins will be shown for all the 4 possible configurations Next Limit Technologies 2010 Com
48. pipe fPIC 03 D_LINUX w c INCLUDE I include I include private_sdk cmd _show_msg_n_times so cmd _show_msg n_times o CC fPIC shared o lt cmd show msg n_times o src comd msg n times cpp CC CFLAGS INCLUDE c lt o install cp f c md_show_msg_n_times so plugins cmds clean rm f cmd_show_msg_n_times o cmd_show_msg_n_times so To create your own command plug in just replace the cmd_show_msg_n_times string with the name of your plug in If plug in is made of several modules you might need to make several modifications to this makefile please refer to the makefile documentation if you want to modify this one Once you have modified the makefile the procedure to compile and install is easy 1 To make sure everything is clean just type realflow GRANJA3 make clean 2 Now compile and link realflow GRANJA3 make C SDK User s manual 1 0 29 3 Now just copy the plug in to the appropriate folder realflow GRANJA3 make install Now you should be able to launch RealFlow and use the plug in 10 02 Creating a Daemon Plug in There is one example in the folder S RF INSTALL FOLDER sdk examples graviton The makefile in that folder looks as follows graviton makefile c 2010 Next Limit Technologies CC gcc CFLAGS pipe fPIC 03 D_LINUX w c INCLUDE I include I include private_sdk graviton so gravit
49. r Randomized Base Address Enable Image Randomization iDYNAMICBASE General Fixed Base Oddress Default TAPE Data Execution Prevention DEP Image is compatible with DEP UMZCOMPAT Manifest File Turn OFF Assembly Generation No Debugging System Delay Loaded BLL Don t Support Unload Optimization Import Library Embedded IDL Merge Sections Target Machine MachineX64 MACHINE X64 Profile No CLR Thread Attribute CLR Image Type Command Line E Manifest Tool Librarian No threading attribute set Default image type E Resources Key File H Managed Resources Key Container MIDL Delay Sign No i AML Document Generator Error Reporting Prompt Immediately ERRORREPORT PROMPT E Browse Information a CLR Unmanaged Code Check Mo Build Events z j Entry Point E Custom Build Step The rest of the configurations share the majority of the settings So for them we will show only the differences in configuration to the one above Compiler amp Linker Settings Release for win32 e C Folder e General Tab e Additional Include Directories RF5PATH sdk include e Debug Information Format Program Database Zi e Warning Level Level 3 W3 or Level 4 W4 e Optimization e Optimization Maximize Speed O2 e Enable Intrinsic Functions Yes Oi e Preproccesor e Preprocessor Definitions NDEBUG WIN32 _ WINDOWS _USRDLL e Code Generation e Runtime Library Multi threaded DLL MD C SDK
50. rameter vertices 5 06 Commands Virtual yoid run J This method will get called every time the user launches the command from the GUI interface either by choosing it with the mouse or with the shortcut key combination C SDK User s manual 1 0 112 5 07 Events virtual void run The plug ins that are used to create a command in the GUI user interface are the same that can be used to create Event Commands These Event Commands are added to the Pipeline of the engine through the Simulation Events window Each Event Command will have its method run called whenever the event holder to which it belongs is fired Have a look at the Simulation Pipeline in the Appendix B for clarification Next Limit Technologies 2010 C SDK User s manual 1 0 113 6 SETTING PROGRAMMING ENVIRONMENT There are a few things you need to do before starting to code your shiny new plug in Depending on your environment you may have to do things in a slightly different way But it will be mostly pretty similar System Variables Windows The first step of course is to install the RealFlow package Once you have done this you should have the following directory structure in your hard disk The installation directory may vary E 3 Next Limit E 5 RealFlow 5 O doc fem icons i images gt layouts lib 9 microsofk yc80 crt E E plugins I cmds i daemons gt objects i particles O system O waves
51. raries needed to link a plugin If the plugin needs more external libraries this is the place to add the paths to them Input e Additional Dependencies rfsdk_x64 lib SDK Library used to link a plugin If the plugin needs more external libraries this is the place to add the library files System e System Windows SUBSYSTEM WINDOWS Enviroment that the plugin is compiled for Optimization e References Eliminate Unreferenced Data OPT REF e Enable COMDAT Folding Remove Redundant COMDATs OPT ICF These options are related to the performance of the code generated Please refer to the Visual Studio compiler for more information In general you should not need to change them Advanced e Target Machine Machinex64 MACHINE X64 This is really important It tells the compiler to create the plugin for the x64 environment Both your RealFlow application and the plugins need to match the bits version Either both are Win32 or both are X64 If not the plugins loading will fail C SDK User s manual 1 0 40 Release_x64 Property Pages hiii Bie my Mih Flatron fe Common Properties All Output File General Show Progress H User Macros Version Be C C Enable Incremental Linking E Linker Suppress Startup Banner a Ignore Import Library mR Register Output 4 eal Ge Be Per user Redirection 5 ei Additional Library Directories 7 pimesi Link Library Dependencies z Embedded IDL i Us
52. s SendJob_ 1290597683 Add Script Add Script From File Add From Plugin Fran Expand All SirulatianPost In this screen you can see two scripts already added Let s play with the screen a bit You can Move the scripts to a new location Activate deactivate them Remove them Rename them Edit them Only the Python scripts There are three types of scripts you can add Embedded script in the menu Add Script this lets you write a Python script straight C SDK User s manual 1 0 43 away Script from file Add Script From File this lets you choose a Python file as the script to be called And the last one will be the new type based on the plug in system Script from plugin Add From Plugin lets you choose a Event plug in as the script to be called It is that easy These two windows define events in an independent way You can use whichever suits your needs or you can use both at the same time All the events coming from either window will be run at their corresponding step of the simulation When RealFlow 5 starts it loads all the plug ins so later on you will be able to choose them from the Simulation Events screen Bear in mind that you can use the same Command Event plugins loaded from the plug ins cmds to create either an Event Command or a Command to be run from the GUI interface 12 03 Setting Up Xcode from Scratch In this appendix we describe
53. s safe to remove particles for a particle based fluid The user may leave this method blank if he has no need to delete particles 5 03 Object This Plug in class has no methods defined at the moment In future version of RealFlow we will add more functionality to this plug in type For the moment it just can be used to get and set properties C SDK User s manual 1 0 11 5 04 Particle Solver preComputeInternalForces void preComputelInternalForces et sdk Particlesolver particlesolver ri sdk Emitter emitter This method gets called in a single threaded way by the simulation engine before calling the multi threaded method computeInternalForces It simplifies the preparation calculations that may be needed to compute the internal forces calculations that all threads need to have to compute the forces computeInternalForces virtual void computelInternalForces Pr sdki Particlesolver particlesolver rr sdk Emitter emitter int nThread R Emitter LG iter This method gets called by the simulation engine when it is time to compute the ParticleSolver fluid internal forces In a similar way to Daemon plug in the RealFlow engine creates by default a partition in n subsets of particles associated to the given Emitter N also represents the number of threads that will be used to compute the internal forces So this method will get called n times to produce a complete calculation over all the subsets of part
54. s you to iterate over all the particles of the emitter emitter 0 iter Function applyForceToEmitter This function is called by the simulation engine when external forces should be applied to the particles in the emitter It is only used if the plug in is declared MultiThreading through the isMT method virtual void applyForceToEmitter Daemon thisPl PBR Emitter emitter PR Pmicteririteraror Lrer int nThread OF This is the Multi Threaded version of the above method This method gets called by the simulation engine when is the time to compute the external forces that this Daemon may want to apply to the particles in the given Emitter In a similar way to the Daemon plug in the RealFlow engine creates by default a partition in n subsets of particles associated to the given Emitter N also represents the number of threads that will be used to compute the forces So this method will get called n times to produce a complete calculation Each of these calls will get a number identifying which of the n threads is being used in the call of the method This is given in the nThread parameter The method will also get the default partition associated to that thread as an iterator over that partition Function applyForceToBody This function is called by the simulation engine when external forces should be applied to the body virtual void applyForceToBody Daemon thisPlg Object obj Nex
55. ss that encapsulates the different types that can be returned Next Limit Technologies 2010 C SDK User s manual 1 0 5 3 LIMITATIONS Although you can do a lot of different tasks with the SDK you can t do everything and there are limits it is worth knowing about There are places where you can t perform certain operations or where it s unwise to do so Although not exhaustive the main SDK limits are listed below e Within an event realwave daemon or fluid plug in you cannot create or load a new scene jump to other frames or simulate individual or ranges of time substeps or frames These can only be done within a batch plug in script The reasons for this should be obvious since jumping to an entirely new scene in mid simulation doesn t make a lot of sense and is likely to confuse both you and your workstation e There area variety of parameters that you cannot set via plug ins such as preferences fps and adaptive stepping settings Most of these are not very important to getting results and the ones that are related to simulations e g adaptive steps are not accessible on purpose to avoid confusing the solver e For those plug ins that allow multithreaded execution beware that only a fraction of the methods are thread safe These are marked in the documentation The rest of the methods may cause instability or incorrect behavior in your program As the SDK opens up a lot of the internals of the en
56. t Limit Technologies 2010 C SDK User s manual 1 0 10 E This is called by the simulation engine when external forces should be applied to a grid This is called by the simulation engine when external forces should be applied to a Body based Fluid It does nothing by default It does nothing by default Function applyForceToMultiBody This function is called by the simulation engine when external forces should be applied to the body virtual void applyForceToMultiBody nletrr sdk Dacmon plornis Function onSimulationBegin This function is called by the simulation engine when the simulation begins Virtual void onsimulationBegin nlzirt sdk Daemon plgThis Ja Hiss SdkriM Ll iBoy ONJ This is called by the simulation engine when the simulation begins It does nothing by This is called by the simulation engine when external forces should be applied to a default MultiBody It does nothing by default Function onSimulationResume This function is called by the simulation engine when the simulation resumes Function applyForceToMist This function is called by the simulation engine when external forces should be applied to the mist i emma ae ee ee Se eS aaa a a a aa a a virtual void onSimulationResume nl rf sdk Daemon plgThis yirtcua al void applyrorceloMist nlrtrr sdk Dacmon gt plgthnis Distr sdketMise ob 3 This is called by the simulation engine when t
57. tion about service technology previews and Beta releases of Micrc technologies To view the Microsoft Privacy Polic Tools Options Environment Help Online and ther statement Open Project a pProperty Manager al Solution Explorer i Aas l Fal Show outout From x d Find Results 2 Find Results 1 E Output fy VA Find References Results RealFlow Installation directory Now you have an empty project ready to be customized for developing plug ins But before anything else you need to add support to compile in 64 bits Right now it is ready only to produce code for win32 Adding x64 support e Right Click over your solution s name as shown below File Edit View Wossistx Project Build Debug lol a dh EEO eet Bm Ges Tools Test Ey AS a sla FEFE FPR ma at lht S Solution Explorer my l x F A la Solution my_own graviton 1 project E 22 my_own_graviton s i own graviton C SDK User s manual 1 0 37 Project my own graviton st Wins2 e Choose new Mew Solution Platform ste new project platforms e Make sure you choose the values shown on the above figure e Press Ok Press Close on the Configuration Manager window Done Now your project is ready to compile and build for 4 different configurations Release for Win32 Release for x64 Debug for Win32 Debug for x64 Do not worry too much about the d
58. w let s check the header files are searched fo in the right place when compiling our plug in To do so select Edit Project Settings on the Project menu A new window will pop up showing the global preferences for this Xcode project Click on the Build tab and make sure All Configurations is selected in Configuration Select Settings Defined at This Level on Show to display only those properties that don t have a default value Configurations Comments General At the very bottom there is a section with all the user defined variables In this case you should find one called RFSDKPATH Next Limit Technologies 2010 RFSDKPATH Applications RealFlow 5 sdk examples graviton Based On Nothing lt 2 This variable must point to the RealFlow C SDK folder In this case it is specified as a path relative to the project folder Quotation is important to avoid problems with paths containing whitespaces Header Search Paths Library Search Paths o RFSDKPATH include private_sdk Header Search Paths and Library Search Paths must remain as e Header Search Paths e RFSDKPATH include e RFSDKPATH include private_sdk e Library Search Paths e RFSDKPATH lib You might feel tempted to enable the Recursive checkbox and remove the second entry of the Header Search Paths However leaving it this way will save some compiling time and s
59. you must specialize a base class where you will implement your desired behavior With a daemon plug in you can apply forces to the different dynamic entities in RealFlow you can also remove particles in the case of particle based fluids and even set a velocity field for a mist Wave plug in In a similar fashion to the Daemon plug ins you can write the body of some methods in the Wave Plug in class In this plug in there is only one method which allows you to calculate the 3D displacement of all the points of the RealWave mesh respective of their initial positions Particle Solver plug in This plug in allows you to define the behavior of the particles When the plug in is loaded you will be able to choose it from the drop down menu of particle types Next Limit Technologies 2010 Object plug in You can define your own object with your own properties For version 5 of RealFlow the functionality of this plug in is very limited for instance you can t create geometry for your own object just set and get properties In future versions of RealFlow the capabilities of this plug in will be increased Command plug in As its name states this is used to execute a general set of instructions in the same way as as a Python script does It has just one method run that will be called whenever the command is executed Event plug in This is similar in nature to the Command Plug in It is intended to be added as a set of codes to be executed at

Download Pdf Manuals

image

Related Search

Related Contents

Samsung CLP-775ND Color Laser (33 / 33 ppm) Kullanıcı Klavuzu  F-Secure Mobile Security™  Istruzioni di montaggio IMPORTANTE: LEGGERE  Mode d`emploi et d`entretien 529-530-B  MÉMENTO À L`ATTENTION DU REMPLAÇANT VÉTÉRINAIRE  Brickcom FB-130Ap  Yamaha Current Draw and Heat Dissipation Data for XM/XH Series Data Sheet  308-01-071 旭日M603AA-UL英文无LOGO说明书图框0523  MANUAL DE INVESTIMENTOS  HP TouchSmart 15-r025nr  

Copyright © All rights reserved.
Failed to retrieve file