Bläddra i källkod

Added travis integration - forced pylint compliance and fixed non-deterministic arg order

Geoffrey 7 år sedan
förälder
incheckning
c86410f3b9
7 ändrade filer med 63 tillägg och 26 borttagningar
  1. 3 3
      .pylintrc
  2. 18 0
      .travis.yml
  3. 1 0
      Makefile
  4. 0 1
      io_scene_godot/converters/material.py
  5. 9 8
      io_scene_godot/export_godot.py
  6. 14 14
      io_scene_godot/structures.py
  7. 18 0
      tests/install_blender.sh

+ 3 - 3
.pylintrc

@@ -59,7 +59,7 @@ confidence=
 # --enable=similarities". If you want to run only the classes checker, but have
 # no Warning level messages displayed, use"--disable=all --enable=classes
 # --disable=W"
-disable=attribute-defined-outside-init, import-error, unused-argument, too-few-public-methods, no-self-use
+disable=import-error, unused-argument, unused-variable, too-few-public-methods, no-self-use, locally-disabled
 
 [REPORTS]
 
@@ -343,7 +343,7 @@ max-args=5
 ignored-argument-names=_.*
 
 # Maximum number of locals for function / method body
-max-locals=15
+max-locals=20
 
 # Maximum number of return / yield for function / method body
 max-returns=6
@@ -358,7 +358,7 @@ max-statements=50
 max-parents=7
 
 # Maximum number of attributes for a class (see R0902).
-max-attributes=7
+max-attributes=10
 
 # Minimum number of public methods for a class (see R0903).
 min-public-methods=2

+ 18 - 0
.travis.yml

@@ -0,0 +1,18 @@
+language: python
+python:
+    - 3.4
+
+cache:
+    directories:
+        - $HOME/.blender-cache
+
+before_install:
+    - sudo apt-get update
+    - sudo apt-get install --no-install-recommends -y libsdl1.2debian
+
+install:
+    - tests/install_blender.sh
+    - source .envs
+
+script:
+    - make all BLENDER=$BLENDER_BIN

+ 1 - 0
Makefile

@@ -14,6 +14,7 @@ pep8:
 
 
 export-blends:
+	mkdir -p ./tests/exports/
 	rm -rf ./tests/.import  # Ensure we don't have any hangover data
 	$(BLENDER) -b --python ./tests/scenes/export_blends.py
 

+ 0 - 1
io_scene_godot/converters/material.py

@@ -3,7 +3,6 @@ Exports materials. For now I'm targetting the blender internal, however this
 will be deprecated in Blender 2.8 in favor of EEVEE. EEVEE has PBR and
 should be able to match Godot better, but unfortunately parseing a node
 tree into a flat bunch of parameters is not trivial. So for someone else:"""
-# TODO: Add EEVEE support
 
 import logging
 import os

+ 9 - 8
io_scene_godot/export_godot.py

@@ -25,6 +25,7 @@ http://www.godotengine.org
 """
 
 import os
+import collections
 import logging
 import bpy
 
@@ -102,10 +103,10 @@ class GodotExporter:
         """Decide what objects to export, and export them!"""
         # Scene root
         self.escn_file.add_node(structures.FileEntry(
-            "node", {
-                "type": "Spatial",
-                "name": self.scene.name
-            }
+            "node", collections.OrderedDict((
+                ("type", "Spatial"),
+                ("name", self.scene.name)
+            ))
         ))
         logging.info("Exporting scene: %s", self.scene.name)
 
@@ -131,10 +132,10 @@ class GodotExporter:
         """Begin the export"""
         self.escn_file = structures.ESCNFile(structures.FileEntry(
             "gd_scene",
-            {
-                "load_steps": 1,
-                "format": 2
-            }
+            collections.OrderedDict((
+                ("load_steps", 1),
+                ("format", 2)
+            ))
         ))
 
         self.export_scene()

+ 14 - 14
io_scene_godot/structures.py

@@ -153,11 +153,11 @@ class NodeTemplate(FileEntry):
 
         super().__init__(
             "node",
-            {
-                "name": name,
-                "type": node_type,
-                "parent": parent_path
-            }
+            collections.OrderedDict((
+                ("name", name),
+                ("type", node_type),
+                ("parent", parent_path)
+            ))
         )
 
 
@@ -167,12 +167,12 @@ class ExternalResource(FileEntry):
     def __init__(self, path, resource_type):
         super().__init__(
             'ext_resource',
-            {
+            collections.OrderedDict((
                 # ID is overwritten by ESCN_File.add_external_resource
-                'id': None,
-                'path': path,
-                'type': resource_type
-            }
+                ('id', None),
+                ('path', path),
+                ('type', resource_type)
+            ))
         )
 
     def fix_path(self, export_settings):
@@ -189,11 +189,11 @@ class InternalResource(FileEntry):
     def __init__(self, resource_type):
         super().__init__(
             'sub_resource',
-            {
+            collections.OrderedDict((
                 # ID is overwritten by ESCN_File.add_internal_resource
-                'id': None,
-                'type': resource_type
-            }
+                ('id', None),
+                ('type', resource_type)
+            ))
         )
 
 

+ 18 - 0
tests/install_blender.sh

@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+VERSION=2.79
+NAME="blender-2.79-linux-glibc219-x86_64"
+CACHE="${HOME}/.blender-cache"
+TAR="${CACHE}/${NAME}.tar.bz2"
+URL="http://mirror.cs.umn.edu/blender.org/release/Blender2.79/blender-2.79-linux-glibc219-x86_64.tar.bz2"
+
+echo "Installing Blender ${VERSION}"
+mkdir -p $CACHE
+if [ ! -f $TAR ]; then
+    wget -O $TAR $URL
+fi
+tar -xjf $TAR -C $HOME
+
+echo "export BLENDER_BIN=\"${HOME}/${NAME}/blender\"" > .envs