how user interface works [SOLVED]



  • On 21/10/2014 at 10:59, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   13++ 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I'm kinda "LOST" in understanding how user interface works

    what I understand: customizing a simple object plugin, modifying user interface "from text files, .." , and I know that each plugin should have its own area for data, like tags, objects, materials,..

    what I needed to know:
    1- how to do this "graphically" , I checked ResEdit plugin, but couldn't understand how it works
    2- can ResEdit help with "extending" UI? for example I wanna add my render engine in the renderers drop down "standard, physical, software, hardware, cineman, ..others.."

    I know this is kinda a noob question, but I sense that I need to understand it properly, feel free to explain the whole concept on how they work

    what I expect from UI:
    1- layout: buttons, checkboxes, sliders, .....
    2- where it lies: inside xpresso node, material, videopost, ...

    I'm kinda understanding (1) but need to do it graphically, and totally not understanding (2) or the connection between both



  • On 21/10/2014 at 15:55, xxxxxxxx wrote:

    Hi MohamedSakr,

    I'm not sure exactly where you're stuck in terms of understanding the UI, and perhaps even what you can change or add in the overall Cinema 4D UI.  However, I've found a really good tutorial video introducing UI creation and the related programming for Cinema 4D.  You certainly need to know this before trying to do anything more complicated with plugin UI:

    Cinema 4D UI Programming Tutorial

    Please watch it, and if you still have unanswered questions, please post what they are and we'll go from there.

    I hope that helps,

    Joey Gaspe
    SDK Support Engineer



  • On 21/10/2014 at 21:01, xxxxxxxx wrote:

    Hi Joey,

    thanks a lot!! 🙂
    will watch and come back to you



  • On 21/10/2014 at 23:53, xxxxxxxx wrote:

    Hello,

    if you use a VideoPostData plugin to create you own render engine you must use the PLUGINFLAG_VIDEOPOST_ISRENDERER flag in RegisterVideoPostPlugin. Then it will be listed as a Renderer.

    Best wishes,
    Sebastian



  • On 22/10/2014 at 01:17, xxxxxxxx wrote:

    @Sebastian thanks! , so correct me "I'm just trying to figure out the whole image of how the plugin(s) should be formed together"

    there will be 1 VideoPostData registered with PLUGINFLAG_VIDEOPOST_ISRENDERER flag, so it appears in the drop down menu of renderers (will it do anything in Execute?)

    and another VideoPostData for the render settings? which will call RenderEngineCheck() to show/hide my own render settings, and register with the FLAG 0?



  • On 22/10/2014 at 02:58, xxxxxxxx wrote:

    Hello,

    in object orientated programming, an object manages data. So when you add an plugin object to Cinema 4D, this object will do several things:

    • It will load and store it's data (Read(),Write(), CopyTo(), etc.)

    • It will present some GUI so the user can edit it's data (using resource files, SetDParameter, GetDParameter, etc.)

    • It will do something with it's data (Execute(), GetVirtualObjects(),etc.)

    A "Register" function (in most cases) doesn't add something to the scene. With "Register" you inform Cinema that something is available. That's why the renderer is listed in the "Renderer" list as an option. Only when you select that renderer an object is created.

    So when you add your renderer to the scene this object will handle the parameters presented in the Render Settings. But the same object will also be used for actual rendering. (Except of course when you render externally, then a copy of the scene – and everything in it – is used)

    best wishes,
    Sebastian



  • On 22/10/2014 at 03:29, xxxxxxxx wrote:

    Hey Sebastian,

    I totally understand how OOP works 🙂, and I know that every Class has its own data members/functions

    what I thought about "Register" is: it tells Cinema 4D that there is a new type of a specific Class at a specific menu

    so when I create a VideoPostData plugin, and register it with PLUGINFLAG_VIDEOPOST_ISRENDERER flag, it will appear in the drop down menu of renderers (and it contains its own data that I may specify)

    but at the same time, if I want to add a new render settings "similar to VPVisualizeNormals.cpp example, where the flag is 0", this will require another plugin "so 2 plugins, each one with its own data, each one registers at a different place"

    or I understand the whole concept wrong?



  • On 22/10/2014 at 05:09, xxxxxxxx wrote:

    Hi Joey,

    I have watched the videos, I think I understand the UI a lot better now 🙂, thanks a lot
    still need clarification though to my previous post



  • On 22/10/2014 at 06:32, xxxxxxxx wrote:

    Hello,

    "Register" functions are used to inform Cinema about new elements.

    When you use "RegisterVideoPostPlugin" you tell Cinema that a new VideoPostData plugin is added. This new plugin can be found in the Render Settings under "Effects..." where you can add it to the settings. You may (or may not) combine this video post effect with any other effect or renderer.

    When you use the "PLUGINFLAG_VIDEOPOST_ISRENDERER" flag, it is still a VideoPostData plugin. But because it is a renderer it cannot be combined with another renderer. So it becomes part of the "Renderer" list where you can choose it instead of another renderer.

    So a VideoPost with "PLUGINFLAG_VIDEOPOST_ISRENDERER" appears at a different place in the Render Settings because it will become a (little bit) different thing. But in both cases an object will be created that is used in render process.

    If you want to have plugins with different behavior you will have to create two different plugins.

    best wishes,
    Sebastian



  • On 22/10/2014 at 07:01, xxxxxxxx wrote:

    well, I think I have mixed some stuff and I'm getting closer to understand the full picture 

    here is the last question to get everything in place, let's consider the "Renderer" drop down, Standard vs Physical

    here if I choose Physical, a -Physical is appearing in the tree list, which can't be removed "like other Effects that are Registered with flag 0"

    is this the default behavior "I want this behavior" , or the default behavior is the Standard "which doesn't add -Standard in the tree list , for similarity, Hardware, Cineman, Physical are adding that option, while Standard, Software are hiding this option, hope to clarify which flag "or function" is responsible for this

    edit:
    and BTW, I realize now why my question about 2 plugins wasn't making sense, I was mixing between the Effects... in the tree (which is flag 0), and the "-rendererName" which appears "and I don't know how it appears yet", clarify this point and mark it as Solved 🙂



  • On 23/10/2014 at 06:34, xxxxxxxx wrote:

    Hello,

    if you select a plugin renderer it will add an element to the Render Settings list. The Standard and Software renderer won't add something to the list because they are build in types.

    You cannot remove the list element corresponding to your renderer from the list (you can only switch the renderer). But you can remove "ordinary" video post effects.

    Best wishes,
    Sebastian



  • On 23/10/2014 at 07:00, xxxxxxxx wrote:

    thanks for clarification, you can consider this "solved"



  • On 23/10/2014 at 08:35, xxxxxxxx wrote:

    Hi MohamedSakr,

    Here's my answer to your ResEdit question:

    In relation to the UI programming tutorial video, it explains how to create and edit the files in the res directory, or at least the general content.  You may find you have to manually edit the files for more advanced features, but you'll save a lot of time using the editor vs. manually creating the UI data.

    ResEdit Crash Course

    Similar to Visual Studio's UI resource editor, ResEdit allows you to create Cinema 4D plugin dialog data and save it to a .res / c4d_symbols.h file set.

    **To install it:
    **
    1. Download the ZIP in the Plugin Cafe's Additional Downloads section.  
    Note: The Resource Editor for R14 works in R16.

    2. Unzip it to the <Cinema4D install directory>\plugins

    3. Launch Cinema 4D and find it in the Plugins menu

    **To use it:
    **
    1. click on Plugins/ResEdit/Resource Editor...

    2. Spread out the four dialogs that appear and expand the Structure dialog, which is the one containing menus (File / Edit / Language / Options)

    **The four dialogs that appear are:
    **
    Structure:

    ResEdit's main dialog, with File, Edit, Language and Options menus.  It's also the dialog that lists the UI elements that will appear in the dialog being edited.  When you select an element in the list, it highlights and its properties appear in the Properties dialog.  You can reorder the elements by dragging and dropping them in the list.  You can also remove elements by selecting them and pressing delete.  You can't delete the root / default dialog entry, as it represents the minimal valid content for a C4D plugin dialog.

    The File menu has the typical New / Open / Save etc. options.  When you save, it creates a .res file (default name IDD_DIALOG1.res).  If you added at least one element, it will also create a c4d_symbols.h file.  I'll leave it up to you to explore the various other menu options.

    Properties:

    The properties of the currently selected element in the Structure dialog appear here.  The general sections are:

    IDs: The element ID appears in the resource files.

    Alignment: The various values that indicate where the element will appear in the dialog, relative to its order in the Structure list, and its size.

    Extended: If the particular type of element you've selected has additional modifiable settings, they appear here.

    Tools:

    The 17 different UI elements can be added by clicking the button representing a paricular element.  The elements are added to the Structure dialog as a list under the default Dialog element.

    Dialog (preview) :

    When the "Update Preview" button is pressed in the Properties dialog, the content represented by the list of UI elements in the Structure dialog are displayed.  This gives a close, if not exact, 'basic preview' of what the dialog will look like in your plugin, of course lacking any real content beyond that typed into the Properties dialog.

    **Typical workflow:
    **
    1. Clicking on the required element(s) in the Tools dialog

    2. Reorder them if necessary in the Structure dialog

    3. Clicking on each one in the Structure dialog to modify the values in the Property dialog

    4. clicking 'update preview' to see if the Dialog (preview) appears as expected

    5. Saving the dialog files to the plugin's resource directory, which probably means overwriting the header file already there and adding in the .res file

    6. Clicking New to create a new dialog, if necessary, and repeat the steps above

    Repeat as necessary for each new dialog, and then go back to developing the plugin by adding in the necessary code to use the new dialogs and their elements.

    I hope that helps!

    Joey Gaspe
    SDK Support Engineer



  • On 23/10/2014 at 10:01, xxxxxxxx wrote:

    Hi Joey,

    thanks a lot for this help 🙂, thanks to you and Sebastian for the quick and accurate support

    cheers.


Log in to reply