How to create physical sky on C++code?

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);

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.

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

It works. Thanks😄