Itoo Software Forum

Author Topic: missing XRef material  (Read 9164 times)

harumscarum

  • Full Member
  • ***
  • Posts: 113
    • harumscarum's portfolio
missing XRef material
« 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?




iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: missing XRef material
« Reply #1 on: October 10, 2013, 01:33:35 PM »
You would add a conditional clause as "Classoff node != RailClone_Pro".
Carlos Quintero
iToo Software

harumscarum

  • Full Member
  • ***
  • Posts: 113
    • harumscarum's portfolio
Re: missing XRef material
« Reply #2 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

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: missing XRef material
« Reply #3 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"
Carlos Quintero
iToo Software