How to apply default material?

I am building a plugin to export/import models. For default material, I always get wrong result below:

The model has only one image material. The importing steps:

  1. Create the material.
  2. Create the instance.
  3. instance.material = [the material]

Did I miss something in the steps? What is the correct practice to apply a default material?

Just set the material to nil and you’re good.

confused, if set the material to nil, no texture at all.

That’s right, if no specific material is applied, the value is nil.
Then the “Default” material is applied.

I only create the default material on the instance. The faces in the instance(definition) have no material (yes, their material = nil).

Perhaps too simple as assumption, but - without really seeing your model and code - I guess: :thinking: :blush:


I see that your definition of “default material” differs from the Sketchup default material, which is nil. :wink:

1 Like

What do you mean by default material?

I tried a demo model 306test2.skp (292.5 KB)

There is only a material in a group. I exported the material and restored it without uvs for faces. But got the different result:


The material was not properly applied on faces. I wanted SU to render the material on groups/instances correctly. What information did I miss in the process?

I found the problem that the size of the original picture was 0.200.20m, but it changed to 0.250.25m. How can I get and set the correct size of the texture?

Solved! It is the size issue of texture. Restoring the width and height of the texture picture, the imported model is correct. No UV issues.