def Activated(self):
        textureConfig = findSelectedTextureConfig(returnFreeCadObject=True)

        if textureConfig is None:
            qtutils.showInfo(
                "No TextureConfig selected",
                "Select exactly one TextureConfig object to export its content"
            )

            return

        panel = FaceConfigPanel(textureConfig.Proxy, textureConfig)
        FreeCADGui.Control.showDialog(panel)
    def apply(self):
        selectedFaces = findSelectedFacesAsVectors()

        if len(selectedFaces) == 0:
            qtutils.showInfo(
                "No Face selected",
                "Select at least one face to apply the configuration")
        else:
            for objectName, vectors in selectedFaces:
                faceOverride = self.ensureOverrideForFace(objectName, vectors)

                faceOverride['rotation'] = self.rotationBox.value()

        self.textureConfig.execute(self.freecadObject)
    def Activated(self):
        textureConfig = findSelectedTextureConfig()

        if textureConfig is None:
            qtutils.showInfo(
                "No TextureConfig selected",
                "Select exactly one TextureConfig object to export its content"
            )

            return

        selectedFile = qtutils.userSelectedFile('Export Location',
                                                qtutils.JSON_FILES, False)

        if selectedFile is None:
            return

        fileObject = open(selectedFile, 'w')

        textureConfig.export(fileObject)
    def Activated(self):
        textureConfig = findSelectedTextureConfig(returnFreeCadObject=True)

        if textureConfig is None:
            qtutils.showInfo(
                "No TextureConfig selected",
                "Select exactly one TextureConfig object to export its content"
            )

            return

        panel = FaceConfigPanel(textureConfig.Proxy, textureConfig)
        FreeCADGui.Control.showDialog(panel)

    def IsActive(self):
        """If there is no active document we can't do anything."""
        return not FreeCAD.ActiveDocument is None


if __name__ == "__main__":
    command = ConfigureFacesCommand()

    if command.IsActive():
        command.Activated()
    else:
        qtutils.showInfo("No open Document", "There is no open document")
else:
    import archtexture_toolbars
    archtexture_toolbars.toolbarManager.registerCommand(
        ConfigureFacesCommand())
Ejemplo n.º 5
0
                self.textureCache[imageFile] = tex

            if bumpMapFile is not None:
                if bumpMapFile not in self.bumpMapCache:
                    bumpMap = coin.SoBumpMap()

                    bumpMap.filename.setValue(bumpMapFile)

                    self.bumpMapCache[bumpMapFile] = bumpMap

                bumpMap = self.bumpMapCache[bumpMapFile]

            texture = self.textureCache[imageFile]

            return (texture, bumpMap, materialConfig)

        return (None, None, None)


if __name__ == "__main__":
    from os import path
    import arch_texture_utils.qtutils as qtutils

    if FreeCAD.ActiveDocument is None:
        qtutils.showInfo('No Document', 'Create a document to continue.')
    else:
        configFile = path.join(path.dirname(path.realpath(
            __file__)), 'textures', FreeCAD.ActiveDocument.Name + '.json')

        TextureManager(open(configFile, 'r')).textureObjects(debug=False)
Ejemplo n.º 6
0
    def getDefaultDisplayMode(self):
        return "Standard"

    def updateData(self, fp, prop):
        pass

    def __getstate__(self):
        return None

    def __setstate__(self, state):
        return None


def createTextureConfig(fileObject=None):
    textureConfigObject = FreeCAD.ActiveDocument.addObject(
        "App::FeaturePython", "TextureConfig")
    textureConfig = TextureConfig(textureConfigObject, fileObject)
    ViewProviderTextureConfig(textureConfigObject.ViewObject)


if __name__ == "__main__":
    from os import path

    if FreeCAD.ActiveDocument is None:
        showInfo('No Document', 'Create a document to continue.')
    else:
        configFile = path.join(path.dirname(path.realpath(__file__)),
                               'textures',
                               FreeCAD.ActiveDocument.Name + '.json')

        createTextureConfig(open(configFile, 'r'))