zoukankan      html  css  js  c++  java
  • Maxscript 禁止将脚本放置在max根目录运行

    这是个很畸形的需求

    有时候用户会有一些魔幻的操作,会擅自把文件拷贝到自启动目录,但这样直接拷贝不一定会运行,
    当然用户马上就会失忆忘记他拷贝过的操作,这个文件会一致随着3dmax加载,不起作用,且可能会拖慢0.1秒 - N秒的启动速度,
    你还不能弹窗提示,只要一提示,用户就会认为是病毒,因为用户已经忘记他拷贝过文件这个操作,也找不到删除的办法,每次启动你都弹
    那么我的做法就是检测到他在自启动目录就不运行。

    --禁止在max根目录直接运行
    fn isRunInMaxroot =
    (
    	thisFile = toLower (getThisScriptFilename())
    	thisFileName = getFilenameFile thisFile + getFilenameType thisFile
    	maxroot = toLower (getdir #maxroot)
    	disableItems = #(
    		maxroot + thisFileName,
    		maxroot + "plugins\" + thisFileName,
    		maxroot + "stdplugs\" + thisFileName,
    		maxroot + "scripts\startup\" + thisFileName,
    		toLower (getdir #userStartupScripts + "\" + thisFileName)
    	)
    	for item in disableItems do
    	(
    		if thisFile == item do return true
    	)
    	return false
    )
    stat = isRunInMaxroot()
    
  • 相关阅读:
    深入理解DB2缓冲池(BufferPool)
    收银台采坑总结
    webpack4的总结
    无心法师-讲解
    cache 缓存的处理
    用es6方式的写的订阅发布的模式
    Skeleton Screen -- 骨架屏--应用
    promise实现原理
    业务线移动端适配方案总结
    vdom,diff,key 算法的了解
  • 原文地址:https://www.cnblogs.com/trykle/p/13749012.html
Copyright © 2011-2022 走看看