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

    How to create physical sky on C++code?

    SDK Help
    0
    3
    959
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 12/08/2018 at 18:19, xxxxxxxx wrote:

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

      ---------
      How to create physical sky on C++code? I just have looked for a word(OSkyShader) but not working in my project. could you please give me some example about physical sky?

      part of my code:

      baseObject* PhysicalSky = baseObject::Alloc(OSkyShader);

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 13/08/2018 at 04:05, xxxxxxxx wrote:

        Hi zhhm156156,

        First of all welcome in the plugin cafe community!

        Physical objects is a bit special. Here is what a basic object will look like.

        BaseObject* PhysicalSky = BaseObject::Alloc(1011146);
        if (PhysicalSky == nullptr)
        	return;
        	
        doc->InsertObject(PhysicalSky);
        EventAdd();
        

        You can know such ID, by drag and drop a Physical sky you created from c4d to the console.

        But, since a physical sky is a bit special (when you edit it you can see there are some materials), so in order to get them fully initialized you should call a command since you can't manually initialize them due to some classes not exposed in the SDK. So the correct way to do it is the following.

            CallCommand(1011145);
            BaseObject* PhysicalSky = doc->GetActiveObject();
        

        You can know the command ID by looking at the script log while creating a Physical Sky object.

        Hope it's helpful, if you have any question please let me know!

        Cheers,
        Maxime.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 14/08/2018 at 18:41, xxxxxxxx wrote:

          It works. Thanks😄

          1 Reply Last reply Reply Quote 0
          • First post
            Last post