]> git.sesse.net Git - casparcg/commitdiff
[scene_producer] Added scene_width and scene_height variables that can be used from...
authorHelge Norberg <helge.norberg@svt.se>
Mon, 13 Feb 2017 15:16:18 +0000 (16:16 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 13 Feb 2017 15:16:18 +0000 (16:16 +0100)
core/producer/scene/scene.xsd
core/producer/scene/scene_producer.cpp

index ea0f78151b20141ed3e0c5809a46c858d1808812..b6008fafe29de08b9d325147f46de8da6fd9d6ea 100644 (file)
@@ -10,8 +10,9 @@
               Public variables are accessible as CG parameters and by the parent scene when nested inside another.
               There are some variables that are always defined like
               "frame" which stores the number of frames that have gone by since the scene producer started,
-              "mouse_x" and "mouse_y" which reflect the X and Y position of the mouse at all times relative to the scene coordinate system (requires interaction aware consumer like screen_consumer) and
-              "timeline_frame" which differs from "frame" in that it can rewind and jump, depending on where the timeline is at the moment.
+              "mouse_x" and "mouse_y" which reflect the X and Y position of the mouse at all times relative to the scene coordinate system (requires interaction aware consumer like screen_consumer),
+              "timeline_frame" which differs from "frame" in that it can rewind and jump, depending on where the timeline is at the moment and
+              "scene_width" and "scene_height" which contains the dimensions of the scene coordinate system.
             </xs:documentation>
           </xs:annotation>
           <xs:complexType>
index f5f2a625edf0b0257f329578f703799009d78183..935fb577a9ca3db6553fb9291f91359f9caf88cd 100644 (file)
@@ -142,7 +142,6 @@ struct scene_producer::impl
 
        impl(std::wstring producer_name, int width, int height, const video_format_desc& format_desc)
                : producer_name_(std::move(producer_name))
-               , pixel_constraints_(width, height)
                , format_desc_(format_desc)
                , aggregator_([=] (double x, double y) { return collission_detect(x, y); })
        {
@@ -166,6 +165,13 @@ struct scene_producer::impl
                mouse_y_ = mouse_y_variable->value();
                m_x_ = 0;
                m_y_ = 0;
+
+               auto scene_width = std::make_shared<core::variable_impl<double>>(boost::lexical_cast<std::wstring>(width), false, width);
+               auto scene_height = std::make_shared<core::variable_impl<double>>(boost::lexical_cast<std::wstring>(height), false, height);
+               store_variable(L"scene_width", scene_width);
+               store_variable(L"scene_height", scene_height);
+               pixel_constraints_.width = scene_width->value();
+               pixel_constraints_.height = scene_height->value();
        }
 
        layer& create_layer(