{ Vinc3rzSnippet }

create Bmesh

python - June 15, 2017 - 14:51
  creer un bmesh à partir d''un mesh existant
me = ob.data 
if me.is_editmode:
    bm = bmesh.from_edit_mesh(me)
else: # Create a bmesh from mesh 
# (won''''t affect mesh, unless explicitly written back) 
bm = bmesh.new()
bm.from_mesh(me)


downloader of multiple numbered files

php - May 22, 2017 - 13:51
  permet de sauvegarder des suites de fichiers où seul le numéro change
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<?php

    $nombreFichier = 55;
    $actualFile = 1;
    while($actualFile <= $nombreFichier){
        echo ''<img src="http://data3.primeportal.net/artillery/gunther_neumahr/flak_36/images/flak_36_''.$actualFile.''_of_55.jpg"/></br>'';
        $actualFile++;
    }

?>
</body>
</html>


[Blender] select object without material

python - April 27, 2017 - 13:36
  ne sélectionne que les objets qui n''ont aucun material appliqué
#import the blender python module
import bpy

#deselect all objects
bpy.ops.object.select_all(action=''DESELECT'')

#looking through all objects
for obj in bpy.data.objects:
    #if the object is a mesh and not a lamp or camera etc.
    if obj.type == ''MESH'':
        #looking through every material slot
        for slot in obj.material_slots:
            #if there''s no material slot
            if slot.material == None:
                #select the object
                obj.select = True


basic babylonjs html file

html - May 23, 2016 - 09:33
  template par défaut d''une scàne babylonJS
<!doctype html>
<html>
<head>
    <title>default</title>
	<meta charset="UTF-8">
    <script src="https://preview.babylonjs.com/babylon.js"></script>
    <style>
      html, body {
        overflow: hidden;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
      }

      #canvas {
        width: 100%;
        height: 100%;
        touch-action: none;
      }
</style>
</head>

<body>
    <canvas id=''canvas''></canvas>
    <script type=''text/javascript''>
        var canvas = document.getElementById(''canvas'');
        var engine = new BABYLON.Engine(canvas, true);
        BABYLON.SceneLoader.Load('''', ''scene.babylon'', engine, function (myScene) {
		
			//camera parameters
            myScene.activeCamera.attachControl(canvas);
			//myScene.activeCamera.fov=1;
			//myScene.activeCamera.setPosition(new BABYLON.Vector3(6, 5, -4));
			
			//myScene.clearColor = new BABYLON.Color3(1, 1, 1);
			//myScene.ambientColor = new BABYLON.Color3(.5,.5,.5);
			
            engine.runRenderLoop(function() {
                myScene.render();
            });

            window.addEventListener(''resize'', function () {
                engine.resize();
            });
        });
    </script>
</body>
</html>


Camera Flythrough

javascript - September 17, 2015 - 10:37
  Une caméra FlyThrough pour Unity
// from http://wiki.unity3d.com/index.php/FlyThrough
var lookSpeed = 15.0;
var moveSpeed = 15.0;
 
var rotationX = 0.0;
var rotationY = 0.0;
 
function Update ()
{
	rotationX += Input.GetAxis("Mouse X")*lookSpeed;
	rotationY += Input.GetAxis("Mouse Y")*lookSpeed;
	rotationY = Mathf.Clamp (rotationY, -90, 90);
 
	transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up);
	transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);
 
	transform.position += transform.forward*moveSpeed*Input.GetAxis("Vertical");
	transform.position += transform.right*moveSpeed*Input.GetAxis("Horizontal");
}


html5 default template

html - August 26, 2015 - 11:15
  
<!DOCTYPE HTML> 
<html>
<head>
	<title></title>
	<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
	<link rel="shortcut icon" href="images/favicon.gif">
	<link rel="stylesheet" media="screen" href="css/styles.css" type="text/css">
	<script src="js/scripts.js"></script>
</head>
<body>
</body>
</html>


tableau d''images responsive

html - August 25, 2015 - 21:27
  affiche un tableau d''images centrées et responsive
<html>
<head>
	<meta charset="UTF-8" />
	<title>pictures array</title>
<style>
body{
	margin:0;
	padding:0;
}
#container{
	display:flex;
	justify-content: center;
	width:100%;
	max-width:1200px;
	margin:auto;
}
ul{
	list-style:none outside none;
	margin:0;
	padding:0;
}
li{
	float:left;
	position:relative;
	overflow:hidden;
	margin:0;
	padding:0;
	height:0px;
	width:25%;
	padding-bottom:16.67%;
}
li img{
	width:100%;
	height:auto;
}

@media (max-width:768px){
	li{
		width:50%;
		padding-bottom:33.33%;
	}
}

@media (max-width:480px){
	li{
		width:100%;
		padding-bottom:66.67%;
	}
}
</style>
</head>
<body>
<div id="container">
<ul>
	<li><a href="#"><img src="img01.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img02.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img03.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img04.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img05.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img06.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img07.jpg" width="300" height="200" alt="img description"></a></li>
	<li><a href="#"><img src="img08.jpg" width="300" height="200" alt="img description"></a></li>
</ul>
</div>
</body>
</html>




<<< Newer snippets
Powered by canSnippet v1.0 beta - by ademcan