Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. user168462
    U

    user168462

    @user168462

    0
    Reputation
    6
    Posts
    2
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    user168462 Follow

    Best posts made by user168462

    This user hasn't posted anything yet.

    Latest posts made by user168462

    RE: Compute distance from a point to a mesh

    Hi Ferdinand, thank you for your detailed reply.
    I am looking for hit point. Then if I understand well, my only way would be to use GeRayCollider on all objects ?

    Best,

    posted in Cinema 4D SDK •
    Compute distance from a point to a mesh

    Hi guys,
    I would like to compute the distance from a point to a mesh while editing a document.

    • Requested method:
      - [IN] start point
      - [IN] direction vector
      - [IN] radius (area to look)
      - [OUT] position of a hit if it exist (or a distance to the starting point).

    • Current plugin structure implementation:

      MessagePlugin objects' scene coordinates.

    • Example:
      25623802-38bd-41fd-b275-a79df57dde14-image.png

    Here I would like to know the first element which is hit by the blue line from the camera.
    I took here the camera to have a visualization, however it can be a random start point.

    I considered few options:

    1. Geraycollider: gives the distance if you know the target object, however I don't know it.
    2. VideoPostData plugin to get VolumeData and then use TraceGeometry method. However, it seems that it is not called and the time but only when a rendering is done.

    Do you have any hint or recommended method to do that?

    Thank you in advance
    Best

    posted in Cinema 4D SDK •
    RE: Retrieving camera view volume

    @cairyn Thank you!

    posted in Cinema 4D SDK •
    Retrieving camera view volume

    Hello guys,
    I am working with cameras to do some computation I need to retrieve its current view volume. I call view volume, the visible scene's "cone" from the camera pov.
    See picture below (this cone is visible when the option "Show Cone" in camera object is switched on):
    c4909046-2363-47ec-a65e-cd7b43109806-image.png

    1. Does it exist a function returning this volume no matter what kind of camera is used?

    2. While I can compute it for perspective camera, I couldn't guess the right parameters to compute it for parallel camera.

    
    struct frustum{
     Float farVal, nearVal, right, left, top, bottom;
    }f;
    
    cam = GetCamera()) {
    Float near = 0;
    Float far = 1000;
    Float focusLength= getParam(CAMERAOBJECT_TARGETDISTANCE, DA_REAL, cam).DReal;
    		if (getParam(CAMERAOBJECT_NEAR_CLIPPING_ENABLE, DA_LLONG, cam).DLLong != 0) {
    			near = getParam(CAMERAOBJECT_NEAR_CLIPPING, DA_REAL, cam).DReal;
    		}
    		if (getParam(CAMERAOBJECT_FAR_CLIPPING_ENABLE, DA_LLONG, cam).DLLong != 0) {
    			far = getParam(CAMERAOBJECT_FAR_CLIPPING, DA_REAL, cam).DReal;
    		}
    		auto fov_vertical = getParam(CAMERAOBJECT_FOV_VERTICAL, DA_REAL, cam).DReal;
    
    		
    		auto widthHalf = focusLength * maxon::Tan(fov / 2.0)/100.0;
    		auto heightHalf = focusLength * maxon::Tan(fov_vertical / 2.0) / 100.0;
    		
    		f.farVal = far;
    		f.nearVal = near;
    		f.right = widthHalf;
    		f.left = -f.right;
    		f.top = heightHalf;
    		f.bottom = -f.top;
    		return 0;
    	}
    

    Any help is welcome.
    Thank you in advance

    posted in Cinema 4D SDK •
    RE: Get list of all commands and their associated information

    Thank you m_adam it works perfectly !
    Here is the code if it helps someone

    	AutoAlloc<AtomArray> pList;
    	FilterPluginList(pList, PLUGINTYPE::COMMAND, true);
    	for (size_t i = 0; i < pList->GetCount(); i++)
    	{
    		auto elem = static_cast<BasePlugin*> (pList->GetIndex(i));
    		DiagnosticOutput(elem->GetName()+ ", "+ String::IntToString(elem->GetID())+ ", " + GetCommandHelp(elem->GetID()));
    	}
    

    I have also another question, before I was trying to discover commands thought the menu then I could categorize it.
    Do you think there is a way to collect such information (for instance know that "New project" command is located into file submenu.

    Thanks

    posted in Cinema 4D SDK •
    Get list of all commands and their associated information

    Hello Guys,

    1. Is it possible to get a full list of command ID ?

    For now I understand from different forum posts that the only way is to get it from the command palette (for instance in https://plugincafe.maxon.net/topic/3168/2548_command-id/2)
    For now I am doing this kind of recursion to get a list of command from the ui.
    The code below shows me two kind of results:

      1. IDM_XXX
      2. PLUGIN_CMD_${ID}
    

    The first one is a string while the second contains an id but does not corresponds to the targeted command id.

    void EnumerateCmds(BaseContainer* item) {
    	BrowseContainer bc(item);
    	Int32 id = 0;
    	GeData* dat = nullptr;
    	while (bc.GetNext(&id, &dat))
    	{
    		switch (id) {
    			case MENURESOURCE_SUBMENU:
    				DiagnosticOutput("SUBMENU [");
    				EnumerateCmds(dat->GetContainer());
    				DiagnosticOutput("]");
    				break;
    			case MENURESOURCE_STRING:
    				DiagnosticOutput("MENURESOURCE_STRING " + dat->GetString() + "[");
    				EnumerateCmds(dat->GetContainer());
    				DiagnosticOutput("]");
    				break;
    			case MENURESOURCE_COMMAND:
    				DiagnosticOutput("MENURESOURCE_COMMAND=" + dat->GetString())
    				break;
    			case MENURESOURCE_SEPERATOR:
    				break;
    			case MENURESOURCE_SUBTITLE:
    				DiagnosticOutput("subtitle="+ dat->GetString());
    				break;
    			case MENURESOURCE_MENURESOURCE:
    				DiagnosticOutput("MENURESOURCE_MENURESOURCE=" + dat->GetString() + "[");
    				EnumerateCmds(dat->GetContainer());
    				DiagnosticOutput("]");
    				break;
    			case MENURESOURCE_SUBTITLE_ICONID:
    				DiagnosticOutput("MENURESOURCE_SUBTITLE_ICONID id value: " + dat->GetInt32());
    				break;
    			case MENURESOURCE_ASSET:
    				DiagnosticOutput("MENURESOURCE_ASSET" + dat->GetString() + "[");
    				break;
    			default:
    				DiagnosticOutput("error");
    				break;
    		}
    
    1. Are command's id same for their icon ? Otherwise how could we fetch it?

    Thank you in advance for any help

    Best

    posted in Cinema 4D SDK •