Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created February 17, 2015 09:50
Show Gist options
  • Select an option

  • Save yitsushi/789286dac42dac3b25dc to your computer and use it in GitHub Desktop.

Select an option

Save yitsushi/789286dac42dac3b25dc to your computer and use it in GitHub Desktop.
From 0520fc27da8a63b4db7fbe4f732056004708cb0c Mon Sep 17 00:00:00 2001
From: Balazs Nadasdi <yitsushi@gmail.com>
Date: Tue, 17 Feb 2015 10:48:53 +0100
Subject: [PATCH] cross platform patch
---
__init__.py | 7 +++++--
loadik.py | 8 +++++---
main_brush.py | 10 +++++++---
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/__init__.py b/__init__.py
index 23a9677..4ede9d2 100644
--- a/__init__.py
+++ b/__init__.py
@@ -21,11 +21,14 @@ if "bpy" in locals():
import bpy
from bpy.props import *
+import os
+
+addon_root = str(bpy.utils.script_path_user()) + os.path.sep + os.path.join("addons", "sculpt_brushes") + os.path.sep;
#charger le script main_brush.py
def execscript():
- lien = str(bpy.utils.script_path_user()) + "\\addons\\sculpt_brushes\\main_brush.py"
+ lien = addon_root + "main_brush.py"
bpy.ops.script.python_file_run( filepath = lien )
#operateur charger main_brush.py
@@ -87,4 +90,4 @@ if __name__ == "__main__":
-
\ No newline at end of file
+
diff --git a/loadik.py b/loadik.py
index bd97d80..3fa1764 100644
--- a/loadik.py
+++ b/loadik.py
@@ -1,5 +1,7 @@
import bpy
+import os
+addon_root = str(bpy.utils.script_path_user()) + os.path.sep + os.path.join("addons", "sculpt_brushes") + os.path.sep;
#verifier l'existance de brosse IK ds les data
ikbrushexist = False
@@ -11,7 +13,7 @@ for item in bpy.data.brushes:
#charger et décharger IK Brushes
#Libraries Brushes
if ikbrushexist == False:
- filepath = str(bpy.utils.script_path_user()) + "\\addons\\sculpt_brushes\\Brushes_IK.blend"
+ filepath = addon_root + "Brushes_IK.blend"
#Load IK Brushes
if bpy.context.scene:
with bpy.data.libraries.load(filepath) as (data_from, data_to):
@@ -29,7 +31,7 @@ else:
#charger le script main_brush.py
def execscript():
- lien = str(bpy.utils.script_path_user()) + "\\addons\\sculpt_brushes\\main_brush.py"
+ lien = addon_root + "main_brush.py"
bpy.ops.script.python_file_run( filepath = lien )
@@ -41,4 +43,4 @@ for textures in bpy.data.textures:
#charger le script main_brush.py
-execscript()
\ No newline at end of file
+execscript()
diff --git a/main_brush.py b/main_brush.py
index f1b60f5..e6ae3e8 100644
--- a/main_brush.py
+++ b/main_brush.py
@@ -4,6 +4,10 @@ from bpy.props import StringProperty
from bpy.types import Menu, Panel, UIList
from bpy.props import *
+import os
+
+addon_root = str(bpy.utils.script_path_user()) + os.path.sep + os.path.join("addons", "sculpt_brushes") + os.path.sep;
+
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
)
@@ -311,7 +315,7 @@ def buldI(nameI = []):
#charger le script main_brush.py
def execscript(listebrush = []):
- lien = str(bpy.utils.script_path_user()) + "\\addons\\sculpt_brushes\\main_brush.py"
+ lien = addon_root + "main_brush.py"
bpy.ops.script.python_file_run( filepath = lien )
#operateur charger main_brush.py
@@ -327,7 +331,7 @@ class ReloadOperator(bpy.types.Operator):
#charger le script loadik.py
def execscriptik():
- lien = str(bpy.utils.script_path_user()) + "\\addons\\sculpt_brushes\\loadik.py"
+ lien = addon_root + "loadik.py"
bpy.ops.script.python_file_run( filepath = lien )
#operateur charger loadik.py
@@ -489,4 +493,4 @@ class OBJECT_OT_Button(bpy.types.Operator):
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
-
\ No newline at end of file
+
--
2.2.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment