Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. r_gigante
    r_gigante

    r_gigante

    @r_gigante

    395
    Reputation
    666
    Posts
    635
    Profile views
    3
    Followers
    0
    Following
    Joined Last Online
    Location Italy Age 46

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

    Best posts made by r_gigante

    RE: Frame all

    Hi WickedP, thanks for reaching us.

    Can you please better explain the final intent of your request? Is the document displayed in viewport (which means it's the active document)? Or is it just a cloned document being hold in "memory"?

    That said, supposing that you've your document displayed in the editor, beside the option to invoke CallCommand, there's no built-in function or method to invoke, but rather, as already depicted by @fwilleke80 you can think of doing something like:

    for each object in all objects:
      get object bounding box center and radius
      evalute the bbox max and min and update the overall bbox
    
    reposition the editor camera target in the center of the overall bbox 
    
    for each overall bbox vertex:
      convert from world to screen space
      verify that's inside the frame of the editing camera 
      if not in frame:
       zoom out a little and recheck if vertex is now in frame
    
    posted in Cinema 4D SDK •
    RE: MAXON Data Type and explicit constructors

    Hi mp5gosu, thanks for following up.

    I see your point, but actually you can still initialize the member variables to a "reasonable" default value helping to identify cases when the class was instantiated without any explicit value.

    A final, additional, side note about initialization: considering that constructors can't return any "evidence" of failure when allocating members we advise against initializing members directly in the constructor.
    We rather suggest implementing an additional Init() method where the members' initialization takes place as shown in the code snippet in the Entity Creation section.

    Best, Riccardo

    posted in Cinema 4D SDK •
    RE: Beginner:How to assign A-material to B-cube by python?

    Hi Ilad, thanks for reaching out us.

    With regard to your request, I warmly recommend to have a look at Materials and Shaders Overview where the basic of Cinema 4D materials and shading handling are discussed. Consider that even if the documentation refers to C++ the described concepts can be applied to Python as well.

    Briefly the solution to your request is:

    def main():
        # get first object
        cubeA = doc.GetActiveObject()
        if cubeA is None: 
           return
       
        # get second object
        cubeB = op.GetNext()
        if cubeB is None:
            cubeB = op.GetPred()
        
        #get first material
        matA = doc.GetActiveMaterial()
        if matA is None: 
            return
        
        # get second material
        matB = matA.GetNext()
        if matB is None:
            matB = matA.GetPred()
        
        # create the texture tags for A and B
        ttagA = c4d.TextureTag()
        ttagB = c4d.TextureTag()
        
        # assign the swapped materials to the texture tags
        ttagA.SetMaterial(matB)
        ttagB.SetMaterial(matA)
        
        # insert the tags to the corresponding objects
        cubeA.InsertTag(ttagA)
        cubeB.InsertTag(ttagB)
        
        # queue an event
        c4d.EventAdd()
    

    Last but not least, it's recommended for future threads to use the appropriate category and mark it as "Ask as a question" upon creation.

    Best, Riccardo

    posted in Cinema 4D SDK •
    RE: Recent spam boom

    Hi guys, thanks for your comments on the topic. We do appreciate your effort in trying to keep this place tidy and clean.

    We've considered a few options and a better spam-prevention mechanism are now in place.

    Cheers, R

    posted in Maxon Announcements •
    RE: How to set project scale

    Hi Rage thanks for reaching us.

    With regard to your question, please consider that it was already discussed in the past in this thread.

    Long story short you can set the scene scale simply using

    def main():
        # check the current values for the currently active scene
        # for default scene it returns (1.0, 3) where scale is "1.0" and unit is "cm"
        print "current scale:", doc[c4d.DOCUMENT_DOCUNIT].GetUnitScale()
    
        # instantiate an UnitScaleData()
        sclData = c4d.UnitScaleData()
        # set the data accordingly to your needs
        # e.g. scale by 10x and set to mm units 
        sclData.SetUnitScale(10, c4d.DOCUMENT_UNIT_MM)
        # set the proper parameter in the active doc
        doc[c4d.DOCUMENT_DOCUNIT] = sclData
        # fire an EventAdd() 
        c4d.EventAdd()
    
        # check the new value
        print "new scale:", doc[c4d.DOCUMENT_DOCUNIT].GetUnitScale()
    

    Finally, to speed up your issues' resolution, I warmly encourage making use of the search function.

    Best, Riccardo

    posted in General Talk •
    RE: VPBUFFER_OBJECTBUFFER is not rendered correctly

    Hi Petros, sorry for getting late here.

    I've tried to replicate the behavior you're reporting, but unfortunately I've succeeded in.
    The way i usually handle buffer fill-up in VPData is :

    ...
    VPBuffer* rgba = render->GetBuffer(VPBUFFER_RGBA, 0);
    Int32 rgbaBufferCPP = NOTOK, rgbaBufferDepth = NOTOK, rgbaBufferWidth = NOTOK, rgbaBufferHeight = NOTOK;
    if (rgba)
    {
        rgbaBufferCPP = rgba->GetInfo(VPGETINFO::CPP);
        rgbaBufferDepth = rgba->GetInfo(VPGETINFO::BITDEPTH);
        rgbaBufferWidth = rgba->GetInfo(VPGETINFO::XRESOLUTION);
        rgbaBufferHeight = rgba->GetInfo(VPGETINFO::YRESOLUTION);
        DiagnosticOutput("rgbaBuffer: @ / @ / @ / @", rgbaBufferCPP, rgbaBufferDepth, rgbaBufferWidth, rgbaBufferHeight);
        
        if (rgbaBufferDepth == 32)
        {
            iferr (rgbaBuffer = NewMemClear(Float32, rgbaBufferWidth * rgbaBufferCPP))
            {
                CriticalOutput("Failed to allocate rgba 32-bit buffer");
                return RENDERRESULT::OUTOFMEMORY;
            };
        }
        else
        {
            iferr (rgbaBuffer = NewMemClear(UChar, rgbaBufferWidth * rgbaBufferCPP))
            {
                CriticalOutput("Failed to allocate rgba 8-bit buffer");
                return RENDERRESULT::OUTOFMEMORY;
            };
        }
    }
    
    Float percent = 0.0;
    while (percent < 1.0)
    {
        for (Int32 i = 0; i < rgbaBufferHeight; i++)
        {
            if (rgbaBuffer)
            {
                if (rgbaBufferDepth == 32)
                    r_gigante::FillBufferWithRandomValues((Float32*)rgbaBuffer, rgbaBufferWidth, rgbaBufferCPP);
                else
                    r_gigante::FillBufferWithRandomValues((UChar*)rgbaBuffer, rgbaBufferWidth, rgbaBufferCPP);
            
                rgba->SetLine(0, i, rgbaBufferWidth, rgbaBuffer, rgbaBufferDepth, true);
            }
            
            if (thread->TestBreak())
            {
                if (rgbaBuffer)
                    DeleteMem(rgbaBuffer);
                return RENDERRESULT::USERBREAK;
            }
        }
    } 
    ...
    

    where FillBufferWithRandomValues is

    void FillBufferWithRandomValues(Float32* buffer, UInt32 bufferSize, UInt32 channels/* = 4*/)
    {
    	Random rng;
    	rng.Init(UInt32(rand()));
    	if (channels == 4)
    	{
    		for (UInt32 i = 0; i < bufferSize; i++)
    		{
    			buffer[i * channels + 0] = Float32(rng.Get01());
    			buffer[i * channels + 1] = Float32(rng.Get01());
    			buffer[i * channels + 2] = Float32(rng.Get01());
    			buffer[i * channels + 3] = Float32(0);
    		}
    		return;
    	}
    	
    	if (channels == 3)
    	{
    		for (UInt32 i = 0; i < bufferSize; i++)
    		{
    			buffer[i * channels + 0] = Float32(rng.Get01());
    			buffer[i * channels + 1] = Float32(rng.Get01());
    			buffer[i * channels + 2] = Float32(rng.Get01());
    		}
    		return;
    	}
    	
    	if (channels == 1)
    	{
    		for (UInt32 i = 0; i < bufferSize; i++)
    		{
    			buffer[i * channels + 0] = Float32(rng.Get01());
    		}
    		return;
    	}
    }
    

    (NOTE - in my code the FillBufferWithRandomValues has definition for both 8-bit and 32-bit buffers)

    If you can provide with a complete example showing your issue, I'd be glad to look into, but being blind to your code I really can't be more helpful.
    With regard to the second question, I think the above code properly answers here.

    In case you got your issue fixed, please mark this thread as solved.

    Best, Riccardo

    posted in Cinema 4D SDK •
    RE: Compute the Area of an Irregular Polygon?

    Hi Bentraje,

    with regard to computing the area of a non self-intersecting planar polygon you can use:

    # area of a polygon using 
    # shoelace formula 
      
    # (X[i], Y[i]) are coordinates of i'th point. 
    
    def polygonArea(X, Y, n): 
        # Initialze area 
        area = 0.0
    
        # Calculate value of shoelace formula 
        j = n - 1
        for i in range(0,n): 
            area += (X[j] + X[i]) * (Y[j] - Y[i]) 
            j = i   # j is previous vertex to i
        # Return absolute ;
        return int(abs(area / 2.0)) 
    

    Best, Riccardo

    posted in General Talk •
    RE: MAXON_MODULE_ID undeclared identifier [R20 C++ plugin]

    Hi Andi, first of all no need to apologize at all. My work IS to be interrupted and to be as much as possible helpful to our developers! 😉

    In order to port/migrate/adapt code pre-R20 to R20, I kindly recommend to read the Plugin Migration section in our documentation where it's properly explained how make this transition happen.

    Do I have to create this file manually in all plugins folders?

    Yes, projectdefinition.txt should be created for both the project and solutions. The SDK shipped with Cinema has a few projectdefinition.txt files which clearly show where and what to write in.

    Do I have to run the project tool over these folders once the projectdefinition.txt file is there?

    Yes, the projecttool should be run on the whole folder that contains the sdk where both frameworks and plugins are located.
    The projecttool is indeed responsible to create both VisualStudio and Xcode project/solution files, so running once you get your IDE-required files properly created.

    But in our R 19 plugin folders these files are already existing. Would it be enough to put an additional projectdefinition.txt into these folders?

    My suggestion is to use a completely different folder for your R20 plugins and to structure it as follow:

    <plugins folder>
        |-<project a>
        |-<project b>
        |-<project x>
        |   |-project
        |   |   |- projectdefinition.txt
        |   |-source
        |       |-source_1.cpp
        |       |-source_2.cpp
        |       |-...
        |       |-source_n.cpp
    
    

    Then run the projecttool and you should be provided with all the needed files for VisualStudio.

    Let me know if something is still unclear or missing.

    Best, Riccardo

    posted in Cinema 4D SDK •
    RE: Some suggestions about Python SDK

    Hi mike, first of all thanks for providing feedback on the Python API.

    1. GetPoint() isn't return accurate postion, just initial postion.please note or append another method(maybe already have?)

    PointObject::GetPoint() is indeed accurate and it's supposed to return the position of a point regardless of the affine transformation operated by the global transformation matrix belonging to the BaseObject the PointObject inherits from. This grant a proper design where linear motion-blur doens't require the points to effectively move in space.

    1. Matrix.mul(other) (matrix * matrix)
      ususlly computational order is 'left to right' , such as handwriting or Matlab, but here is 'right to left' ,could you make some changes?it is trouble to adapt.

    Matrix::Mul() actually is used to left multiply a vector by a matrix

        transformed_vector = transformation_matrix.mul(original_vector)
    

    To multiply matrices instead simply use the "*"operator

        matA = c4d.Matrix() 
        matA.v1 = c4d.Vector(3.0, 9.0, 27.0)
        matB = c4d.Matrix()
        matB.v3 = c4d.Vector(8.0, 4.0, 2.0)
        print matA * matB
        print matB * matA
    

    3.maybe c4d.utils.QSlerp(q1,q2,alfa) is 'spherical interpolation' and c4d.utils.QBlend(q1, q2, r) is 'Linear interpolates '?

    Yes, your guess it's right. c4d.utils.QSlerp is spherical interpolation for quaternions whilst c4d.utils.QBlend is the linear interpolation.

    Last but not least, please mark your initial post as "Ask as a question" from the Topic Tools menù, and if the answer provide is correct don't forget to set the answering post as "Mark this post as correct answer" from the three-vertical dots menu.

    Best, Riccardo

    posted in Cinema 4D SDK •
    RE: debugging question

    Hi ello, first of all thanks for getting back with the code fragment.

    Analyzing the fragment provided I've ended up in a list of comments:

    • why the "Dependency List" approach is used twice in your code to check children dirty status?

    • why the "Dependency List" approach is used in combination with BaseObject::GetAndCheckHierarchyClone()? In the BaseObject Manual they are properly described and making them working in-cascade can actually lead to unexpected behaviors.

    • most of your code completely lacks pointer validity check; I warmly suggest to extend such a type of check to the whole code snippet to be user that unallocated pointer's methods are not called resulting in a message like "CINEMA 4D.exe hat einen Haltepunkt ausgelöst."

    • what does it mean when the debugger holds at a line like that,
      Vector rndoffset = bc->GetVector(RNDOFFSET);
      with a message "CINEMA 4D.exe hat einen Haltepunkt ausgelöst."

      it simply means that the bc pointer is likely to be invalid.

    Last but not least, considering that in the very net days I'll be pretty busy for the DevKitchen 2018 preparation I can't engage longer discussion or provide thoughtful answers, but back from the event I'll be eager to assist further. One last question: what is the intended delivered functionality of your ObjectData?

    Best, Riccardo

    posted in Cinema 4D SDK •

    Latest posts made by r_gigante

    RE: Calling a blocking Plugin

    Hi FSS, thanks for reaching out to us.

    Your question it's outside the support purview of the SDK Team and, hence, we can't help. I also recommend refraining on talking, in this forum, about software reverse engineering or software hacking: this is not allowed under any circumstance.
    Finally, if you need to script the plugin execution, consider reaching out to the software vendor which might provide, given his knowledge on the plugin design, more valuable insights.

    Best, Riccardo

    posted in General Talk •
    RE: Toggle Only select Visible element.

    Hi @akramFex , I apologize for the long silence on our side. Unfortunately the thread fell through the cracks of the Xmas period and we lost track of it.

    I'm glad you were able to find the solution and I'm grateful you wanted to share it with the rest of the community.

    Cheers, R

    posted in Cinema 4D SDK •
    RE: The oldest SDK for Cinema 4D 19-25

    @kbar said in The oldest SDK for Cinema 4D 19-25:

    There should be no problem using the latest version of C4D for each release.

    The MAXON_API_ABI_VERSION doesn't change between any minor release of a specific version. So the plugins will still run.

    Although the MAXON_API_ABI_VERSION doesn't change across versions, the API_VERSION does and this has effect on plugin loading.
    Building the plugin against the latest version of a certain C4D release will impede the plugin to run on earlier version of the same release (e.g. build against the shipped SDK of an RXX SP2 you can't get it loaded in RXX RC or RXX SP1). For this reason, it's always recommended, unless critical bugs are fixed regarding the API in a maintenance version, to build against the API shipped with the initial version of each release.

    Since initial release gets replaced as soon as a newer version comes out on the official portal, I recommend checking the Maxon Registered Developer program and if you qualify send an email to the Maxon SDK Support Team to join it.

    Cheers, Riccardo

    posted in Cinema 4D SDK •
    Maxon SDK Specialist job position available

    Hi Community,

    I'm glad to invite you having a look at the SDK Specialist job opportunity recently opened on the Maxon job-portal. The position is in Friedrichsdorf (Metropolitan Area Frankfurt), Germany or in Montreal, QC, Canada and its main responsibilities are:

    • to support Maxon‘s partners and 3rd-party developers in achieving their goals via mentoring and training
    • to author and review SDK documentation for Maxon‘s Product APIs
    • to author and review SDK examples and tutorials.

    Feel free to reach out our recruiters if you are interested in joining the Maxon Family and its SDK Team.

    Best luck and look forward talking to those interested!

    Riccardo

    posted in Maxon Announcements •
    RE: R25 - DrawPoint2D,DrawHandle2D not drawing pixel size anymore

    Hi Victor, please proceed on reporting the bug using Bugslife.

    posted in Cinema 4D SDK •
    RE: Interfacing with Gumroad's API

    Thanks for the feedback.

    With regard to @orestiskon saying in Interfacing with Gumroad's API:

    The current license system in Cinema 4D implies that the user generates License Information and sends it to the plugin developer to get get a personalized key back.

    please consider that a similar mechanism was in place even before R21 to let the plugin vendor generating the plugin license based on this customer information (see Licensing Plugins – Part I – Basics). So the UX is as much as was in the past and everybody is free to judge it.

    With regard to @orestiskon saying in Interfacing with Gumroad's API:

    Not only that but there are some very big limitations currently. If a studio account has 20 c4d licenses, I can't tie the plugin to a specific c4d version as I would with the serial numbers. I can only tie it to 1 machine, which is limiting and uncomfortable for the customer, or tie it to the account and allow them to only get 1 plugin license and use it in 20 different c4d licenses simultaneously.

    it's not right, as proved in the Basic Licenses Workflow examples (blw_common, blw_pluginlicensedialog, blw_simplegenerator) where you can bind your license mixing up the following settings:

    • user ID
    • system ID
    • binary type (Cinema or TR)
    • binary version
    • c4d licensing type (nodelocked or floating)
      and easily cover the case pointed above.

    Wtih regard to @orestiskon sayng in Interfacing with Gumroad's API:

    especially indie developers are struggling with it, as I've noticed in numerous people I talked with.

    as far as I can see in this forum, I can count only 5 threads (including this) in the last 2 years. Please let your contact use the forum if the need support.

    In the end I don't think that having still in place the old system would have helped on solving the issues reported here because that previous system was not addressing the issues that with Gumroad API you can address (like billing, license key generation and so on).
    Nonetheless I'll ask PM to check again this topic and see if there's space in the future to accomodate with helpers eventually streamlining the plugin licensing process.

    posted in General Talk •
    RE: Interfacing with Gumroad's API

    Thanks, guys, for providing hints and getting this discussion moving forward.

    Although I see the point on @orestiskon saying in Interfacing with Gumroad's API:

    I was surprised by the learning gap between developing a plugin and protecting it

    I also think that what Gumroad offers is beyond the scope of the Cinema 4D API improvement. Offering a Maxon marketplace for freelance developers willing to get bucks out of their plugins it's something that might be interesting to discuss on a strategic level, but we can't for sure contain in the C4D API development roadmap.
    However, I'll be glad to report to Product Management and eventually get the discussion moved on other tables.

    At the same time, I must partially disagree with @kbar saying in Interfacing with Gumroad's API:

    MAXON really need to sort this out and have an internal system for us developers. It is absolutely insane that they removed the existing system without implementing a replacement

    The current system, which is more flexible on checking what hardware/entitlement Cinema 4D is running on and on making the plugin protection mechanism to react accordingly, compared to the previous existing one, is only lacking the ability to have the Maxon Licenses Server serving plugin entitlements to Cinema 4D. While this was handy to offer a floating-license provisioning mechanism for plugins, it has, imho, little to do with the numbers of little guys doing plugin-development and it covers only a fraction of a whole licensing-managing system that goes from selling the licenses to check the license in the host application.

    Cheers, Riccardo

    posted in General Talk •
    RE: External Compositing Tag not working with generated objects by ObjectData Plugin

    Hi Eddie, thanks for getting back but I ask you to specify what is not working or is not clear in the answer marked as Solution.

    When posting code, I also recommend being sure that it's reduced to the bare minimum to reproduce the issue, that's properly documented and that a scene using it is attached to help us reproducing the issue rather than guessing what to do.

    Riccardo

    posted in Cinema 4D SDK •
    RE: Email Links Broken in Template

    The issue has been recently investigated and it should have been just fixed.

    Please confirm the links are correct now on your side.

    posted in General Talk •
    Planned downtime for Plugincafe

    Dear PluginCafé user,

    on Thursday, May 27th 2021, from 06:00 to 07:00 CEST, due to planned maintenance activity, the services will be down and unreachable during this period.

    Maxon SDK Team

    posted in Maxon Announcements •