Use this scene as an example:
- Code: Select all
#Isotropix_Serial_Version 1.1
#Isotropix_Clarisse_Version 3.5
#Isotropix_Clarisse_Project_Version 0.94
GeometrySphere {
name "sphere"
#version 0.9
#created 1549922559
#modified 1549922576
uv_maps "parametric"
uv_maps_loaded yes
shading_groups "surface"
materials "matte"
clip_maps ""
displacements ""
sg_shading_variables ""
visibles yes
}
MaterialMatte {
name "matte"
#version 0.91
#created 1549922564
#modified 1549922567
color 1 0.0 0.0
}
And here is a short version of my code:
- Code: Select all
# ============== FIRST PART =======================
def create_image_node():
# Create the image node
image_node = ix.cmds.CreateObject("image", "Image", "Global", "project:/")
ix.cmds.AddLayer(image_node.get_full_name() + ".layers", "Layer3d")
create_image_node()
# ============== FIRST PART =======================
# ============== SECOND PART =======================
def create_shading_layer():
# Create the shading layer
ix.cmds.CreateShadingLayerForItems(["project://image"], 1, "project:/")
create_shading_layer()
# ============== SECOND PART =======================
If I run this all at once, it does not work. The shading layer will be empty.
But if I select the first part and "Run Selection" that, then immediately select the second part and "Run Selection" on that, it does work. The shading layer contains the proper information.
So it appears that if the script runs as a single entity, somehow clarisse isn't "all caught up". I have to stop running in order for some key information to be processed, and only then can I get the second part to work.
So, how can I get something like the above code to work?
Thanks!