Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login
    1. Home
    2. konradsawicki
    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 5
    • Best 0
    • Controversial 0
    • Groups 0

    konradsawicki

    @konradsawicki

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

    konradsawicki Unfollow Follow

    Latest posts made by konradsawicki

    • Cappucino doesn't record transformation performed by BaseObject::SetMg()

      Hi,

      I am trying to record realtime PSR (Position, Scale, Rotation) data of an object using Cappucino and BaseObject::SetMg().

      When I start recording by clicking "Start Realtime" in Cappucino and then move (transform) an object with my mouse, realtime keyframes are saved. The result is following:
      24359a1d-6890-4789-96eb-cf2e3277b6b4-image.png

      You can see the recorded blue path of the moved object.

      But when I start recording realtime in Cappucino and then move (transform) an object using BaseObject::SetMg() (called on the object) through my plugin code, the realtime keyframes aren't recorded (no blue path on the screen), even though the selected object (selected by clicking on it) moves as I want due to usage of BaseObject::SetMg().

      I suspect that some additional object property has to be set to allow Cappucino detect that it has moved and record realtime PSR change by BaseObject::SetMg(), but I couldn't find anything that would help me.

      I would appreciate if you could help me finding a solution to this problem.

      Thank you for your attention.

      posted in Cinema 4D SDK c++
      K
      konradsawicki
    • RE: Generator object's children visibility

      Hi @ferdinand,

      What I am trying to do, is to calculate the bounding box's extents of selected objects by the user. Before, I was using BaseObject::GetCache() to calculate the extents of the selection and it worked, because as you said:

      So, when you take your array/cube example, you can see that the Cube object will return nullptr when its BaseObject::GetCache() is being called, while the same cube will return its polygonal cache when outisde of the array object.

      So the hidden object wasn't included because its cache is nullptr.

      But the problem is that, later I need to call on the selected objects BaseObject::GetMg() and then BaseObject::SetMg(). Documentation says: "Only valid if the object is attached to a document. Virtual objects in caches and deform caches are not attached to a document, so this cannot be used for those objects."
      Additionally, I need to include objects which don't have Opolygon objects in their cache (e.g. empty generator object, light, camera, rectangle - not sure if they even have a cache).

      So after examining possible solutions, I was left with the one that I mentioned before:

      @konradsawicki said in Generator object's children visibility:

      // Loop through selection.
      for (Int32 i = 0; i < selection->GetCount(); ++i)
      {
      auto obj = (BaseObject*)selection->GetIndex(i);

        std::unordered_set<BaseObject*> objs;
        objs.insert(obj);
      
        // Collect child objects recursively.
        CollectChildren(obj, objs);
      
        for (auto o : objs)
        {
        	DiagnosticOutput("---@---", o->GetName());
        	DiagnosticOutput("OHIDE: @", o->GetNBit(NBIT::OHIDE));
        	DiagnosticOutput("EHIDE: @", o->GetNBit(NBIT::EHIDE));
        	DiagnosticOutput("HIDEEXCEPTVIEWSELECT: @", o->GetNBit(NBIT::HIDEEXCEPTVIEWSELECT));
        	DiagnosticOutput("LOD_HIDE: @", o->GetNBit(NBIT::LOD_HIDE));
        	DiagnosticOutput("SUBOBJECT_AM: @", o->GetNBit(NBIT::SUBOBJECT_AM));
        	DiagnosticOutput("CONTROLOBJECT: @", o->GetBit(BIT_CONTROLOBJECT));
      
        	// If o is visible, then calculate extents.
        }
      

      }

      posted in Cinema 4D SDK
      K
      konradsawicki
    • RE: Generator object's children visibility

      Hi @ferdinand,

      Thank you for the detailed answer once again. It cleared a lot of things for me.

      From what I understood, I should use BIT_CONTROLBOJECT to detect if the object is 'Touched' by a generator object (in my sample case: child 'Cube' hidden by parent 'Array').

      I tried doing so, but it looks like BIT_CONTROLOBJECT of 'Cube' is true regardless if it is attached to 'Array'.

      Please see the screenshots below.

      For this input:
      a9d31d3e-0140-4600-8232-25e000e2f11a-image.png

      I get the following console output:

      ---Cube---
      OHIDE: false
      EHIDE: false
      HIDEEXCEPTVIEWSELECT: false
      LOD_HIDE: false
      SUBOBJECT_AM: false
      CONTROLOBJECT: true
      

      You can see that the BIT_CONTROLOBJECT is true when 'Cube' is not attached to anything.

      my pseudo code:

              // Loop through selection.
      	for (Int32 i = 0; i < selection->GetCount(); ++i)
      	{
      		auto obj = (BaseObject*)selection->GetIndex(i);
      
      		std::unordered_set<BaseObject*> objs;
      		objs.insert(obj);
      
      		// Collect child objects recursively.
      		CollectChildren(obj, objs);
      
      		for (auto o : objs)
      		{
      			DiagnosticOutput("---@---", o->GetName());
      			DiagnosticOutput("OHIDE: @", o->GetNBit(NBIT::OHIDE));
      			DiagnosticOutput("EHIDE: @", o->GetNBit(NBIT::EHIDE));
      			DiagnosticOutput("HIDEEXCEPTVIEWSELECT: @", o->GetNBit(NBIT::HIDEEXCEPTVIEWSELECT));
      			DiagnosticOutput("LOD_HIDE: @", o->GetNBit(NBIT::LOD_HIDE));
      			DiagnosticOutput("SUBOBJECT_AM: @", o->GetNBit(NBIT::SUBOBJECT_AM));
      			DiagnosticOutput("CONTROLOBJECT: @", o->GetBit(BIT_CONTROLOBJECT));
      
      			// If o is visible, then calculate extents.
      		}
      	}
      

      I also recreated analogous scenario that you provided ('Array' as a parent and 'Cube' as a child) and got the same console output as you did.

      @ferdinand said in Generator object's children visibility:

      'Array':
      node.GetNBit(c4d.NBIT_EHIDE) = 0
      node.GetNBit(c4d.NBIT_HIDEEXCEPTVIEWSELECT) = 0
      node.GetNBit(c4d.NBIT_LOD_HIDE) = 0
      node.GetNBit(c4d.NBIT_SUBOBJECT_AM) = 0
      node.GetBit(c4d.BIT_CONTROLOBJECT) = True
      'Cube':
      node.GetNBit(c4d.NBIT_EHIDE) = 0
      node.GetNBit(c4d.NBIT_HIDEEXCEPTVIEWSELECT) = 0
      node.GetNBit(c4d.NBIT_LOD_HIDE) = 0
      node.GetNBit(c4d.NBIT_SUBOBJECT_AM) = 0
      node.GetBit(c4d.BIT_CONTROLOBJECT) = True

      You can see that BIT_CONTROLOBJECT is true when 'Cube' is attached to 'Array', so I cannot differentiate if the object is invisible due to generator object, because before attaching it to a generator object, BIT_CONTROLOBJECT was already true.

      Please let me know, if I am misunderstanding the things that you wrote.

      posted in Cinema 4D SDK
      K
      konradsawicki
    • RE: Generator object's children visibility

      Hi @ferdinand,

      Thank you for your detailed answer. I am sorry for the ambiguity. I'll try to explain my problem more thoroughly.

      By a generator object I meant, for example, an 'Array' or 'Symmetry':

      1f536462-d44d-4635-b157-0fea950e2e62-image.png

      My goal is to calculate the extents of an objects' selection.

      Now let's assume such situation:
      b7abf3ab-0bcf-428d-8f09-e0a8d19f45fa-image.png

      You can see that that the selection consists of 'Array' (parent) and 'Cube' (child). When I attached 'Cube' to 'Array', C4D automatically hid 'Cube' in the scene.

      Here you can see that only 'Cube' is selected, but only its local coordinate system is visible (it was hidden by C4D).
      65ea640f-c627-4bab-ac57-9e930de4e76e-image.png

      So the problem is that functions such:

      • CheckEditorVisibility(),
      • CheckDisplayFilter() with GENERATOR flag,
      • GetEditorMode(),
      • GetDeformMode(),
      • GetNBit with OHIDE flag (checked after @ferdinand answer)

      don't provide useful info whether 'Cube' was hidden by C4D in the scene (due to 'Cube' being a child of 'Array'), thus I cannot exclude those hidden objects from extents.

      I am sorry for all the ambiguities, please let me know if I can explain it more clearly.

      posted in Cinema 4D SDK
      K
      konradsawicki
    • Generator object's children visibility

      Hello,

      I would like to check if an object is hidden when attached to a generator object.

      Example:

      • Array
        -- Cube

      I tried using:

      • CheckEditorVisibility(),
      • CheckDisplayFilter() with GENERATOR flag,
      • GetEditorMode() != MODE_OFF,
      • GetDeformMode(),
        but without any success.

      I loop through a selection (in this case a parent(Array) and a child (Cube))
      and, as I mentioned before, I want to check if an object is hidden by a generator object. I would appreciate it if you could tell me if there is a way to check it.

      posted in Cinema 4D SDK c++
      K
      konradsawicki