forked from LeenkxTeam/LNXSDK
merge upstream
This commit is contained in:
@ -889,6 +889,10 @@ class Scene {
|
||||
|
||||
if (StringTools.endsWith(ptype, "Object") && pval != "") {
|
||||
Reflect.setProperty(traitInst, pname, Scene.active.getChild(pval));
|
||||
} else if (ptype == "TSceneFormat" && pval != "") {
|
||||
Data.getSceneRaw(pval, function (r: TSceneFormat) {
|
||||
Reflect.setProperty(traitInst, pname, r);
|
||||
});
|
||||
}
|
||||
else {
|
||||
switch (ptype) {
|
||||
|
@ -14,7 +14,7 @@ class Time {
|
||||
return 1 / frequency;
|
||||
}
|
||||
|
||||
static var _fixedStep: Null<Float>;
|
||||
static var _fixedStep: Null<Float> = 1/60;
|
||||
public static var fixedStep(get, never): Float;
|
||||
static function get_fixedStep(): Float {
|
||||
return _fixedStep;
|
||||
|
@ -3057,6 +3057,8 @@ class LeenkxExporter:
|
||||
|
||||
if trait_prop.type.endswith("Object"):
|
||||
value = lnx.utils.asset_name(trait_prop.value_object)
|
||||
elif trait_prop.type == "TSceneFormat":
|
||||
value = lnx.utils.asset_name(trait_prop.value_scene)
|
||||
else:
|
||||
value = trait_prop.get_value()
|
||||
|
||||
|
@ -15,7 +15,8 @@ PROP_TYPE_ICONS = {
|
||||
"CameraObject": "CAMERA_DATA",
|
||||
"LightObject": "LIGHT_DATA",
|
||||
"MeshObject": "MESH_DATA",
|
||||
"SpeakerObject": "OUTLINER_DATA_SPEAKER"
|
||||
"SpeakerObject": "OUTLINER_DATA_SPEAKER",
|
||||
"TSceneFormat": "SCENE_DATA"
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +60,8 @@ class LnxTraitPropListItem(bpy.types.PropertyGroup):
|
||||
("CameraObject", "Camera Object", "Camera Object Type"),
|
||||
("LightObject", "Light Object", "Light Object Type"),
|
||||
("MeshObject", "Mesh Object", "Mesh Object Type"),
|
||||
("SpeakerObject", "Speaker Object", "Speaker Object Type")),
|
||||
("SpeakerObject", "Speaker Object", "Speaker Object Type"),
|
||||
("TSceneFormat", "Scene", "Scene Type")),
|
||||
name="Type",
|
||||
description="The type of this property",
|
||||
default="String",
|
||||
@ -78,6 +80,7 @@ class LnxTraitPropListItem(bpy.types.PropertyGroup):
|
||||
name="Value", type=bpy.types.Object, poll=filter_objects,
|
||||
override={"LIBRARY_OVERRIDABLE"}
|
||||
)
|
||||
value_scene: PointerProperty(name="Value", type=bpy.types.Scene, override={"LIBRARY_OVERRIDABLE"})
|
||||
|
||||
def set_value(self, val):
|
||||
# Would require way too much effort, so it's out of scope here.
|
||||
@ -126,6 +129,11 @@ class LnxTraitPropListItem(bpy.types.PropertyGroup):
|
||||
if self.value_object is not None:
|
||||
return self.value_object.name
|
||||
return ""
|
||||
if self.type == "TSceneFormat":
|
||||
if self.value_scene is not None:
|
||||
return self.value_scene.name
|
||||
return ""
|
||||
|
||||
|
||||
return self.value_string
|
||||
|
||||
@ -144,6 +152,8 @@ class LNX_UL_PropList(bpy.types.UIList):
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
if item.type.endswith("Object"):
|
||||
sp.prop_search(item, "value_object", context.scene, "objects", text="", icon=custom_icon)
|
||||
elif item.type.endswith("TSceneFormat"):
|
||||
sp.prop_search(item, "value_scene", bpy.data, "scenes", text="", icon=custom_icon)
|
||||
else:
|
||||
use_emboss = item.type in ("Bool", "String")
|
||||
sp.prop(item, item_value_ref, text="", emboss=use_emboss)
|
||||
|
@ -444,7 +444,7 @@ def fetch_script_props(filename: str):
|
||||
|
||||
# Property type is annotated
|
||||
if p_type is not None:
|
||||
if p_type.startswith("iron.object."):
|
||||
if p_type.startswith("iron.object.") or p_type == "iron.data.SceneFormat.TSceneFormat":
|
||||
p_type = p_type[12:]
|
||||
elif p_type.startswith("iron.math."):
|
||||
p_type = p_type[10:]
|
||||
@ -522,7 +522,7 @@ def get_type_default_value(prop_type: str):
|
||||
if prop_type == "Float":
|
||||
return 0.0
|
||||
if prop_type == "String" or prop_type in (
|
||||
"Object", "CameraObject", "LightObject", "MeshObject", "SpeakerObject"):
|
||||
"Object", "CameraObject", "LightObject", "MeshObject", "SpeakerObject", "TSceneFormat"):
|
||||
return ""
|
||||
if prop_type == "Bool":
|
||||
return False
|
||||
|
Reference in New Issue
Block a user