[Closed] Reloading scripts?
Hello again everyone,
Well I’m trying to find the words on what I’m looking for. I wanna say is there a way to reinitialize a max script when running it. Whats happening is I’ll run what I’ve got for example its to apply an AO set up I use. But I put a fetch option to revert back to the origianl set up in there and that works great too. But if I decide to reapply the AO set up again it doesnt take effect. So I just run the script again and it works good again. Just wondering if theres a way so that the script refreshes. I hope this makes sence.
Alex
My guess is you have a scope issue that is stopping it from running. Instead of trying to find a way to rerun the script I suggest finding out why you need to in the first place. Try posting the code here I’m sure on of us can tell you what is going wrong.
Yeah PEN here’s the base of it. I’m still learning so it may be a little sloppy compared to what your use to seeing. And thanks for replying PEN and RappyBMX
vr=renderers.current
m = VRayMtl()
B=Blend()
B.map1 = VRayMtl Diffuse: (color 159 159 159)
B.map2 = VRayMtl Diffuse:Black
B.Mask = VRayEdgesTex pixelWidth: .5
rollout rollout01 “Temp” category:1
(
)
rollout rollout02 “AO Setup” category:2
(
button btn_AOS “AO Overide” across:3
button btn_Wire “Add Toon”
button btn_Fetch “Back to Original”
on btn_Wire pressed do
(
–Add VrayToon
VT=VRayToon Name:“Toon”
addAtmospheric VT
VT.widthType=1
VT.lineworld=0.5
VT.NormalThreshold=.8
)
on btn_AOS pressed do
(
–Hold added here for revert
holdMaxFile()
–Environment settings
(
backgroundColor = color 255 255 255
useEnvironmentMap = off
environmentMap = undefined
)
–Create AO material and overide mtl
vrtm=VRayDirt radius:10 subdivs:4
vr.options_overrideMtl_mtl= VRayLightMtl color:white texmap_on:on multiplier:1 texmap:vrtm twosided:off
vr.options_overrideMtl_on=true
–Camera Settings
v=VRayPhysicalCamera
(
SetSelectFilter 5
select$*
for v in selection where classOf v==VRayPhysicalCamera do v.exposure=off
for v in selection where classOf v==VRayPhysicalCamera do v.vignetting=off
clearSelection()
SetSelectFilter 1
)
–Render Settings
vr.options_lights=False
vr.options_hiddenLights=False
vr.options_shadows=False
vr.options_glossyEffects = False
vr.options_displacement =False
vr.options_reflectionRefraction =False
vr.imageSampler_type = 1
vr.adaptiveSubdivision_minRate = 1
vr.adaptiveSubdivision_maxRate = 4
–Indirect Illumination GI setting
vr.gi_on = False
(
vr.environment_gi_on =False
vr.environment_rr_on =False
)
(
re = maxOps.GetCurRenderElementMgr() – get the current render element manager
re.removeallrenderelements() – remove all renderelements
)
messageBox “Text here”
)
on btn_Fetch pressed do
(
fetchMaxFile()
)
)
rollout rollout03 “Temp” category:3
(
)
MedialabFloater = newRolloutFloater “AO Setup” 300 200
addRollout rollout01 MedialabFloater rolledUp:true
addRollout rollout02 MedialabFloater rolledUp:true
addRollout rollout03 MedialabFloater rolledUp:true
I didnt get one thing, you say Hold and then Fetch, work ? Or doesnt work the way you wanted? If it works, just use that, if you dont want to use that… dunno maybe using: with undo on()
Kameleon – yes it works. Just not sure where I went wrong for it to only work once thou. And I guess I was just asking if there was a way to just have the script reload it’s self after an action is pressed for a quick fix.
Well, I guess the main “problem” is when you’re changing the render settings, I dont think Undo will revert that. I’m not sure but maybe before changing the render settings, you could copy the settings to a variable and restore that afterwards. Also you could use scene states to create different scene states for the materials, it would be easier to restore the original version after.