rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.reward_beep = self.config.iget('REWARD_BEEP'):
self.reward_beep = self.config.iget('REWARD_BEEP')
def __init__(self, psych=0): """ Initialize a PypeApp instance, with side effects:
self.alpha[:] = a
self.alpha[::] = a
def set_alpha(self, a): """Set global alpha value
self.alpha[:] = d
self.alpha[::] = d
def alpha_aperture(self, r, x=0, y=0): """Hard vignette
s.alpha[:] = self.alpha[:]
s.alpha[::] = self.alpha[::]
def clone(self): """Duplicate sprite
if len(newpoints) == 3:
if len(newpoints[n]) == 3:
def loadpoints(self, filename=None, merge=None): """Load points from file (pickle file make by savepoints)""" if filename is None: from pype import subjectrc (filename, mode) = filebox.Open(initialdir=subjectrc(), pattern="*.pts") if filename is None: return try: file = open(filename, 'r') newpoints = cPickle.load(file...
for job in shelve.values():
for job in jobs:
def update_jobs(self, jobs): shelve = self._open_shelve('w') for job in shelve.values(): shelve[job.id] = job shelve.close()
os.environ['TZ'] = 'Europe/Helsinki' time.tzset()
if hasattr(time, 'tzset'): os.environ['TZ'] = 'Europe/Helsinki' time.tzset()
def setup(self): os.environ['TZ'] = 'Europe/Helsinki' time.tzset()
del os.environ['TZ'] time.tzset()
if hasattr(time, 'tzset'): del os.environ['TZ'] time.tzset()
def teardown(self): del os.environ['TZ'] time.tzset()
def test_to_unicode_py2(): if sys.version_info[0] > 2: raise SkipTest eq_(to_unicode('aaööbb'), unicode('aabb')) eq_(to_unicode(unicode('gfkj')), unicode('gfkj')) def test_to_unicode_py3():
def test_to_unicode():
def test_to_unicode_py2(): if sys.version_info[0] > 2: raise SkipTest eq_(to_unicode('aaööbb'), unicode('aabb')) eq_(to_unicode(unicode('gfkj')), unicode('gfkj'))
self.path = os.tempnam()
self.path = 'shelve-tmp'
def setup(self): filterwarnings('ignore', category=RuntimeWarning) self.path = os.tempnam() resetwarnings() self.jobstore = ShelveJobStore(self.path)
os.remove(self.path)
os.remove(self.path + '.dir') os.remove(self.path + '.dat') os.remove(self.path + '.bak')
def teardown(self): os.remove(self.path)
trigger = CronTrigger(year, month, day, day_of_week, hour, minute, second)
trigger = CronTrigger(year, month, day, week, day_of_week, hour, minute, second)
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', args=None, kwargs=None): """ Adds a job to be completed on times that match the given expressions.
:param name: name of the job (if none specified, defaults to the name of the function)
:param name: name of the job (optional)
def __init__(self, trigger, name=None, misfire_grace_time=None): """ :param trigger: trigger for the given callable :param name: name of the job (if none specified, defaults to the name of the function) :param misfire_grace_time: seconds after the designated run time that the job is still allowed to be run """ self.tri...
state = self.__dict__.copy()
state = Job.__getstate__(self)
def __getstate__(self): state = self.__dict__.copy() state['func'] = obj_to_ref(state['func']) return state
self._jobstores['default'] = RAMJobStore()
jobstore = RAMJobStore() jobstore.alias = 'default' self._jobstores['default'] = jobstore
def __init__(self, gconfig={}, **options): self.wakeup = Event() self._jobstores = {} self._jobstores_lock = Lock()
:type jobstore: instance of :class:`~apscheduler.jobstore.base.JobStore`
:type jobstore: instance of :class:`~apscheduler.jobstores.base.JobStore`
def add_jobstore(self, jobstore, alias=None, quiet=False): """ Adds a job store to this scheduler.
:param jobstore: alias of the job store to store the job in (overrides the ``persistent`` option)
:param trigger: alias of the job store to store the job in :param func: alias of the job store to store the job in :param args: alias of the job store to store the job in :param kwargs: alias of the job store to store the job in :param jobstore: alias of the job store to store the job in
def add_job(self, trigger, func, args, kwargs, jobstore='default', quiet=False, **options): """ Adds the given job to the job list and notifies the scheduler thread.
:param persistent: ``True`` to store the job in any persistent job store
def add_date_job(self, func, date, args=None, kwargs=None, **options): """ Schedules a job to be completed on a specific date and time.
:param repeat: number of times the job will be run (0 = repeat indefinitely)
def add_interval_job(self, func, weeks=0, days=0, hours=0, minutes=0, seconds=0, start_date=None, args=None, kwargs=None, **options): """ Schedules a job to be completed on specified intervals.
:param persistent: ``True`` to store the job in any persistent job store
def add_interval_job(self, func, weeks=0, days=0, hours=0, minutes=0, seconds=0, start_date=None, args=None, kwargs=None, **options): """ Schedules a job to be completed on specified intervals.
:param persistent: ``True`` to store the job in any persistent job store
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', start_date=None, args=None, kwargs=None, **options): """ Schedules a job to be completed on times that match the given expressions.
Note that the default repeat value is 0, which means to repeat forever.
def interval_schedule(self, **options): """ Decorator that causes its host function to be scheduled for execution on specified intervals. This decorator does not wrap its host function. The scheduled function will be called without any arguments. Note that the default repeat value is 0, which means to repeat forever. S...
state['func'] = ref_to_obj(state['func_ref'])
state['func'] = ref_to_obj(state.pop('func_ref'))
def __setstate__(self, state): state['instances'] = 0 state['func'] = ref_to_obj(state['func_ref']) state['_lock'] = Lock() self.__dict__ = state
def __cmp__(self, other): return cmp(self.next_run_time, other.next_run_time)
def __lt__(self, other): if isinstance(other, Job): return self.next_run_time < other.next_run_time return NotImplemented
def __cmp__(self, other): return cmp(self.next_run_time, other.next_run_time)
return False
return NotImplemented
def __eq__(self, other): if isinstance(other, Job): return self.id is not None and other.id == self.id or self is other return False
The job store's responsibility is to increment the number of running instances, possibly within a transaction.
The job store's responsibility is to mark the job as running and set a new run time for the job using the job's trigger.
def checkout_jobs(self, end_time): """ Checks out the currently pending jobs for execution. The job store's responsibility is to increment the number of running instances, possibly within a transaction. :param end_time: current time, used to filter out jobs that aren't supposed to be run yet :type end_time: :class:`da...
set_trace()
def test_cron_weekday_positional(): trigger = CronTrigger(year=2009, month=1, day_of_week='4th wed') start_date = datetime(2009, 1, 1) correct_next_date = datetime(2009, 1, 28) set_trace() eq_(trigger.get_next_fire_time(start_date), correct_next_date)
if self.last != self.first: if self.step: return '%d-%d/%d' % (self.first, self.last, self.step) else: return '%d-%d' % (self.first, self.last) return str(self.first)
if self.last != self.first and self.last is not None: range = '%d-%d' % (self.first, self.last) else: range = str(self.first) if self.step: return '%s/%d' % (range, self.step) return range
def __str__(self): if self.last != self.first: if self.step: return '%d-%d/%d' % (self.first, self.last, self.step) else: return '%d-%d' % (self.first, self.last) return str(self.first)
value_re = re.compile(r'(?P<option>%s) +(?P<weekday>(?:\d+|\w+))'
value_re = re.compile(r'(?P<option_name>%s) +(?P<weekday_name>(?:\d+|\w+))'
def __str__(self): if self.last != self.first: return '%s-%s' % (WEEKDAYS[self.first], WEEKDAYS[self.last]) return WEEKDAYS[self.first]
eq_(self.jobmeta.checkin_time, None)
eq_(self.jobmeta.checkout_time, None)
def test_jobstore_add_checkout_update(self): jobmetas = self.jobstore.checkout_jobs(self.trigger_date) eq_(jobmetas, [])
eq_(jobmetas[0].checkin_time, None)
eq_(jobmetas[0].checkout_time, None)
def test_jobstore_add_checkout_update(self): jobmetas = self.jobstore.checkout_jobs(self.trigger_date) eq_(jobmetas, [])
if job.next_run_time + grace_time <= now:
if job.next_run_time - grace_time <= now: logger.debug('Running job "%s"', job)
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time end_time = datetime.now() next_wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(...
def __init__(self, years='*', months='*', days='*', days_of_week='*', hours='*', minutes='*', seconds='*'):
def __init__(self, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*'):
def __init__(self, years='*', months='*', days='*', days_of_week='*', hours='*', minutes='*', seconds='*'): self.fields = [] self._compile_expressions(years, 'year') self._compile_expressions(months, 'month') self._compile_expressions(days, 'day') self._compile_expressions(days_of_week, 'day_of_week') self._compile_exp...
self._compile_expressions(years, 'year') self._compile_expressions(months, 'month') self._compile_expressions(days, 'day') self._compile_expressions(days_of_week, 'day_of_week') self._compile_expressions(hours, 'hour') self._compile_expressions(minutes, 'minute') self._compile_expressions(seconds, 'second')
self._compile_expressions(year, 'year') self._compile_expressions(month, 'month') self._compile_expressions(day, 'day') self._compile_expressions(week, 'week') self._compile_expressions(day_of_week, 'day_of_week') self._compile_expressions(hour, 'hour') self._compile_expressions(minute, 'minute') self._compile_expressi...
def __init__(self, years='*', months='*', days='*', days_of_week='*', hours='*', minutes='*', seconds='*'): self.fields = [] self._compile_expressions(years, 'year') self._compile_expressions(months, 'month') self._compile_expressions(days, 'day') self._compile_expressions(days_of_week, 'day_of_week') self._compile_exp...
:rtype: datetime
:rtype: tuple :return: a tuple containing the new date, and the number of the field that was actually incremented
def _increment_field_value(self, dateval, fieldnum): """ Increments the designated field and resets all less significant fields to their minimum values.
return self._set_field_value(dateval, fieldnum, value + 1)
dateval = self._set_field_value(dateval, fieldnum, value + 1) return (dateval, fieldnum)
def _increment_field_value(self, dateval, fieldnum): """ Increments the designated field and resets all less significant fields to their minimum values.
if nextval is not None: nextval = min(val, nextval) else: nextval = val
if val is not None: if nextval is not None: nextval = min(val, nextval) else: nextval = val
def get_next_fire_time(self, start_date): next_date = datetime_ceil(start_date) fieldnum = 0 while fieldnum < len(self.fields): fieldname, expr_list = self.fields[fieldnum] startval = get_date_field(next_date, fieldname)
if nextval is None or (fieldname == 'day_of_week' and nextval > startval):
if nextval is None or (nextval > startval and not hasattr(datetime, fieldname)):
def get_next_fire_time(self, start_date): next_date = datetime_ceil(start_date) fieldnum = 0 while fieldnum < len(self.fields): fieldname, expr_list = self.fields[fieldnum] startval = get_date_field(next_date, fieldname)
fieldnum -= 1 next_date = self._increment_field_value(next_date, fieldnum)
next_date, fieldnum = self._increment_field_value(next_date, fieldnum)
def get_next_fire_time(self, start_date): next_date = datetime_ceil(start_date) fieldnum = 0 while fieldnum < len(self.fields): fieldname, expr_list = self.fields[fieldnum] startval = get_date_field(next_date, fieldname)
:param date: :param persistent: ``True`` to store the job in a persistent job store
:param date: the date/time to run the job at :param name: name of the job :param persistent: ``True`` to store the job in any persistent job store
def add_date_job(self, func, date, args=None, kwargs=None, **options): """ Adds a job to be completed on a specific date and time.
:type date: :class:`datetime.date` or :class:`datetime.datetime`
:param misfire_grace_time: seconds after the designated run time that the job is still allowed to be run :type date: :class:`datetime.date`
def add_date_job(self, func, date, args=None, kwargs=None, **options): """ Adds a job to be completed on a specific date and time.
seconds=0, start_date=None, args=None, kwargs=None, **options):
seconds=0, start_date=None, repeat=0, args=None, kwargs=None):
def add_interval_job(self, func, weeks=0, days=0, hours=0, minutes=0, seconds=0, start_date=None, args=None, kwargs=None, **options): """ Adds a job to be completed on specified intervals.
:param persistent: ``True`` to store the job in a persistent job store
:param persistent: ``True`` to store the job in any persistent job store
def add_interval_job(self, func, weeks=0, days=0, hours=0, minutes=0, seconds=0, start_date=None, args=None, kwargs=None, **options): """ Adds a job to be completed on specified intervals.
trigger = IntervalTrigger(interval, start_date) return self._add_simple_job(trigger, func, args, kwargs, **options)
trigger = IntervalTrigger(interval, repeat, start_date) return self._add_simple_job(trigger, func, args, kwargs)
def add_interval_job(self, func, weeks=0, days=0, hours=0, minutes=0, seconds=0, start_date=None, args=None, kwargs=None, **options): """ Adds a job to be completed on specified intervals.
args=None, kwargs=None, **options):
start_date=None, args=None, kwargs=None, **options):
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', args=None, kwargs=None, **options): """ Adds a job to be completed on times that match the given expressions.
:param persistent: ``True`` to store the job in a persistent job store
:param persistent: ``True`` to store the job in any persistent job store :param jobstore: alias of the job store to add the job to
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', args=None, kwargs=None, **options): """ Adds a job to be completed on times that match the given expressions.
:param jobstore: alias of the job store to add the job to
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', args=None, kwargs=None, **options): """ Adds a job to be completed on times that match the given expressions.
minute=minute, second=second)
minute=minute, second=second, start_date=start_date)
def add_cron_job(self, func, year='*', month='*', day='*', week='*', day_of_week='*', hour='*', minute='*', second='*', args=None, kwargs=None, **options): """ Adds a job to be completed on times that match the given expressions.
misfire_grace_time = 1 daemonic = True def __init__(self, **config):
def __init__(self, gconfig={}, **options):
def __init__(self): Exception.__init__(self, 'Scheduler is already running')
self.configure(config)
def __init__(self, **config): self.wakeup = Event() self.configure(config) self._jobstores = {} self._jobstores_lock = Lock() self.add_jobstore(RAMJobStore)
self.add_jobstore(RAMJobStore) def configure(self, config): """ Updates the configuration with the given options. """ for key, val in config.items(): if key.startswith('apscheduler.'): key = key[12:] if key == 'misfire_grace_time': self.misfire_grace_time = int(val) elif key == 'daemonic': self.daemonic = asbool(val)
config = combine_opts(gconfig, 'apscheduler.', options) self.misfire_grace_time = int(config.pop('misfire_grace_time', 1)) self.daemonic = asbool(config.pop('daemonic', True)) threadpool_opts = combine_opts(config, 'threadpool.') self.threadpool = ThreadPool(**threadpool_opts) jobstore_opts = combine_opts(config, '...
def __init__(self, **config): self.wakeup = Event() self.configure(config) self._jobstores = {} self._jobstores_lock = Lock() self.add_jobstore(RAMJobStore)
job.jobstore.remove_jobs(job)
job.jobstore.remove_jobs((job,))
def unschedule_job(self, job): """ Removes a job, preventing it from being fired any more. """ job.jobstore.remove_jobs(job) logger.info('Removed job "%s"', job) self.wakeup.set()
start_time = datetime.now() wakeup_time = None
end_time = datetime.now() logger.debug('now = %s' % end_time) next_wakeup_time = None
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
jobs = jobstore.get_jobs(start_time)
for job in jobstore.get_jobs(): logger.debug('job: %s, next run time = %s', job, job.next_run_time) jobs = jobstore.get_jobs(end_time) logger.debug('received %d jobs', len(jobs))
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
if job.next_run_time + job.misfire_grace_time <= now:
grace_time = timedelta(seconds=job.misfire_grace_time) if job.next_run_time + grace_time <= now:
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
job.next_run_time = job.trigger.get_next_run_time(now) if job.next_run_time: if not wakeup_time or wakeup_time > job.next_run_time: wakeup_time = job.next_run_time else:
job.next_run_time = job.trigger.get_next_fire_time(now) if not job.next_run_time:
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
if wakeup_time is not None:
if next_wakeup_time is not None:
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
wait_seconds = time_difference(wakeup_time, now)
wait_seconds = time_difference(next_wakeup_time, now)
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
wakeup_time, wait_seconds)
next_wakeup_time, wait_seconds)
def run(self): """ Runs the main loop of the scheduler. """ self.wakeup.clear() while not self.stopped: # Iterate through pending jobs in every jobstore, start them # and figure out the next wakeup time start_time = datetime.now() wakeup_time = None for jobstore in self._jobstores.values(): jobs = jobstore.get_jobs(sta...
'persistent',
def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
extras_require=dict(test=[]),
extras_require=dict(test=['zope.component[test]']),
def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
('POSE_CON', "Object Constraints",
('POSE_CON', "Bone Constraints",
def pIKsExec(bone, active, context): generic_copy(active, bone, "ik_")
ext = ""
blender_bin_path = bpy.app.binary_path blender_bin_dir = os.path.dirname(blender_bin_path) ext = os.path.splitext(blender_bin_path)[-1]
def WriteRuntime(player_path, output_path): # Check the paths if not os.path.isfile(player_path): print("The player could not be found! Runtime not saved.") return # Check if we're bundling a .app if player_path.endswith('.app'): WriteAppleRuntime(player_path, output_path) return # Get the player's binary and the of...
if os.name == "nt": ext = ".exe" elif os.name == "mac": ext = ".app" default_path = os.path.join(os.path.dirname(sys.argv[0]), 'blenderplayer'+ext) player_path = StringProperty(name="Player Path", description="The path to the player to use", default=default_path)
default_player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext) player_path = StringProperty(name="Player Path", description="The path to the player to use", default=default_player_path)
def WriteRuntime(player_path, output_path): # Check the paths if not os.path.isfile(player_path): print("The player could not be found! Runtime not saved.") return # Check if we're bundling a .app if player_path.endswith('.app'): WriteAppleRuntime(player_path, output_path) return # Get the player's binary and the of...
ext = "" if os.name == "nt": ext = ".exe"
def menu_func(self, context): ext = "" if os.name == "nt": ext = ".exe" default_path = bpy.data.filepath.replace(".blend", ext) self.layout.operator(SaveAsRuntime.bl_idname, text=SaveAsRuntime.bl_label).filepath = default_path
default_path = bpy.data.filepath.replace(".blend", ext) self.layout.operator(SaveAsRuntime.bl_idname, text=SaveAsRuntime.bl_label).filepath = default_path
ext = os.path.splitext(bpy.app.binary_path)[-1] default_blend_path = bpy.data.filepath.replace(".blend", ext) self.layout.operator(SaveAsRuntime.bl_idname, text=SaveAsRuntime.bl_label).filepath = default_blend_path
def menu_func(self, context): ext = "" if os.name == "nt": ext = ".exe" default_path = bpy.data.filepath.replace(".blend", ext) self.layout.operator(SaveAsRuntime.bl_idname, text=SaveAsRuntime.bl_label).filepath = default_path
wm= context.manager
wm= context.window_manager
def invoke(self, context, event): wm= context.manager wm.add_fileselect(self) return {'RUNNING_MODAL'}
class CLwPolyLine(CEntity):
class CLWPolyLine(CEntity):
def build(self, vn): edges = [] for v in self.verts: edges.append((vn, vn+1)) vn += 1 edges.pop() return (self.verts, edges, vn)
def pose_poll_func(self, context):
@classmethod def pose_poll_func(cls, context):
def pose_poll_func(self, context): return(context.mode == 'POSE')
def object_poll_func(self, context):
@classmethod def object_poll_func(cls, context):
def object_poll_func(self, context): return(len(context.selected_objects) > 1)
def poll(self, context): return context.active_object != None
@classmethod def poll(cls, context): return context.active_object is not None
def poll(self, context): return context.active_object != None
bpy.types.register(ExportMD3)
def register(): bpy.types.register(ExportMD3) bpy.types.INFO_MT_file_export.append(menu_func)
bpy.types.unregister(ExportMD3)
def unregister(): bpy.types.unregister(ExportMD3) bpy.types.INFO_MT_file_export.remove(menu_func)
def create_mat():
def Create_Mat():
def create_mat(): id = bpy.data.materials.new("Clay_Render") #diffuse id.diffuse_shader = "OREN_NAYAR" id.diffuse_color = 0.800, 0.741, 0.536 id.diffuse_intensity = 1 id.roughness = 0.909 #specular id.specular_shader = "COOKTORR" id.specular_color = 1, 1, 1 id.specular_hardness = 10 id.specular_intensity = 0.115 return...
return id
def Get_Mat(): Mat = bpy.data.materials["Clay_Render"] return Mat def Exist_Mat(): if bpy.data.materials.get("Clay_Render"): return True else: return False
def create_mat(): id = bpy.data.materials.new("Clay_Render") #diffuse id.diffuse_shader = "OREN_NAYAR" id.diffuse_color = 0.800, 0.741, 0.536 id.diffuse_intensity = 1 id.roughness = 0.909 #specular id.specular_shader = "COOKTORR" id.specular_color = 1, 1, 1 id.specular_hardness = 10 id.specular_intensity = 0.115 return...
global im
def execute(self, context): global im if bpy.types.Scene.Clay: context.scene.render.layers.active.material_override = im bpy.types.Scene.Clay = False else: context.scene.render.layers.active.material_override = None bpy.types.Scene.Clay = True return {'FINISHED'}
context.scene.render.layers.active.material_override = im
if not Exist_Mat(): Create_Mat() context.scene.render.layers.active.material_override = Get_Mat()
def execute(self, context): global im if bpy.types.Scene.Clay: context.scene.render.layers.active.material_override = im bpy.types.Scene.Clay = False else: context.scene.render.layers.active.material_override = None bpy.types.Scene.Clay = True return {'FINISHED'}
global im
def draw_clay(self, context): global im ok_clay = not bpy.types.Scene.Clay rnd = context.scene.render rnl = rnd.layers.active if im is None: im = create_mat() split = self.layout.split() col = split.column() col.operator(CheckClay.bl_idname, emboss=False, icon='CHECKBOX_HLT' \ if ok_clay else 'CHECKBOX_DEHLT') col = ...
if im is None: im = create_mat()
def draw_clay(self, context): global im ok_clay = not bpy.types.Scene.Clay rnd = context.scene.render rnl = rnd.layers.active if im is None: im = create_mat() split = self.layout.split() col = split.column() col.operator(CheckClay.bl_idname, emboss=False, icon='CHECKBOX_HLT' \ if ok_clay else 'CHECKBOX_DEHLT') col = ...
col.prop(im, "diffuse_color", text="")
if Exist_Mat(): im = Get_Mat() col.prop(im, "diffuse_color", text="")
def draw_clay(self, context): global im ok_clay = not bpy.types.Scene.Clay rnd = context.scene.render rnl = rnd.layers.active if im is None: im = create_mat() split = self.layout.split() col = split.column() col.operator(CheckClay.bl_idname, emboss=False, icon='CHECKBOX_HLT' \ if ok_clay else 'CHECKBOX_DEHLT') col = ...
global im
def register(): global im bpy.types.Scene.Clay = BoolProperty( name='Clay Render', description='Use Clay Render', default=False) im = None bpy.types.RENDER_PT_render.prepend(draw_clay)
im = None
def register(): global im bpy.types.Scene.Clay = BoolProperty( name='Clay Render', description='Use Clay Render', default=False) im = None bpy.types.RENDER_PT_render.prepend(draw_clay)
global im
def unregister(): global im rnd = bpy.context.scene.render rnl = rnd.layers.active rnl.material_override = None if im is not None: bpy.data.materials.remove(im) del bpy.types.Scene.Clay bpy.types.RENDER_PT_render.remove(draw_clay)
if im is not None: bpy.data.materials.remove(im)
if Exist_Mat(): bpy.data.materials.remove(Get_Mat())
def unregister(): global im rnd = bpy.context.scene.render rnl = rnd.layers.active rnl.material_override = None if im is not None: bpy.data.materials.remove(im) del bpy.types.Scene.Clay bpy.types.RENDER_PT_render.remove(draw_clay)
def pVisRotExec(bone, active, context): rotcopy(bone, getmat(bone,active,context,not context.active_object.data.bones[bone.name].hinge )) def pVisScaExec(bone, active, context): bone.scale = getmat(bone,active,context , not context.active_object.data.bones[bone.name].inherit_scale ).scale_part()
def pVisRotExec(bone, active, context): rotcopy(bone, getmat(bone,active,context,not context.active_object.data.bones[bone.name].use_hinge )) def pVisScaExec(bone, active, context): bone.scale = getmat(bone,active,context , not context.active_object.data.bones[bone.name].use_inherit_scale ).scale_part()
def pVisRotExec(bone, active, context): rotcopy(bone, getmat(bone,active,context,not context.active_object.data.bones[bone.name].hinge ))
blend_path = output_path+'__' bpy.ops.wm.save_as_mainfile(filepath=blend_path, check_existing=False, copy=True)
blend_path = bpy.path.clean_name(output_path) bpy.ops.wm.save_as_mainfile(filepath=blend_path, copy=True)
def WriteRuntime(player_path, output_path): # Check the paths if not os.path.isfile(player_path): print("The player could not be found! Runtime not saved.") return # Check if we're bundling a .app if player_path.endswith('.app'): WriteAppleRuntime(player_path, output_path) return # Get the player's binary and the of...
if not ext: player_path = StringProperty(name="Player Path", description="The path to the player to use", default=sys.argv[0]+'player') else: player_path = StringProperty(name="Player Path", description="The path to the player to use", default=sys.argv[0].replace("blender"+ext, "blenderplayer"+ext))
default_path = os.path.join(os.path.dirname(sys.argv[0]), 'blenderplayer'+ext) player_path = StringProperty(name="Player Path", description="The path to the player to use", default=default_path)
def WriteRuntime(player_path, output_path): # Check the paths if not os.path.isfile(player_path): print("The player could not be found! Runtime not saved.") return # Check if we're bundling a .app if player_path.endswith('.app'): WriteAppleRuntime(player_path, output_path) return # Get the player's binary and the of...
if ext != ".dxf":
if ext.lower() != ".dxf":
def readDxfFile(filePath): global toggle, theCodec fileName = os.path.expanduser(filePath) (shortName, ext) = os.path.splitext(fileName) if ext != ".dxf": print("Error: Not a dxf file: " + fileName) return print( "Opening DXF file "+ fileName ) # fp= open(fileName, "rU") fp = codecs.open(fileName, "r", encoding=theCo...
bpy.types.register(IMPORT_OT_autocad_dxf)
def register(): # registerPanels() menu_func = lambda self, context: self.layout.operator(IMPORT_OT_autocad_dxf.bl_idname, text="Autocad (.dxf)...") bpy.types.INFO_MT_file_import.append(menu_func) return
if True: for op in object_ops: bpy.types.unregister(op) for op in pose_ops: bpy.types.unregister(op)
def register(): if True: for op in object_ops: bpy.types.unregister(op) for op in pose_ops: bpy.types.unregister(op) for op in object_ops: bpy.types.register(op) for op in pose_ops: bpy.types.register(op) #bpy.types.unregister(VIEW3D_MT_copypopup) #bpy.types.unregister(VIEW3D_MT_posecopypopup) #bpy.types.register(VI...
pass
def register(): bpy.types.RENDER_PT_render.prepend(draw_clay) pass
pass
def unregister(): rnd = bpy.context.scene.render rnl = rnd.layers.active rnl.material_override = None bpy.types.RENDER_PT_render.remove(draw_clay) pass
@staticmethod def poll(context):
@classmethod def poll(cls, context):
def edgeIntersect(context, operator): obj = context.active_object if (obj.type != "MESH"): operator.report({'ERROR'}, "Object must be a mesh") return None edges = []; mesh = obj.data verts = mesh.verts is_editmode = (obj.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT') for e in mesh.edges: if...
for v in me.verts:
for v in me.vertices:
def calc_callback(self, context): # polling if context.mode != "EDIT_MESH": return # get screen information mid_x = context.region.width/2.0 mid_y = context.region.height/2.0 width = context.region.width height = context.region.height # get matrices view_mat = context.space_data.region_3d.perspective_matrix ob_mat = ...
v1, v2 = ed.verts v1 = me.verts[v1].co.copy() v2 = me.verts[v2].co.copy()
v1, v2 = ed.vertices v1 = me.vertices[v1].co.copy() v2 = me.vertices[v2].co.copy()
def calc_callback(self, context): # polling if context.mode != "EDIT_MESH": return # get screen information mid_x = context.region.width/2.0 mid_y = context.region.height/2.0 width = context.region.width height = context.region.height # get matrices view_mat = context.space_data.region_3d.perspective_matrix ob_mat = ...
dif_angles = [[(rotation_matrix * (mesh.vertices[vertex].co - center1)).angle(target_vector, 0), False, i] for i, vertex in enumerate(loop1)]
dif_angles = [[((mesh.vertices[vertex].co - center1) * rotation_matrix).angle(target_vector, 0), False, i] for i, vertex in enumerate(loop1)]
def calculate_lines(mesh, loops, mode, twist, reverse): lines = [] loop1, loop2 = [i[0] for i in loops] loop1_circular, loop2_circular = [i[1] for i in loops] circular = loop1_circular or loop2_circular circle_full = False # calculate loop centers centers = [] for loop in [loop1, loop2]: center = mathutils.Vector([0,0...
to_last, to_first = [(rotation_matrix * (mesh.vertices[loop1[-1]].co - center1)).angle((mesh.vertices[loop2[i]].co - center2), 0) for i in [-1, 0]]
to_last, to_first = [((mesh.vertices[loop1[-1]].co - center1) * rotation_matrix).angle((mesh.vertices[loop2[i]].co - center2), 0) for i in [-1, 0]]
def calculate_lines(mesh, loops, mode, twist, reverse): lines = [] loop1, loop2 = [i[0] for i in loops] loop1_circular, loop2_circular = [i[1] for i in loops] circular = loop1_circular or loop2_circular circle_full = False # calculate loop centers centers = [] for loop in [loop1, loop2]: center = mathutils.Vector([0,0...
register()
def unregister(): bpy.types.VIEW3D_MT_edit_mesh_faces.remove(menu_func)
player_path = StringProperty(name="Player Path", description="The path to the player to use", default=sys.argv[0].replace("blender"+ext, "blenderplayer"+ext))
if not ext: player_path = StringProperty(name="Player Path", description="The path to the player to use", default=sys.argv[0]+'player') else: player_path = StringProperty(name="Player Path", description="The path to the player to use", default=sys.argv[0].replace("blender"+ext, "blenderplayer"+ext))
def WriteRuntime(player_path, output_path): # Check the paths if not os.path.isfile(player_path): print("The player could not be found! Runtime not saved.") return # Check if we're bundling a .app if player_path.endswith('.app'): WriteAppleRuntime(player_path, output_path) return # Get the player's binary and the of...
connection_vectors = dict([[vertex, vector[0]] for vertex, vector in connection_vectors.items()])
connection_vectors = dict([[vertex, vector[0]] if vector else [vertex, []] for vertex, vector in connection_vectors.items()])
def average_vector_dictionary(dic): for key, vectors in dic.items(): #if type(vectors) == type([]) and len(vectors) > 1: if len(vectors) > 1: average = mathutils.Vector([0, 0, 0]) for vector in vectors: average += vector average /= len(vectors) dic[key] = [average] return dic