Fixed list indices.
This commit is contained in:
parent
cf8f7186da
commit
0792bd6901
|
@ -13,8 +13,6 @@ class FlyCamera extends Trait {
|
|||
|
||||
var camera:CameraNode;
|
||||
|
||||
var pitchRad:Float;
|
||||
|
||||
var moveForward = false;
|
||||
var moveBackward = false;
|
||||
var strafeLeft = false;
|
||||
|
@ -38,13 +36,6 @@ class FlyCamera extends Trait {
|
|||
|
||||
function init() {
|
||||
camera = RootNode.cameras[0];
|
||||
|
||||
var r = camera.transform.rot;
|
||||
var q = new Quat(r.x, r.y, r.z, r.w);
|
||||
q.inverse(q);
|
||||
|
||||
var e = q.getEuler();
|
||||
pitchRad = iron.math.Math.degToRad(90) - e.x;
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
|
|
@ -24,13 +24,13 @@ class VehicleBody extends Trait {
|
|||
var wheels:Array<VehicleWheel> = [];
|
||||
var wheelNames:Array<String>;
|
||||
|
||||
var m_vehicle:BtRaycastVehiclePointer = null;
|
||||
var m_carChassis:BtRigidBodyPointer;
|
||||
var vehicle:BtRaycastVehiclePointer = null;
|
||||
var carChassis:BtRigidBodyPointer;
|
||||
var startTransform:BtTransformPointer;
|
||||
|
||||
var gEngineForce = 0.0;
|
||||
var gBreakingForce = 0.0;
|
||||
var gVehicleSteering = 0.0;
|
||||
var engineForce = 0.0;
|
||||
var breakingForce = 0.0;
|
||||
var vehicleSteering = 0.0;
|
||||
|
||||
var maxEngineForce = 3000.0;
|
||||
var maxBreakingForce = 100.0;
|
||||
|
@ -77,8 +77,8 @@ class VehicleBody extends Trait {
|
|||
var upIndex = 2;
|
||||
var forwardIndex = 1;
|
||||
|
||||
var wheelDirectionCS0 = BtVector3.create(0, 0, -1);
|
||||
var wheelAxleCS = BtVector3.create(1, 0, 0);
|
||||
var wheelDirectionCS0 = BtVector3.create(0, 0, -1).value;
|
||||
var wheelAxleCS = BtVector3.create(1, 0, 0).value;
|
||||
|
||||
var wheelFriction = 1000;
|
||||
var suspensionStiffness = 20.0;
|
||||
|
@ -117,34 +117,34 @@ class VehicleBody extends Trait {
|
|||
transform.rot.w).value);
|
||||
|
||||
startTransform = tr; // Cpp workaround
|
||||
m_carChassis = createRigidBody(500, compound);
|
||||
carChassis = createRigidBody(500, compound);
|
||||
|
||||
// Create vehicle
|
||||
var m_tuning = BtVehicleTuning.create();
|
||||
var m_vehicleRayCaster = BtDefaultVehicleRaycaster.create(physics.world);
|
||||
m_vehicle = BtRaycastVehicle.create(m_tuning.value, m_carChassis, m_vehicleRayCaster);
|
||||
var tuning = BtVehicleTuning.create();
|
||||
var vehicleRayCaster = BtDefaultVehicleRaycaster.create(physics.world);
|
||||
vehicle = BtRaycastVehicle.create(tuning.value, carChassis, vehicleRayCaster);
|
||||
|
||||
// Never deactivate the vehicle
|
||||
m_carChassis.ptr.setActivationState(BtCollisionObject.DISABLE_DEACTIVATION);
|
||||
carChassis.ptr.setActivationState(BtCollisionObject.DISABLE_DEACTIVATION);
|
||||
|
||||
// Choose coordinate system
|
||||
m_vehicle.ptr.setCoordinateSystem(rightIndex, upIndex, forwardIndex);
|
||||
vehicle.ptr.setCoordinateSystem(rightIndex, upIndex, forwardIndex);
|
||||
|
||||
// Add wheels
|
||||
for (w in wheels) {
|
||||
m_vehicle.ptr.addWheel(
|
||||
w.connectionPointCS0.value,
|
||||
wheelDirectionCS0.value,
|
||||
wheelAxleCS.value,
|
||||
vehicle.ptr.addWheel(
|
||||
w.getConnectionPoint(),
|
||||
wheelDirectionCS0,
|
||||
wheelAxleCS,
|
||||
suspensionRestLength,
|
||||
w.wheelRadius,
|
||||
m_tuning.value,
|
||||
tuning.value,
|
||||
w.isFrontWheel);
|
||||
}
|
||||
|
||||
// Setup wheels
|
||||
for (i in 0...m_vehicle.ptr.getNumWheels()){
|
||||
var wheel = m_vehicle.ptr.getWheelInfo(i);
|
||||
for (i in 0...vehicle.ptr.getNumWheels()){
|
||||
var wheel = vehicle.ptr.getWheelInfo(i);
|
||||
wheel.m_suspensionStiffness = suspensionStiffness;
|
||||
wheel.m_wheelsDampingRelaxation = suspensionDamping;
|
||||
wheel.m_wheelsDampingCompression = suspensionCompression;
|
||||
|
@ -152,47 +152,47 @@ class VehicleBody extends Trait {
|
|||
wheel.m_rollInfluence = rollInfluence;
|
||||
}
|
||||
|
||||
physics.world.ptr.addAction(m_vehicle);
|
||||
physics.world.ptr.addAction(vehicle);
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (m_vehicle == null) return;
|
||||
if (vehicle == null) return;
|
||||
|
||||
if (up) {
|
||||
gEngineForce = maxEngineForce;
|
||||
engineForce = maxEngineForce;
|
||||
}
|
||||
else if (down) {
|
||||
gEngineForce = -maxEngineForce;
|
||||
engineForce = -maxEngineForce;
|
||||
}
|
||||
else {
|
||||
gEngineForce = 0;
|
||||
gBreakingForce = 20;
|
||||
engineForce = 0;
|
||||
breakingForce = 20;
|
||||
}
|
||||
|
||||
if (left) {
|
||||
gVehicleSteering = 0.3;
|
||||
vehicleSteering = 0.3;
|
||||
}
|
||||
else if (right) {
|
||||
gVehicleSteering = -0.3;
|
||||
vehicleSteering = -0.3;
|
||||
}
|
||||
else {
|
||||
gVehicleSteering = 0;
|
||||
vehicleSteering = 0;
|
||||
}
|
||||
|
||||
m_vehicle.ptr.applyEngineForce(gEngineForce, 2);
|
||||
m_vehicle.ptr.setBrake(gBreakingForce, 2);
|
||||
m_vehicle.ptr.applyEngineForce(gEngineForce, 3);
|
||||
m_vehicle.ptr.setBrake(gBreakingForce, 3);
|
||||
m_vehicle.ptr.setSteeringValue(gVehicleSteering, 0);
|
||||
m_vehicle.ptr.setSteeringValue(gVehicleSteering, 1);
|
||||
vehicle.ptr.applyEngineForce(engineForce, 2);
|
||||
vehicle.ptr.setBrake(breakingForce, 2);
|
||||
vehicle.ptr.applyEngineForce(engineForce, 3);
|
||||
vehicle.ptr.setBrake(breakingForce, 3);
|
||||
vehicle.ptr.setSteeringValue(vehicleSteering, 0);
|
||||
vehicle.ptr.setSteeringValue(vehicleSteering, 1);
|
||||
|
||||
for (i in 0...m_vehicle.ptr.getNumWheels()) {
|
||||
for (i in 0...vehicle.ptr.getNumWheels()) {
|
||||
// Synchronize the wheels with the chassis worldtransform
|
||||
m_vehicle.ptr.updateWheelTransform(i, true);
|
||||
vehicle.ptr.updateWheelTransform(i, true);
|
||||
|
||||
// Update wheels transforms
|
||||
var trans = m_vehicle.ptr.getWheelTransformWS(i);
|
||||
var trans = vehicle.ptr.getWheelTransformWS(i);
|
||||
//wheels[i].trans = trans;
|
||||
//wheels[i].syncTransform();
|
||||
var p = trans.getOrigin();
|
||||
|
@ -202,7 +202,7 @@ class VehicleBody extends Trait {
|
|||
wheels[i].node.transform.dirty = true;
|
||||
}
|
||||
|
||||
var trans = m_carChassis.ptr.getWorldTransform();
|
||||
var trans = carChassis.ptr.getWorldTransform();
|
||||
var p = trans.getOrigin();
|
||||
var q = trans.getRotation();
|
||||
transform.pos.set(p.x(), p.y(), p.z());
|
||||
|
|
|
@ -11,7 +11,13 @@ class VehicleWheel extends Trait {
|
|||
public function new() { super(); }
|
||||
#else
|
||||
|
||||
public var connectionPointCS0:BtVector3Pointer;
|
||||
static inline var VEHICLE_FRONT_X = 3.5 / 2; // Distance to wheel from vehicle center
|
||||
static inline var VEHICLE_BACK_X = 4.1 / 2;
|
||||
static inline var VEHICLE_FRONT_Y = 3.6;
|
||||
static inline var VEHICLE_BACK_Y = 3.5;
|
||||
static inline var CONNECTION_HEIGHT_FRONT = 0.3;
|
||||
static inline var CONNECTION_HEIGHT_BACK = 0.4;
|
||||
|
||||
public var isFrontWheel:Bool;
|
||||
public var wheelRadius = 0.75;
|
||||
public var wheelWidth = 0.53;
|
||||
|
@ -19,61 +25,50 @@ class VehicleWheel extends Trait {
|
|||
|
||||
public function new(id:Int) {
|
||||
super();
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
var VEHICLE_FRONT_X = 3.5 / 2; // Distance to wheel from vehicle center
|
||||
var VEHICLE_BACK_X = 4.1 / 2;
|
||||
var VEHICLE_FRONT_Y = 3.6;
|
||||
var VEHICLE_BACK_Y = 3.5;
|
||||
var CONNECTION_HEIGHT_FRONT = 0.3;
|
||||
var CONNECTION_HEIGHT_BACK = 0.4;
|
||||
|
||||
public function getConnectionPoint():BtVector3 {
|
||||
var connectionPoint:BtVector3;
|
||||
|
||||
if (id == 0) {
|
||||
isFrontWheel = true;
|
||||
|
||||
connectionPointCS0 = BtVector3.create(
|
||||
connectionPoint = BtVector3.create(
|
||||
VEHICLE_FRONT_X - (0.3 * wheelWidth),
|
||||
VEHICLE_FRONT_Y - wheelRadius,
|
||||
CONNECTION_HEIGHT_FRONT
|
||||
);
|
||||
).value;
|
||||
}
|
||||
else if (id == 1) {
|
||||
isFrontWheel = true;
|
||||
|
||||
connectionPointCS0 = BtVector3.create(
|
||||
connectionPoint = BtVector3.create(
|
||||
-VEHICLE_FRONT_X + (0.3 * wheelWidth),
|
||||
VEHICLE_FRONT_Y - wheelRadius,
|
||||
CONNECTION_HEIGHT_FRONT
|
||||
);
|
||||
).value;
|
||||
}
|
||||
else if (id == 2) {
|
||||
isFrontWheel = false;
|
||||
|
||||
connectionPointCS0 = BtVector3.create(
|
||||
connectionPoint = BtVector3.create(
|
||||
-VEHICLE_BACK_X + (0.3 * wheelWidth),
|
||||
-VEHICLE_BACK_Y + wheelRadius,
|
||||
CONNECTION_HEIGHT_BACK
|
||||
);
|
||||
).value;
|
||||
}
|
||||
else if (id == 3) {
|
||||
else { //if (id == 3) {
|
||||
isFrontWheel = false;
|
||||
|
||||
connectionPointCS0 = BtVector3.create(
|
||||
connectionPoint = BtVector3.create(
|
||||
VEHICLE_BACK_X - (0.3 * wheelWidth),
|
||||
-VEHICLE_BACK_Y + wheelRadius,
|
||||
CONNECTION_HEIGHT_BACK
|
||||
);
|
||||
).value;
|
||||
}
|
||||
}
|
||||
|
||||
/*public var trans:BtTransform;
|
||||
public function syncTransform() {
|
||||
var p = trans.getOrigin();
|
||||
var q = trans.getRotation();
|
||||
node.transform.pos.set(p.x(), p.y(), p.z());
|
||||
node.transform.rot.set(q.x(), q.y(), q.z(), q.w());
|
||||
node.transform.dirty = true;
|
||||
}*/
|
||||
return connectionPoint;
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import json
|
|||
import platform
|
||||
import subprocess
|
||||
import nodes_compositor
|
||||
from utils import to_hex
|
||||
|
||||
class CGPipelineTree(NodeTree):
|
||||
'''Pipeline nodes'''
|
||||
|
@ -901,9 +902,6 @@ def make_set_target(stage, node_group, node, currentNode=None, target_index=1):
|
|||
targetId = ''
|
||||
stage.params.append(targetId)
|
||||
|
||||
def to_hex(val):
|
||||
return '#%02x%02x%02x%02x' % (int(val[3] * 255), int(val[0] * 255), int(val[1] * 255), int(val[2] * 255))
|
||||
|
||||
def make_clear_target(stage, color_val=None, depth_val=None, stencil_val=None):
|
||||
stage.command = 'clear_target'
|
||||
if color_val != None:
|
||||
|
|
|
@ -57,10 +57,10 @@ class ListTraitItem(bpy.types.PropertyGroup):
|
|||
default="")
|
||||
|
||||
my_paramstraitlist = bpy.props.CollectionProperty(type=ListParamsTraitItem)
|
||||
paramstraitlist_index = bpy.props.IntProperty(name="Index for my_list", default=-1)
|
||||
paramstraitlist_index = bpy.props.IntProperty(name="Index for my_list", default=0)
|
||||
|
||||
my_animationtraitlist = bpy.props.CollectionProperty(type=ListAnimationTraitItem)
|
||||
animationtraitlist_index = bpy.props.IntProperty(name="Index for my_list", default=-1)
|
||||
animationtraitlist_index = bpy.props.IntProperty(name="Index for my_list", default=0)
|
||||
|
||||
class MY_UL_TraitList(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
|
@ -78,7 +78,7 @@ class MY_UL_TraitList(bpy.types.UIList):
|
|||
|
||||
def initObjectProperties():
|
||||
bpy.types.Object.my_traitlist = bpy.props.CollectionProperty(type = ListTraitItem)
|
||||
bpy.types.Object.traitlist_index = bpy.props.IntProperty(name = "Index for my_list", default=-1)
|
||||
bpy.types.Object.traitlist_index = bpy.props.IntProperty(name = "Index for my_list", default=0)
|
||||
|
||||
|
||||
class LIST_OT_TraitNewItem(bpy.types.Operator):
|
||||
|
@ -88,7 +88,7 @@ class LIST_OT_TraitNewItem(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
bpy.context.object.my_traitlist.add()
|
||||
bpy.context.object.traitlist_index += 1
|
||||
bpy.context.object.traitlist_index = len(bpy.context.object.my_traitlist) - 1
|
||||
return{'FINISHED'}
|
||||
|
||||
|
||||
|
@ -267,7 +267,11 @@ class ToolsTraitsPanel(bpy.types.Panel):
|
|||
col.operator("my_paramstraitlist.move_item", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
||||
|
||||
if item.paramstraitlist_index >= 0 and len(item.my_paramstraitlist) > 0:
|
||||
paramitem = item.my_paramstraitlist[item.paramstraitlist_index]
|
||||
paramitem = item.my_paramstraitlist[item.paramstraitlist_index]
|
||||
# Picker
|
||||
layout.label('Pickers')
|
||||
layout.prop_search(paramitem, 'object_picker', bpy.context.scene, "objects", "Object")
|
||||
layout.prop(paramitem, 'color_picker')
|
||||
|
||||
if item.type_prop == 'Script':
|
||||
row = layout.row()
|
||||
|
|
|
@ -52,7 +52,7 @@ class LIST_OT_AnimationTraitNewItem(bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
trait.my_animationtraitlist.add()
|
||||
trait.animationtraitlist_index += 1
|
||||
trait.animationtraitlist_index = len(trait.my_animationtraitlist) - 1
|
||||
return{'FINISHED'}
|
||||
|
||||
|
||||
|
|
|
@ -4,118 +4,146 @@ import os
|
|||
import json
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
from utils import to_hex
|
||||
|
||||
def object_picker_update(self, context):
|
||||
o = context.object
|
||||
tl = o.my_traitlist[o.traitlist_index]
|
||||
pl = tl.my_paramstraitlist[tl.paramstraitlist_index]
|
||||
pl.name = "'" + pl.object_picker + "'"
|
||||
|
||||
def color_picker_update(self, context):
|
||||
o = context.object
|
||||
tl = o.my_traitlist[o.traitlist_index]
|
||||
pl = tl.my_paramstraitlist[tl.paramstraitlist_index]
|
||||
col = pl.color_picker
|
||||
pl.name = str(to_hex(col))
|
||||
|
||||
class ListParamsTraitItem(bpy.types.PropertyGroup):
|
||||
# Group of properties representing an item in the list
|
||||
name = bpy.props.StringProperty(
|
||||
name="Name",
|
||||
description="A name for this item",
|
||||
default="Untitled")
|
||||
# Group of properties representing an item in the list
|
||||
name = bpy.props.StringProperty(
|
||||
name="Name",
|
||||
description="A name for this item",
|
||||
default="Untitled")
|
||||
|
||||
object_picker = bpy.props.StringProperty(
|
||||
name="Object",
|
||||
description="A name for this item",
|
||||
default="",
|
||||
update=object_picker_update)
|
||||
|
||||
color_picker = bpy.props.FloatVectorProperty(
|
||||
name="Color",
|
||||
description="A name for this item",
|
||||
size=4,
|
||||
subtype='COLOR',
|
||||
default=[1, 1, 1, 1],
|
||||
update=color_picker_update)
|
||||
|
||||
class MY_UL_ParamsTraitList(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
# We could write some code to decide which icon to use here...
|
||||
custom_icon = 'OBJECT_DATAMODE'
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
# We could write some code to decide which icon to use here...
|
||||
custom_icon = 'OBJECT_DATAMODE'
|
||||
|
||||
# Make sure your code supports all 3 layout types
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
#layout.prop(item, "enabled_prop")
|
||||
#layout.label(item.name, icon = custom_icon)
|
||||
layout.prop(item, "name", text="", emboss=False, icon=custom_icon)
|
||||
# Make sure your code supports all 3 layout types
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
#layout.prop(item, "enabled_prop")
|
||||
#layout.label(item.name, icon = custom_icon)
|
||||
layout.prop(item, "name", text="", emboss=False, icon=custom_icon)
|
||||
|
||||
elif self.layout_type in {'GRID'}:
|
||||
layout.alignment = 'CENTER'
|
||||
layout.label("", icon = custom_icon)
|
||||
elif self.layout_type in {'GRID'}:
|
||||
layout.alignment = 'CENTER'
|
||||
layout.label("", icon = custom_icon)
|
||||
|
||||
class LIST_OT_ParamsTraitNewItem(bpy.types.Operator):
|
||||
# Add a new item to the list
|
||||
bl_idname = "my_paramstraitlist.new_item"
|
||||
bl_label = "Add a new item"
|
||||
# Add a new item to the list
|
||||
bl_idname = "my_paramstraitlist.new_item"
|
||||
bl_label = "Add a new item"
|
||||
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
trait.my_paramstraitlist.add()
|
||||
trait.paramstraitlist_index += 1
|
||||
return{'FINISHED'}
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
trait.my_paramstraitlist.add()
|
||||
trait.paramstraitlist_index = len(trait.my_paramstraitlist) - 1
|
||||
return{'FINISHED'}
|
||||
|
||||
|
||||
class LIST_OT_ParamsTraitDeleteItem(bpy.types.Operator):
|
||||
# Delete the selected item from the list
|
||||
bl_idname = "my_paramstraitlist.delete_item"
|
||||
bl_label = "Deletes an item"
|
||||
# Delete the selected item from the list
|
||||
bl_idname = "my_paramstraitlist.delete_item"
|
||||
bl_label = "Deletes an item"
|
||||
|
||||
@classmethod
|
||||
def poll(self, context):
|
||||
""" Enable if there's something in the list """
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
return len(trait.my_paramstraitlist) > 0
|
||||
@classmethod
|
||||
def poll(self, context):
|
||||
""" Enable if there's something in the list """
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
return len(trait.my_paramstraitlist) > 0
|
||||
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
list = trait.my_paramstraitlist
|
||||
index = trait.paramstraitlist_index
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
list = trait.my_paramstraitlist
|
||||
index = trait.paramstraitlist_index
|
||||
|
||||
list.remove(index)
|
||||
list.remove(index)
|
||||
|
||||
if index > 0:
|
||||
index = index - 1
|
||||
if index > 0:
|
||||
index = index - 1
|
||||
|
||||
trait.paramstraitlist_index = index
|
||||
return{'FINISHED'}
|
||||
trait.paramstraitlist_index = index
|
||||
return{'FINISHED'}
|
||||
|
||||
|
||||
class LIST_OT_ParamsTraitMoveItem(bpy.types.Operator):
|
||||
# Move an item in the list
|
||||
bl_idname = "my_paramstraitlist.move_item"
|
||||
bl_label = "Move an item in the list"
|
||||
direction = bpy.props.EnumProperty(
|
||||
items=(
|
||||
('UP', 'Up', ""),
|
||||
('DOWN', 'Down', ""),))
|
||||
# Move an item in the list
|
||||
bl_idname = "my_paramstraitlist.move_item"
|
||||
bl_label = "Move an item in the list"
|
||||
direction = bpy.props.EnumProperty(
|
||||
items=(
|
||||
('UP', 'Up', ""),
|
||||
('DOWN', 'Down', ""),))
|
||||
|
||||
@classmethod
|
||||
def poll(self, context):
|
||||
""" Enable if there's something in the list. """
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
return len(trait.my_paramstraitlist) > 0
|
||||
@classmethod
|
||||
def poll(self, context):
|
||||
""" Enable if there's something in the list. """
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
return len(trait.my_paramstraitlist) > 0
|
||||
|
||||
|
||||
def move_index(self):
|
||||
# Move index of an item render queue while clamping it
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
index = trait.paramstraitlist_index
|
||||
list_length = len(trait.my_paramstraitlist) - 1
|
||||
new_index = 0
|
||||
def move_index(self):
|
||||
# Move index of an item render queue while clamping it
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
index = trait.paramstraitlist_index
|
||||
list_length = len(trait.my_paramstraitlist) - 1
|
||||
new_index = 0
|
||||
|
||||
if self.direction == 'UP':
|
||||
new_index = index - 1
|
||||
elif self.direction == 'DOWN':
|
||||
new_index = index + 1
|
||||
if self.direction == 'UP':
|
||||
new_index = index - 1
|
||||
elif self.direction == 'DOWN':
|
||||
new_index = index + 1
|
||||
|
||||
new_index = max(0, min(new_index, list_length))
|
||||
index = new_index
|
||||
new_index = max(0, min(new_index, list_length))
|
||||
index = new_index
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
list = trait.my_paramstraitlist
|
||||
index = trait.paramstraitlist_index
|
||||
def execute(self, context):
|
||||
trait = context.object.my_traitlist[context.object.traitlist_index]
|
||||
list = trait.my_paramstraitlist
|
||||
index = trait.paramstraitlist_index
|
||||
|
||||
if self.direction == 'DOWN':
|
||||
neighbor = index + 1
|
||||
#queue.move(index,neighbor)
|
||||
self.move_index()
|
||||
if self.direction == 'DOWN':
|
||||
neighbor = index + 1
|
||||
#queue.move(index,neighbor)
|
||||
self.move_index()
|
||||
|
||||
elif self.direction == 'UP':
|
||||
neighbor = index - 1
|
||||
#queue.move(neighbor, index)
|
||||
self.move_index()
|
||||
else:
|
||||
return{'CANCELLED'}
|
||||
return{'FINISHED'}
|
||||
elif self.direction == 'UP':
|
||||
neighbor = index - 1
|
||||
#queue.move(neighbor, index)
|
||||
self.move_index()
|
||||
else:
|
||||
return{'CANCELLED'}
|
||||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
|
|
@ -31,3 +31,6 @@ def fetch_script_names():
|
|||
for file in glob.glob('*.hx'):
|
||||
wrd.scripts_list.add().name = file.rsplit('.')[0]
|
||||
os.chdir(get_fp())
|
||||
|
||||
def to_hex(val):
|
||||
return '#%02x%02x%02x%02x' % (int(val[3] * 255), int(val[0] * 255), int(val[1] * 255), int(val[2] * 255))
|
||||
|
|
|
@ -677,11 +677,9 @@ void main() {
|
|||
#endif
|
||||
vec2 envBRDF = texture(senvmapBrdf, vec2(roughness, 1.0 - dotNV)).xy;
|
||||
vec3 indirectSpecular = prefilteredColor * (f0 * envBRDF.x + envBRDF.y);
|
||||
vec3 indirect += indirectSpecular;
|
||||
indirect += indirectSpecular;
|
||||
#endif
|
||||
|
||||
indirect = indirect * lightColor * lightStrength * envmapStrength;
|
||||
|
||||
outColor = vec4(vec3(direct * visibility + indirect), 1.0);
|
||||
|
||||
#ifdef _OMTex
|
||||
|
|
Loading…
Reference in a new issue