View Full Version : Reloading scripts?
06-29-2011, 03:11 PM
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.
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.
06-30-2011, 05:23 AM
well to reload a script:
07-06-2011, 08:31 PM
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
m = VRayMtl()
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
on btn_AOS pressed do
--Hold added here for revert
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
for v in selection where classOf v==VRayPhysicalCamera do v.exposure=off
for v in selection where classOf v==VRayPhysicalCamera do v.vignetting=off
vr.options_glossyEffects = False
vr.imageSampler_type = 1
vr.adaptiveSubdivision_minRate = 1
vr.adaptiveSubdivision_maxRate = 4
--Indirect Illumination GI setting
vr.gi_on = False
re = maxOps.GetCurRenderElementMgr() -- get the current render element manager
re.removeallrenderelements() -- remove all renderelements
messageBox "Text here"
on btn_Fetch pressed do
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
07-06-2011, 08:38 PM
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()
07-06-2011, 09:55 PM
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.
07-07-2011, 10:33 AM
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.
07-07-2011, 10:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.