示例#1
0
    def execute(self, context):
        sdk_path = armutils.get_sdk_path()
        project_path = armutils.get_fp()
        pkg = bpy.data.worlds['Arm'].arm_project_package
        item = context.object.my_traitlist[context.object.traitlist_index]
        source_hx_path = sdk_path + '/armory/Sources/armory/trait/' + item.class_name_prop + '.hx'
        target_hx_path = project_path + '/Sources/' + pkg + '/' + item.class_name_prop + '.hx'

        if not os.path.isfile(target_hx_path):
            # Rewrite package and copy
            sf = open(source_hx_path)
            sf.readline()
            tf = open(target_hx_path, 'w')
            tf.write('package ' + pkg + ';\n')
            shutil.copyfileobj(sf, tf)
            sf.close()
            tf.close()
            armutils.fetch_script_names()

        # From bundled to script
        item.type_prop = 'Haxe Script'

        # Edit in Kode Studio
        bpy.ops.arm.edit_script('EXEC_DEFAULT')

        return {'FINISHED'}
示例#2
0
 def execute(self, context):
     self.class_name = self.class_name.replace(' ', '')
     write_data.write_traithx(self.class_name)
     armutils.fetch_script_names()
     obj = context.object
     item = obj.my_traitlist[obj.traitlist_index]
     item.class_name_prop = self.class_name
     return {'FINISHED'}
示例#3
0
 def execute(self, context):
     self.class_name = self.class_name.replace(' ', '')
     write_data.write_traithx(self.class_name)
     armutils.fetch_script_names()
     obj = context.object
     item = obj.my_traitlist[obj.traitlist_index] 
     item.class_name_prop = self.class_name 
     return {'FINISHED'}
示例#4
0
文件: props.py 项目: armory3d/armory
def init_properties_on_load():
    global arm_ver

    if not "Arm" in bpy.data.worlds:
        init_properties()

    armutils.fetch_script_names()

    wrd = bpy.data.worlds["Arm"]

    # Outdated project
    if int(wrd.arm_version.replace(".", "")) < int(arm_ver.replace(".", "")):
        wrd.arm_version = arm_ver

    # Set url for embedded player
    if armutils.with_krom():
        barmory.set_files_location(armutils.get_fp() + "/build/krom")
示例#5
0
def init_properties_on_load():
    global arm_ver

    if not 'Arm' in bpy.data.worlds:
        init_properties()

    armutils.fetch_script_names()

    wrd = bpy.data.worlds['Arm']

    # Outdated project
    if int(wrd.arm_version.replace(".", "")[:4]) < int(
            arm_ver.replace(".", "")[:4]):
        # 17.01 - 17.01.1
        wrd.arm_version = arm_ver

    # Set url for embedded player
    if armutils.with_krom():
        barmory.set_files_location(armutils.get_fp() + '/build/krom')
示例#6
0
 def execute(self, context):
     armutils.fetch_bundled_script_names()
     armutils.fetch_script_names()
     return {'FINISHED'}
示例#7
0
 def execute(self, context):
     armutils.fetch_script_names()
     return{'FINISHED'}