Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: harumscarum on October 10, 2013, 12:44:57 PM

Title: missing XRef material
Post by: harumscarum on October 10, 2013, 12:44:57 PM
it actually is not RC issue, but maybe you may help me - I use startup script to assign default material on object creation. it works fine, but when RailClone object is created (from Library) I get XRef material which cause error then. is any way to exclude RC object from this script?

(http://joxi.ru/uploads/prod/2013/10/10/1e8/53a/d36c14241fa64af20f8d60f8c711093b65ee8575.jpg)
(http://joxi.ru/uploads/prod/2013/10/10/652/960/1ecd2f6f93ceed72da72a0782734d52efad4b402.jpg)
Title: Re: missing XRef material
Post by: iToo on October 10, 2013, 01:33:35 PM
You would add a conditional clause as "Classoff node != RailClone_Pro".
Title: Re: missing XRef material
Post by: harumscarum on October 10, 2013, 02:34:29 PM
thank you! unfortunately i'm not very strong in maxscript - could you please let me know where exactly in code must be this line
Code: [Select]
fn defaultmat=(
 global dmat
 (

 dmat=VRayMtl Name:"default" Diffuse:(color 100 103 110) Reflection:(color 110 110 101) reflection_subdivs:8 reflection_fresnel:on   effectsChannel:15
 
 )
)

calbScr="node=callbacks.notificationParam()\n"
calbScr+="dmat=sceneMaterials[\"default\"]\n"
calbScr+="if dmat==undefined or (classof dmat != VRayMtl) do defaultmat()\n"
calbScr+="if (superClassOf node != shape and node.material==undefined) do (\n"
calbScr+="node.material=dmat\n"
calbScr+=")\n"
calbScr+="

 (
 case superClassOf node of
  (
   (GeometryClass):
   (
  node.wirecolor=(color 22 22 22)
   )
   (shape):
   (
    node.wirecolor=(color 225 198 87);
   )
  (Camera):
  (
  node.wirecolor=(color 133 161 197)
  )
  (Light):
  (
  node.wirecolor=(color 245 158 35)
  )
 )
 )\n"

callbacks.removeScripts id:#VGCreate
callbacks.addScript #filePostOpen "dmat=sceneMaterials[\"default\"];if dmat==undefined do defaultmat()" id:#VGCreate
callbacks.addScript #nodeCreated calbScr id:#VGCreate
callbacks.addScript #sceneNodeAdded calbScr id:#VGCreate




global CamOrLigthAdded
fn CamOrLigthAdded = (
lastNode = objects[objects.count]
if superclassof lastNode == Camera do (
serchLN = LayerManager.getLayerFromName "x cameras"
newL = if serchLN != undefined then serchLN else LayerManager.newLayerFromName "x cameras"
newL.addnode lastNode
)
)
callbacks.removeScripts id:#ecximer
callbacks.addScript #sceneNodeAdded "CamOrLigthAdded()" id:#ecximer
Title: Re: missing XRef material
Post by: iToo on October 10, 2013, 02:52:21 PM
I think that changing this line should be enough:

calbScr+="if (superClassOf node != shape and classOf node != RailClone_Pro and node.material==undefined) do (\n"